LCOV - code coverage report
Current view: top level - src/objects - prototype-info-inl.h (source / functions) Hit Total Coverage
Test: app.info Lines: 11 11 100.0 %
Date: 2019-04-19 Functions: 5 5 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_PROTOTYPE_INFO_INL_H_
       6             : #define V8_OBJECTS_PROTOTYPE_INFO_INL_H_
       7             : 
       8             : #include "src/objects/prototype-info.h"
       9             : 
      10             : #include "src/heap/heap-write-barrier-inl.h"
      11             : #include "src/objects-inl.h"
      12             : #include "src/objects/fixed-array-inl.h"
      13             : #include "src/objects/map-inl.h"
      14             : #include "src/objects/maybe-object.h"
      15             : #include "src/objects/struct-inl.h"
      16             : 
      17             : // Has to be the last include (doesn't have include guards):
      18             : #include "src/objects/object-macros.h"
      19             : 
      20             : namespace v8 {
      21             : namespace internal {
      22             : 
      23             : OBJECT_CONSTRUCTORS_IMPL(PrototypeInfo, Struct)
      24             : 
      25             : CAST_ACCESSOR(PrototypeInfo)
      26             : 
      27             : Map PrototypeInfo::ObjectCreateMap() {
      28             :   return Map::cast(object_create_map()->GetHeapObjectAssumeWeak());
      29             : }
      30             : 
      31             : // static
      32             : void PrototypeInfo::SetObjectCreateMap(Handle<PrototypeInfo> info,
      33             :                                        Handle<Map> map) {
      34      239342 :   info->set_object_create_map(HeapObjectReference::Weak(*map));
      35             : }
      36             : 
      37             : bool PrototypeInfo::HasObjectCreateMap() {
      38             :   MaybeObject cache = object_create_map();
      39             :   return cache->IsWeak();
      40             : }
      41             : 
      42     2955909 : ACCESSORS(PrototypeInfo, module_namespace, Object, kJsModuleNamespaceOffset)
      43     9046206 : ACCESSORS(PrototypeInfo, prototype_users, Object, kPrototypeUsersOffset)
      44      721421 : WEAK_ACCESSORS(PrototypeInfo, object_create_map, kObjectCreateMapOffset)
      45     4739155 : SMI_ACCESSORS(PrototypeInfo, registry_slot, kRegistrySlotOffset)
      46    29691882 : SMI_ACCESSORS(PrototypeInfo, bit_field, kBitFieldOffset)
      47     1102812 : BOOL_ACCESSORS(PrototypeInfo, bit_field, should_be_fast_map, kShouldBeFastBit)
      48             : 
      49      126943 : void PrototypeUsers::MarkSlotEmpty(WeakArrayList array, int index) {
      50             :   DCHECK_GT(index, 0);
      51             :   DCHECK_LT(index, array->length());
      52             :   // Chain the empty slots into a linked list (each empty slot contains the
      53             :   // index of the next empty slot).
      54      126943 :   array->Set(index, MaybeObject::FromObject(empty_slot_index(array)));
      55             :   set_empty_slot_index(array, index);
      56      126943 : }
      57             : 
      58             : Smi PrototypeUsers::empty_slot_index(WeakArrayList array) {
      59             :   return array->Get(kEmptySlotIndex).ToSmi();
      60             : }
      61             : 
      62             : void PrototypeUsers::set_empty_slot_index(WeakArrayList array, int index) {
      63      344419 :   array->Set(kEmptySlotIndex, MaybeObject::FromObject(Smi::FromInt(index)));
      64             : }
      65             : 
      66             : }  // namespace internal
      67             : }  // namespace v8
      68             : 
      69             : #include "src/objects/object-macros-undef.h"
      70             : 
      71             : #endif  // V8_OBJECTS_PROTOTYPE_INFO_INL_H_

Generated by: LCOV version 1.10