LCOV - code coverage report
Current view: top level - src/objects - free-space-inl.h (source / functions) Hit Total Coverage
Test: app.info Lines: 6 6 100.0 %
Date: 2019-01-20 Functions: 3 3 100.0 %

          Line data    Source code
       1             : // Copyright 2018 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             : #ifndef V8_OBJECTS_FREE_SPACE_INL_H_
       6             : #define V8_OBJECTS_FREE_SPACE_INL_H_
       7             : 
       8             : #include "src/objects/free-space.h"
       9             : 
      10             : #include "src/heap/heap-inl.h"
      11             : 
      12             : // Has to be the last include (doesn't have include guards):
      13             : #include "src/objects/object-macros.h"
      14             : 
      15             : namespace v8 {
      16             : namespace internal {
      17             : 
      18             : OBJECT_CONSTRUCTORS_IMPL(FreeSpace, HeapObject)
      19             : 
      20     4031742 : SMI_ACCESSORS(FreeSpace, size, kSizeOffset)
      21    86378103 : RELAXED_SMI_ACCESSORS(FreeSpace, size, kSizeOffset)
      22             : 
      23             : int FreeSpace::Size() { return size(); }
      24             : 
      25             : FreeSpace FreeSpace::next() {
      26             : #ifdef DEBUG
      27             :   Heap* heap = Heap::FromWritableHeapObject(*this);
      28             :   Object free_space_map = heap->isolate()->root(RootIndex::kFreeSpaceMap);
      29             :   DCHECK_IMPLIES(!map_slot().contains_value(free_space_map->ptr()),
      30             :                  !heap->deserialization_complete() &&
      31             :                      map_slot().contains_value(kNullAddress));
      32             : #endif
      33             :   DCHECK_LE(kNextOffset + kPointerSize, relaxed_read_size());
      34     1332630 :   return FreeSpace::unchecked_cast(*ObjectSlot(address() + kNextOffset));
      35             : }
      36             : 
      37             : void FreeSpace::set_next(FreeSpace next) {
      38             : #ifdef DEBUG
      39             :   Heap* heap = Heap::FromWritableHeapObject(*this);
      40             :   Object free_space_map = heap->isolate()->root(RootIndex::kFreeSpaceMap);
      41             :   DCHECK_IMPLIES(!map_slot().contains_value(free_space_map->ptr()),
      42             :                  !heap->deserialization_complete() &&
      43             :                      map_slot().contains_value(kNullAddress));
      44             : #endif
      45             :   DCHECK_LE(kNextOffset + kPointerSize, relaxed_read_size());
      46    22741788 :   ObjectSlot(address() + kNextOffset).Relaxed_Store(next);
      47             : }
      48             : 
      49           2 : FreeSpace FreeSpace::cast(HeapObject o) {
      50             :   SLOW_DCHECK(!Heap::FromWritableHeapObject(o)->deserialization_complete() ||
      51             :               o->IsFreeSpace());
      52           2 :   return bit_cast<FreeSpace>(o);
      53             : }
      54             : 
      55             : FreeSpace FreeSpace::unchecked_cast(const Object o) {
      56             :   return bit_cast<FreeSpace>(o);
      57             : }
      58             : 
      59             : }  // namespace internal
      60             : }  // namespace v8
      61             : 
      62             : #include "src/objects/object-macros-undef.h"
      63             : 
      64             : #endif  // V8_OBJECTS_FREE_SPACE_INL_H_

Generated by: LCOV version 1.10