LCOV - code coverage report
Current view: top level - src/objects - free-space-inl.h (source / functions) Hit Total Coverage
Test: app.info Lines: 4 4 100.0 %
Date: 2019-03-21 Functions: 0 1 0.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-write-barrier-inl.h"
      11             : #include "src/heap/heap.h"
      12             : #include "src/isolate.h"
      13             : #include "src/objects-inl.h"
      14             : 
      15             : // Has to be the last include (doesn't have include guards):
      16             : #include "src/objects/object-macros.h"
      17             : 
      18             : namespace v8 {
      19             : namespace internal {
      20             : 
      21             : OBJECT_CONSTRUCTORS_IMPL(FreeSpace, HeapObject)
      22             : 
      23     1933798 : SMI_ACCESSORS(FreeSpace, size, kSizeOffset)
      24    86651931 : RELAXED_SMI_ACCESSORS(FreeSpace, size, kSizeOffset)
      25             : 
      26             : int FreeSpace::Size() { return size(); }
      27             : 
      28             : FreeSpace FreeSpace::next() {
      29             : #ifdef DEBUG
      30             :   Heap* heap = GetHeapFromWritableObject(*this);
      31             :   Object free_space_map =
      32             :       Isolate::FromHeap(heap)->root(RootIndex::kFreeSpaceMap);
      33             :   DCHECK_IMPLIES(!map_slot().contains_value(free_space_map->ptr()),
      34             :                  !heap->deserialization_complete() &&
      35             :                      map_slot().contains_value(kNullAddress));
      36             : #endif
      37             :   DCHECK_LE(kNextOffset + kTaggedSize, relaxed_read_size());
      38     1274300 :   return FreeSpace::unchecked_cast(*ObjectSlot(address() + kNextOffset));
      39             : }
      40             : 
      41             : void FreeSpace::set_next(FreeSpace next) {
      42             : #ifdef DEBUG
      43             :   Heap* heap = GetHeapFromWritableObject(*this);
      44             :   Object free_space_map =
      45             :       Isolate::FromHeap(heap)->root(RootIndex::kFreeSpaceMap);
      46             :   DCHECK_IMPLIES(!map_slot().contains_value(free_space_map->ptr()),
      47             :                  !heap->deserialization_complete() &&
      48             :                      map_slot().contains_value(kNullAddress));
      49             : #endif
      50             :   DCHECK_LE(kNextOffset + kTaggedSize, relaxed_read_size());
      51    20693978 :   ObjectSlot(address() + kNextOffset).Relaxed_Store(next);
      52             : }
      53             : 
      54             : FreeSpace FreeSpace::cast(HeapObject o) {
      55             :   SLOW_DCHECK(!GetHeapFromWritableObject(o)->deserialization_complete() ||
      56             :               o->IsFreeSpace());
      57             :   return bit_cast<FreeSpace>(o);
      58             : }
      59             : 
      60             : FreeSpace FreeSpace::unchecked_cast(const Object o) {
      61             :   return bit_cast<FreeSpace>(o);
      62             : }
      63             : 
      64             : }  // namespace internal
      65             : }  // namespace v8
      66             : 
      67             : #include "src/objects/object-macros-undef.h"
      68             : 
      69             : #endif  // V8_OBJECTS_FREE_SPACE_INL_H_

Generated by: LCOV version 1.10