v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
js-collection-inl.h
Go to the documentation of this file.
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
9// Include the non-inl header before the rest of the headers.
10
16#include "src/roots/roots-inl.h"
17
18// Has to be the last include (doesn't have include guards):
20
21namespace v8 {
22namespace internal {
23
24#include "torque-generated/src/objects/js-collection-tq-inl.inc"
25
29TQ_OBJECT_CONSTRUCTORS_IMPL(JSWeakCollection)
32
33template <class Derived, class TableType>
34OrderedHashTableIterator<Derived, TableType>::OrderedHashTableIterator(
35 Address ptr)
36 : JSCollectionIterator(ptr) {}
37
38JSMapIterator::JSMapIterator(Address ptr)
39 : OrderedHashTableIterator<JSMapIterator, OrderedHashMap>(ptr) {
40 SLOW_DCHECK(IsJSMapIterator(*this));
41}
42
43JSSetIterator::JSSetIterator(Address ptr)
44 : OrderedHashTableIterator<JSSetIterator, OrderedHashSet>(ptr) {
45 SLOW_DCHECK(IsJSSetIterator(*this));
46}
47
48Tagged<Object> JSMapIterator::CurrentValue() {
49 Tagged<OrderedHashMap> table = Cast<OrderedHashMap>(this->table());
50 int index = Smi::ToInt(this->index());
51 DCHECK_GE(index, 0);
52 InternalIndex entry(index);
53 Tagged<Object> value = table->ValueAt(entry);
54 DCHECK(!IsHashTableHole(value));
55 return value;
56}
57
58} // namespace internal
59} // namespace v8
60
62
63#endif // V8_OBJECTS_JS_COLLECTION_INL_H_
#define SLOW_DCHECK(condition)
Definition checks.h:21
OptionalOpIndex index
#define TQ_OBJECT_CONSTRUCTORS_IMPL(Type)
#define DCHECK_GE(v1, v2)
Definition logging.h:488
#define DCHECK(condition)
Definition logging.h:482
std::unique_ptr< ValueMirror > value