LCOV - code coverage report
Current view: top level - src/snapshot - snapshot-source-sink.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 23 23 100.0 %
Date: 2019-04-19 Functions: 5 5 100.0 %

          Line data    Source code
       1             : // Copyright 2014 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : 
       6             : #include "src/snapshot/snapshot-source-sink.h"
       7             : 
       8             : #include "src/base/logging.h"
       9             : #include "src/handles-inl.h"
      10             : #include "src/objects-inl.h"
      11             : 
      12             : namespace v8 {
      13             : namespace internal {
      14             : 
      15     5343298 : void SnapshotByteSink::PutInt(uintptr_t integer, const char* description) {
      16             :   DCHECK_LT(integer, 1 << 30);
      17     5343298 :   integer <<= 2;
      18             :   int bytes = 1;
      19     5343298 :   if (integer > 0xFF) bytes = 2;
      20     5343298 :   if (integer > 0xFFFF) bytes = 3;
      21     5343298 :   if (integer > 0xFFFFFF) bytes = 4;
      22     5343298 :   integer |= (bytes - 1);
      23     5343298 :   Put(static_cast<int>(integer & 0xFF), "IntPart1");
      24     5343298 :   if (bytes > 1) Put(static_cast<int>((integer >> 8) & 0xFF), "IntPart2");
      25     5343298 :   if (bytes > 2) Put(static_cast<int>((integer >> 16) & 0xFF), "IntPart3");
      26     5343298 :   if (bytes > 3) Put(static_cast<int>((integer >> 24) & 0xFF), "IntPart4");
      27     5343298 : }
      28             : 
      29             : 
      30     2529220 : void SnapshotByteSink::PutRaw(const byte* data, int number_of_bytes,
      31             :                               const char* description) {
      32     5058440 :   data_.insert(data_.end(), data, data + number_of_bytes);
      33     2529220 : }
      34             : 
      35           5 : void SnapshotByteSink::Append(const SnapshotByteSink& other) {
      36           5 :   data_.insert(data_.end(), other.data_.begin(), other.data_.end());
      37           5 : }
      38             : 
      39      122054 : int SnapshotByteSource::GetBlob(const byte** data) {
      40      122054 :   int size = GetInt();
      41      122054 :   CHECK(position_ + size <= length_);
      42      122054 :   *data = &data_[position_];
      43             :   Advance(size);
      44      122054 :   return size;
      45             : }
      46             : }  // namespace internal
      47      122036 : }  // namespace v8

Generated by: LCOV version 1.10