LCOV - code coverage report
Current view: top level - src/snapshot - snapshot-source-sink.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 19 19 100.0 %
Date: 2017-10-20 Functions: 3 3 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     7587743 : void SnapshotByteSink::PutInt(uintptr_t integer, const char* description) {
      16             :   DCHECK_LT(integer, 1 << 30);
      17     7587743 :   integer <<= 2;
      18             :   int bytes = 1;
      19     7587743 :   if (integer > 0xff) bytes = 2;
      20     7587743 :   if (integer > 0xffff) bytes = 3;
      21     7587743 :   if (integer > 0xffffff) bytes = 4;
      22     7587743 :   integer |= (bytes - 1);
      23     7587743 :   Put(static_cast<int>(integer & 0xff), "IntPart1");
      24     7587743 :   if (bytes > 1) Put(static_cast<int>((integer >> 8) & 0xff), "IntPart2");
      25     7587743 :   if (bytes > 2) Put(static_cast<int>((integer >> 16) & 0xff), "IntPart3");
      26     7587743 :   if (bytes > 3) Put(static_cast<int>((integer >> 24) & 0xff), "IntPart4");
      27     7587743 : }
      28             : 
      29             : 
      30     1899232 : void SnapshotByteSink::PutRaw(const byte* data, int number_of_bytes,
      31             :                               const char* description) {
      32     3798464 :   data_.insert(data_.end(), data, data + number_of_bytes);
      33     1899232 : }
      34             : 
      35             : 
      36     1511804 : int SnapshotByteSource::GetBlob(const byte** data) {
      37     1511804 :   int size = GetInt();
      38     1511804 :   CHECK(position_ + size <= length_);
      39     1511804 :   *data = &data_[position_];
      40             :   Advance(size);
      41     1511804 :   return size;
      42             : }
      43             : }  // namespace internal
      44             : }  // namespace v8

Generated by: LCOV version 1.10