LCOV - code coverage report
Current view: top level - src/objects - struct-inl.h (source / functions) Hit Total Coverage
Test: app.info Lines: 25 26 96.2 %
Date: 2019-03-21 Functions: 11 12 91.7 %

          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_STRUCT_INL_H_
       6             : #define V8_OBJECTS_STRUCT_INL_H_
       7             : 
       8             : #include "src/objects/struct.h"
       9             : 
      10             : #include "src/heap/heap-write-barrier-inl.h"
      11             : #include "src/objects-inl.h"
      12             : #include "src/objects/oddball.h"
      13             : #include "src/roots-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        1624 : OBJECT_CONSTRUCTORS_IMPL(Struct, HeapObject)
      22             : // TODO(jkummerow): Fix IsTuple2() and IsTuple3() to be subclassing-aware,
      23             : // or rethink this more generally (see crbug.com/v8/8516).
      24         168 : Tuple2::Tuple2(Address ptr) : Struct(ptr) {}
      25             : Tuple3::Tuple3(Address ptr) : Tuple2(ptr) {}
      26             : OBJECT_CONSTRUCTORS_IMPL(AccessorPair, Struct)
      27             : 
      28             : OBJECT_CONSTRUCTORS_IMPL(ClassPositions, Struct)
      29             : 
      30             : CAST_ACCESSOR(AccessorPair)
      31             : CAST_ACCESSOR(Struct)
      32             : CAST_ACCESSOR(Tuple2)
      33             : CAST_ACCESSOR(Tuple3)
      34             : 
      35             : CAST_ACCESSOR(ClassPositions)
      36             : 
      37    11087404 : void Struct::InitializeBody(int object_size) {
      38             :   Object value = GetReadOnlyRoots().undefined_value();
      39   235104654 :   for (int offset = kHeaderSize; offset < object_size; offset += kTaggedSize) {
      40   112008625 :     WRITE_FIELD(*this, offset, value);
      41             :   }
      42    11087404 : }
      43             : 
      44      317881 : ACCESSORS(Tuple2, value1, Object, kValue1Offset)
      45      317881 : ACCESSORS(Tuple2, value2, Object, kValue2Offset)
      46           0 : ACCESSORS(Tuple3, value3, Object, kValue3Offset)
      47             : 
      48    10122813 : ACCESSORS(AccessorPair, getter, Object, kGetterOffset)
      49     7345103 : ACCESSORS(AccessorPair, setter, Object, kSetterOffset)
      50             : 
      51       61818 : SMI_ACCESSORS(ClassPositions, start, kStartOffset)
      52       61818 : SMI_ACCESSORS(ClassPositions, end, kEndOffset)
      53             : 
      54       92668 : Object AccessorPair::get(AccessorComponent component) {
      55      185336 :   return component == ACCESSOR_GETTER ? getter() : setter();
      56             : }
      57             : 
      58        6307 : void AccessorPair::set(AccessorComponent component, Object value) {
      59        6307 :   if (component == ACCESSOR_GETTER) {
      60        4519 :     set_getter(value);
      61             :   } else {
      62        1788 :     set_setter(value);
      63             :   }
      64        6307 : }
      65             : 
      66     1533808 : void AccessorPair::SetComponents(Object getter, Object setter) {
      67     1533808 :   if (!getter->IsNull()) set_getter(getter);
      68     1533811 :   if (!setter->IsNull()) set_setter(setter);
      69     1533812 : }
      70             : 
      71       24660 : bool AccessorPair::Equals(Object getter_value, Object setter_value) {
      72       33002 :   return (getter() == getter_value) && (setter() == setter_value);
      73             : }
      74             : 
      75             : }  // namespace internal
      76             : }  // namespace v8
      77             : 
      78             : #include "src/objects/object-macros-undef.h"
      79             : 
      80             : #endif  // V8_OBJECTS_STRUCT_INL_H_

Generated by: LCOV version 1.10