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: 2017-04-26 Functions: 4 4 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   810956009 : void SnapshotByteSource::CopyRaw(byte* to, int number_of_bytes) {
      16   810956009 :   memcpy(to, data_ + position_, number_of_bytes);
      17   810956009 :   position_ += number_of_bytes;
      18   810956009 : }
      19             : 
      20             : 
      21     7981570 : void SnapshotByteSink::PutInt(uintptr_t integer, const char* description) {
      22             :   DCHECK(integer < 1 << 30);
      23     7981570 :   integer <<= 2;
      24             :   int bytes = 1;
      25     7981570 :   if (integer > 0xff) bytes = 2;
      26     7981570 :   if (integer > 0xffff) bytes = 3;
      27     7981570 :   if (integer > 0xffffff) bytes = 4;
      28     7981570 :   integer |= (bytes - 1);
      29     7981570 :   Put(static_cast<int>(integer & 0xff), "IntPart1");
      30     7981570 :   if (bytes > 1) Put(static_cast<int>((integer >> 8) & 0xff), "IntPart2");
      31     7981570 :   if (bytes > 2) Put(static_cast<int>((integer >> 16) & 0xff), "IntPart3");
      32     7981570 :   if (bytes > 3) Put(static_cast<int>((integer >> 24) & 0xff), "IntPart4");
      33     7981570 : }
      34             : 
      35             : 
      36     1796661 : void SnapshotByteSink::PutRaw(const byte* data, int number_of_bytes,
      37             :                               const char* description) {
      38     1796661 :   data_.AddAll(Vector<byte>(const_cast<byte*>(data), number_of_bytes));
      39     1796661 : }
      40             : 
      41             : 
      42     2379120 : int SnapshotByteSource::GetBlob(const byte** data) {
      43     2379120 :   int size = GetInt();
      44     2379120 :   CHECK(position_ + size <= length_);
      45     2379120 :   *data = &data_[position_];
      46             :   Advance(size);
      47     2379120 :   return size;
      48             : }
      49             : }  // namespace internal
      50             : }  // namespace v8

Generated by: LCOV version 1.10