v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
js-collection.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_H_
6#define V8_OBJECTS_JS_COLLECTION_H_
7
10
11// Has to be the last include (doesn't have include guards):
13
14namespace v8 {
15namespace internal {
16
17class OrderedHashSet;
18class OrderedHashMap;
19
20#include "torque-generated/src/objects/js-collection-tq.inc"
21
23 : public TorqueGeneratedJSCollection<JSCollection, JSObject> {
24 public:
25 static const int kAddFunctionDescriptorIndex = 3;
26
28};
29
30// The JSSet describes ECMAScript Harmony sets
31class JSSet : public TorqueGeneratedJSSet<JSSet, JSCollection> {
32 public:
33 static void Initialize(DirectHandle<JSSet> set, Isolate* isolate);
34 static void Clear(Isolate* isolate, DirectHandle<JSSet> set);
35 void Rehash(Isolate* isolate);
36
37 // Dispatched behavior.
40
42};
43
45 : public OrderedHashTableIterator<JSSetIterator, OrderedHashSet> {
46 public:
47 // Dispatched behavior.
50
53};
54
55// The JSMap describes ECMAScript Harmony maps
56class JSMap : public TorqueGeneratedJSMap<JSMap, JSCollection> {
57 public:
58 static void Initialize(DirectHandle<JSMap> map, Isolate* isolate);
59 static void Clear(Isolate* isolate, DirectHandle<JSMap> map);
60 void Rehash(Isolate* isolate);
61
62 // Dispatched behavior.
65
67};
68
70 : public OrderedHashTableIterator<JSMapIterator, OrderedHashMap> {
71 public:
72 // Dispatched behavior.
75
76 // Returns the current value of the iterator. This should only be called when
77 // |HasMore| returns true.
78 inline Tagged<Object> CurrentValue();
79
82};
83
84// Base class for both JSWeakMap and JSWeakSet
86 : public TorqueGeneratedJSWeakCollection<JSWeakCollection, JSObject> {
87 public:
88 static void Initialize(DirectHandle<JSWeakCollection> collection,
89 Isolate* isolate);
92 DirectHandle<Object> value, int32_t hash);
93 static bool Delete(DirectHandle<JSWeakCollection> collection,
94 DirectHandle<Object> key, int32_t hash);
96 int max_entries);
97
98 static const int kAddFunctionDescriptorIndex = 3;
99
100 // Iterates the function object according to the visiting policy.
101 class BodyDescriptorImpl;
102
103 // Visit the whole object.
105
106 static const int kHeaderSizeOfAllWeakCollections = kHeaderSize;
107
109};
110
111// The JSWeakMap describes ECMAScript Harmony weak maps
112class JSWeakMap : public TorqueGeneratedJSWeakMap<JSWeakMap, JSWeakCollection> {
113 public:
114 // Dispatched behavior.
117
118 static_assert(kHeaderSize == kHeaderSizeOfAllWeakCollections);
120};
121
122// The JSWeakSet describes ECMAScript Harmony weak sets
123class JSWeakSet : public TorqueGeneratedJSWeakSet<JSWeakSet, JSWeakCollection> {
124 public:
125 // Dispatched behavior.
128
129 static_assert(kHeaderSize == kHeaderSizeOfAllWeakCollections);
131};
132
133} // namespace internal
134} // namespace v8
135
137
138#endif // V8_OBJECTS_JS_COLLECTION_H_
static const int kAddFunctionDescriptorIndex
OBJECT_CONSTRUCTORS(JSMapIterator, OrderedHashTableIterator< JSMapIterator, OrderedHashMap >)
void Rehash(Isolate *isolate)
Definition objects.cc:6282
static void Clear(Isolate *isolate, DirectHandle< JSSet > set)
Definition objects.cc:6276
static void Initialize(DirectHandle< JSSet > set, Isolate *isolate)
Definition objects.cc:6271
#define DECL_VERIFIER(Name)
#define DECL_PRINTER(Name)
#define TQ_OBJECT_CONSTRUCTORS(Type)
#define OBJECT_CONSTRUCTORS(Type,...)
#define V8_EXPORT_PRIVATE
Definition macros.h:460
std::unique_ptr< ValueMirror > key