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

          Line data    Source code
       1             : // Copyright 2017 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_JS_COLLECTION_INL_H_
       6             : #define V8_OBJECTS_JS_COLLECTION_INL_H_
       7             : 
       8             : #include "src/objects/js-collection.h"
       9             : 
      10             : #include "src/objects-inl.h"  // Needed for write barriers
      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(JSCollection, JSObject)
      19      331058 : OBJECT_CONSTRUCTORS_IMPL(JSMap, JSCollection)
      20      494026 : OBJECT_CONSTRUCTORS_IMPL(JSSet, JSCollection)
      21      158774 : OBJECT_CONSTRUCTORS_IMPL(JSWeakCollection, JSObject)
      22      100198 : OBJECT_CONSTRUCTORS_IMPL(JSWeakMap, JSWeakCollection)
      23          40 : OBJECT_CONSTRUCTORS_IMPL(JSWeakSet, JSWeakCollection)
      24             : 
      25             : // TODO(jkummerow): Move JSCollectionIterator to js-collection.h?
      26             : // TODO(jkummerow): Introduce IsJSCollectionIterator() check? Or unchecked
      27             : // version of OBJECT_CONSTRUCTORS_IMPL macro?
      28             : JSCollectionIterator::JSCollectionIterator(Address ptr) : JSObject(ptr) {}
      29             : template <class Derived, class TableType>
      30             : OrderedHashTableIterator<Derived, TableType>::OrderedHashTableIterator(
      31             :     Address ptr)
      32             :     : JSCollectionIterator(ptr) {}
      33             : 
      34         311 : JSMapIterator::JSMapIterator(Address ptr)
      35             :     : OrderedHashTableIterator<JSMapIterator, OrderedHashMap>(ptr) {
      36             :   SLOW_DCHECK(IsJSMapIterator());
      37         311 : }
      38             : 
      39         256 : JSSetIterator::JSSetIterator(Address ptr)
      40             :     : OrderedHashTableIterator<JSSetIterator, OrderedHashSet>(ptr) {
      41             :   SLOW_DCHECK(IsJSSetIterator());
      42         256 : }
      43             : 
      44     3064384 : ACCESSORS(JSCollection, table, Object, kTableOffset)
      45        3425 : ACCESSORS(JSCollectionIterator, table, Object, kTableOffset)
      46        4448 : ACCESSORS(JSCollectionIterator, index, Object, kIndexOffset)
      47             : 
      48      258815 : ACCESSORS(JSWeakCollection, table, Object, kTableOffset)
      49             : 
      50      247013 : CAST_ACCESSOR(JSSet)
      51         256 : CAST_ACCESSOR(JSSetIterator)
      52      165529 : CAST_ACCESSOR(JSMap)
      53         311 : CAST_ACCESSOR(JSMapIterator)
      54       79408 : CAST_ACCESSOR(JSWeakCollection)
      55       50099 : CAST_ACCESSOR(JSWeakMap)
      56          20 : CAST_ACCESSOR(JSWeakSet)
      57             : 
      58             : Object JSMapIterator::CurrentValue() {
      59             :   OrderedHashMap table = OrderedHashMap::cast(this->table());
      60             :   int index = Smi::ToInt(this->index());
      61             :   Object value = table->ValueAt(index);
      62             :   DCHECK(!value->IsTheHole());
      63             :   return value;
      64             : }
      65             : 
      66             : }  // namespace internal
      67             : }  // namespace v8
      68             : 
      69             : #include "src/objects/object-macros-undef.h"
      70             : 
      71             : #endif  // V8_OBJECTS_JS_COLLECTION_INL_H_

Generated by: LCOV version 1.10