LCOV - code coverage report
Current view: top level - src/objects - struct-inl.h (source / functions) Hit Total Coverage
Test: app.info Lines: 28 31 90.3 %
Date: 2019-01-20 Functions: 16 19 84.2 %

          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/oddball.h"
      12             : 
      13             : // Has to be the last include (doesn't have include guards):
      14             : #include "src/objects/object-macros.h"
      15             : 
      16             : namespace v8 {
      17             : namespace internal {
      18             : 
      19    22049254 : OBJECT_CONSTRUCTORS_IMPL(Struct, HeapObject)
      20             : // TODO(jkummerow): Fix IsTuple2() and IsTuple3() to be subclassing-aware,
      21             : // or rethink this more generally (see crbug.com/v8/8516).
      22      243190 : Tuple2::Tuple2(Address ptr) : Struct(ptr) {}
      23           0 : Tuple3::Tuple3(Address ptr) : Tuple2(ptr) {}
      24     3992376 : OBJECT_CONSTRUCTORS_IMPL(AccessorPair, Struct)
      25             : 
      26     1996188 : CAST_ACCESSOR(AccessorPair)
      27    11024628 : CAST_ACCESSOR(Struct)
      28      121595 : CAST_ACCESSOR(Tuple2)
      29           0 : CAST_ACCESSOR(Tuple3)
      30             : 
      31    11024618 : void Struct::InitializeBody(int object_size) {
      32    22049240 :   Object value = GetReadOnlyRoots().undefined_value();
      33   129306730 :   for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) {
      34   118282108 :     WRITE_FIELD(this, offset, value);
      35             :   }
      36    11024622 : }
      37             : 
      38      563713 : ACCESSORS(Tuple2, value1, Object, kValue1Offset)
      39      563713 : ACCESSORS(Tuple2, value2, Object, kValue2Offset)
      40           0 : ACCESSORS(Tuple3, value3, Object, kValue3Offset)
      41             : 
      42     8758122 : ACCESSORS(AccessorPair, getter, Object, kGetterOffset)
      43     5168906 : ACCESSORS(AccessorPair, setter, Object, kSetterOffset)
      44             : 
      45       96690 : Object AccessorPair::get(AccessorComponent component) {
      46       96690 :   return component == ACCESSOR_GETTER ? getter() : setter();
      47             : }
      48             : 
      49        6296 : void AccessorPair::set(AccessorComponent component, Object value) {
      50        6296 :   if (component == ACCESSOR_GETTER) {
      51        4514 :     set_getter(value);
      52             :   } else {
      53        1782 :     set_setter(value);
      54             :   }
      55        6296 : }
      56             : 
      57      768233 : void AccessorPair::SetComponents(Object getter, Object setter) {
      58      768233 :   if (!getter->IsNull()) set_getter(getter);
      59      768233 :   if (!setter->IsNull()) set_setter(setter);
      60      768233 : }
      61             : 
      62       24724 : bool AccessorPair::Equals(Object getter_value, Object setter_value) {
      63       57804 :   return (getter() == getter_value) && (setter() == setter_value);
      64             : }
      65             : 
      66             : }  // namespace internal
      67             : }  // namespace v8
      68             : 
      69             : #include "src/objects/object-macros-undef.h"
      70             : 
      71             : #endif  // V8_OBJECTS_STRUCT_INL_H_

Generated by: LCOV version 1.10