@@ -127,7 +127,6 @@ template<class V, class T> class PersistentValueVector;
127
127
template<class T, class P> class WeakCallbackObject;
128
128
class FunctionTemplate;
129
129
class ObjectTemplate;
130
- class Data;
131
130
template<typename T> class FunctionCallbackInfo;
132
131
template<typename T> class PropertyCallbackInfo;
133
132
class StackTrace;
@@ -137,10 +136,6 @@ class CallHandlerHelper;
137
136
class EscapableHandleScope;
138
137
template<typename T> class ReturnValue;
139
138
140
- namespace experimental {
141
- class FastAccessorBuilder;
142
- } // namespace experimental
143
-
144
139
namespace internal {
145
140
class Arguments;
146
141
class Heap;
@@ -155,30 +150,6 @@ class GlobalHandles;
155
150
} // namespace internal
156
151
157
152
158
- /**
159
- * General purpose unique identifier.
160
- */
161
- class UniqueId {
162
- public:
163
- explicit UniqueId(intptr_t data)
164
- : data_(data) {}
165
-
166
- bool operator==(const UniqueId& other) const {
167
- return data_ == other.data_;
168
- }
169
-
170
- bool operator!=(const UniqueId& other) const {
171
- return data_ != other.data_;
172
- }
173
-
174
- bool operator<(const UniqueId& other) const {
175
- return data_ < other.data_;
176
- }
177
-
178
- private:
179
- intptr_t data_;
180
- };
181
-
182
153
// --- Handles ---
183
154
184
155
#define TYPE_CHECK(T, S) \
@@ -388,19 +359,18 @@ class MaybeLocal {
388
359
// Eternal handles are set-once handles that live for the life of the isolate.
389
360
template <class T> class Eternal {
390
361
public:
391
- V8_INLINE Eternal() : index_(kInitialValue ) { }
392
- template<class S>
393
- V8_INLINE Eternal(Isolate* isolate, Local<S> handle) : index_(kInitialValue ) {
362
+ V8_INLINE Eternal() : val_(nullptr ) {}
363
+ template <class S>
364
+ V8_INLINE Eternal(Isolate* isolate, Local<S> handle) : val_(nullptr ) {
394
365
Set(isolate, handle);
395
366
}
396
367
// Can only be safely called if already set.
397
- V8_INLINE Local<T> Get(Isolate* isolate);
398
- V8_INLINE bool IsEmpty() { return index_ == kInitialValue ; }
368
+ V8_INLINE Local<T> Get(Isolate* isolate) const ;
369
+ V8_INLINE bool IsEmpty() const { return val_ == nullptr ; }
399
370
template<class S> V8_INLINE void Set(Isolate* isolate, Local<S> handle);
400
371
401
372
private:
402
- static const int kInitialValue = -1;
403
- int index_;
373
+ T* val_;
404
374
};
405
375
406
376
@@ -1922,7 +1892,7 @@ class V8_EXPORT NativeWeakMap : public Data {
1922
1892
public:
1923
1893
static Local<NativeWeakMap> New(Isolate* isolate);
1924
1894
void Set(Local<Value> key, Local<Value> value);
1925
- Local<Value> Get(Local<Value> key);
1895
+ Local<Value> Get(Local<Value> key) const ;
1926
1896
bool Has(Local<Value> key);
1927
1897
bool Delete(Local<Value> key);
1928
1898
};
@@ -5122,16 +5092,6 @@ class V8_EXPORT FunctionTemplate : public Template {
5122
5092
static MaybeLocal<FunctionTemplate> FromSnapshot(Isolate* isolate,
5123
5093
size_t index);
5124
5094
5125
- /**
5126
- * Creates a function template with a fast handler. If a fast handler is set,
5127
- * the callback cannot be null.
5128
- */
5129
- static Local<FunctionTemplate> NewWithFastHandler(
5130
- Isolate* isolate, FunctionCallback callback,
5131
- experimental::FastAccessorBuilder* fast_handler = nullptr,
5132
- Local<Value> data = Local<Value>(),
5133
- Local<Signature> signature = Local<Signature>(), int length = 0);
5134
-
5135
5095
/**
5136
5096
* Creates a function template backed/cached by a private property.
5137
5097
*/
@@ -5159,9 +5119,8 @@ class V8_EXPORT FunctionTemplate : public Template {
5159
5119
* callback is called whenever the function created from this
5160
5120
* FunctionTemplate is called.
5161
5121
*/
5162
- void SetCallHandler(
5163
- FunctionCallback callback, Local<Value> data = Local<Value>(),
5164
- experimental::FastAccessorBuilder* fast_handler = nullptr);
5122
+ void SetCallHandler(FunctionCallback callback,
5123
+ Local<Value> data = Local<Value>());
5165
5124
5166
5125
/** Set the predefined length property for the FunctionTemplate. */
5167
5126
void SetLength(int length);
@@ -6824,45 +6783,6 @@ class V8_EXPORT Isolate {
6824
6783
*/
6825
6784
Local<Value> ThrowException(Local<Value> exception);
6826
6785
6827
- /**
6828
- * Allows the host application to group objects together. If one
6829
- * object in the group is alive, all objects in the group are alive.
6830
- * After each garbage collection, object groups are removed. It is
6831
- * intended to be used in the before-garbage-collection callback
6832
- * function, for instance to simulate DOM tree connections among JS
6833
- * wrapper objects. Object groups for all dependent handles need to
6834
- * be provided for kGCTypeMarkSweepCompact collections, for all other
6835
- * garbage collection types it is sufficient to provide object groups
6836
- * for partially dependent handles only.
6837
- */
6838
- template <typename T>
6839
- V8_DEPRECATED("Use EmbedderHeapTracer",
6840
- void SetObjectGroupId(const Persistent<T>& object,
6841
- UniqueId id));
6842
-
6843
- /**
6844
- * Allows the host application to declare implicit references from an object
6845
- * group to an object. If the objects of the object group are alive, the child
6846
- * object is alive too. After each garbage collection, all implicit references
6847
- * are removed. It is intended to be used in the before-garbage-collection
6848
- * callback function.
6849
- */
6850
- template <typename T>
6851
- V8_DEPRECATED("Use EmbedderHeapTracer",
6852
- void SetReferenceFromGroup(UniqueId id,
6853
- const Persistent<T>& child));
6854
-
6855
- /**
6856
- * Allows the host application to declare implicit references from an object
6857
- * to another object. If the parent object is alive, the child object is alive
6858
- * too. After each garbage collection, all implicit references are removed. It
6859
- * is intended to be used in the before-garbage-collection callback function.
6860
- */
6861
- template <typename T, typename S>
6862
- V8_DEPRECATED("Use EmbedderHeapTracer",
6863
- void SetReference(const Persistent<T>& parent,
6864
- const Persistent<S>& child));
6865
-
6866
6786
typedef void (*GCCallback)(Isolate* isolate, GCType type,
6867
6787
GCCallbackFlags flags);
6868
6788
@@ -7223,16 +7143,6 @@ class V8_EXPORT Isolate {
7223
7143
void SetAllowCodeGenerationFromStringsCallback(
7224
7144
AllowCodeGenerationFromStringsCallback callback);
7225
7145
7226
- /**
7227
- * Set the callback to invoke to check if wasm compilation from
7228
- * the specified object is allowed. By default, wasm compilation
7229
- * is allowed.
7230
- *
7231
- * Similar for instantiate.
7232
- */
7233
- void SetAllowWasmCompileCallback(AllowWasmCompileCallback callback);
7234
- void SetAllowWasmInstantiateCallback(AllowWasmInstantiateCallback callback);
7235
-
7236
7146
/**
7237
7147
* Check if V8 is dead and therefore unusable. This is the case after
7238
7148
* fatal errors such as out-of-memory situations.
@@ -7328,9 +7238,6 @@ class V8_EXPORT Isolate {
7328
7238
template <class K, class V, class Traits>
7329
7239
friend class PersistentValueMapBase;
7330
7240
7331
- void SetObjectGroupId(internal::Object** object, UniqueId id);
7332
- void SetReferenceFromGroup(UniqueId id, internal::Object** object);
7333
- void SetReference(internal::Object** parent, internal::Object** child);
7334
7241
void ReportExternalAllocationLimitReached();
7335
7242
};
7336
7243
@@ -7709,10 +7616,7 @@ class V8_EXPORT V8 {
7709
7616
WeakCallbackInfo<void>::Callback weak_callback);
7710
7617
static void MakeWeak(internal::Object*** location_addr);
7711
7618
static void* ClearWeak(internal::Object** location);
7712
- static void Eternalize(Isolate* isolate,
7713
- Value* handle,
7714
- int* index);
7715
- static Local<Value> GetEternal(Isolate* isolate, int index);
7619
+ static Value* Eternalize(Isolate* isolate, Value* handle);
7716
7620
7717
7621
static void RegisterExternallyReferencedObject(internal::Object** object,
7718
7622
internal::Isolate* isolate);
@@ -8531,8 +8435,8 @@ class Internals {
8531
8435
static const int kNodeIsIndependentShift = 3;
8532
8436
static const int kNodeIsActiveShift = 4;
8533
8437
8534
- static const int kJSApiObjectType = 0xb9 ;
8535
- static const int kJSObjectType = 0xba ;
8438
+ static const int kJSApiObjectType = 0xbb ;
8439
+ static const int kJSObjectType = 0xbc ;
8536
8440
static const int kFirstNonstringType = 0x80;
8537
8441
static const int kOddballType = 0x82;
8538
8442
static const int kForeignType = 0x86;
@@ -8677,13 +8581,15 @@ template<class T>
8677
8581
template<class S>
8678
8582
void Eternal<T>::Set(Isolate* isolate, Local<S> handle) {
8679
8583
TYPE_CHECK(T, S);
8680
- V8::Eternalize(isolate, reinterpret_cast<Value*>(*handle), &this->index_);
8584
+ val_ = reinterpret_cast<T*>(
8585
+ V8::Eternalize(isolate, reinterpret_cast<Value*>(*handle)));
8681
8586
}
8682
8587
8683
-
8684
- template<class T>
8685
- Local<T> Eternal<T>::Get(Isolate* isolate) {
8686
- return Local<T>(reinterpret_cast<T*>(*V8::GetEternal(isolate, index_)));
8588
+ template <class T>
8589
+ Local<T> Eternal<T>::Get(Isolate* isolate) const {
8590
+ // The eternal handle will never go away, so as with the roots, we don't even
8591
+ // need to open a handle.
8592
+ return Local<T>(val_);
8687
8593
}
8688
8594
8689
8595
@@ -9740,33 +9646,6 @@ int64_t Isolate::AdjustAmountOfExternalAllocatedMemory(
9740
9646
return *external_memory;
9741
9647
}
9742
9648
9743
-
9744
- template<typename T>
9745
- void Isolate::SetObjectGroupId(const Persistent<T>& object,
9746
- UniqueId id) {
9747
- TYPE_CHECK(Value, T);
9748
- SetObjectGroupId(reinterpret_cast<internal::Object**>(object.val_), id);
9749
- }
9750
-
9751
-
9752
- template<typename T>
9753
- void Isolate::SetReferenceFromGroup(UniqueId id,
9754
- const Persistent<T>& object) {
9755
- TYPE_CHECK(Value, T);
9756
- SetReferenceFromGroup(id, reinterpret_cast<internal::Object**>(object.val_));
9757
- }
9758
-
9759
-
9760
- template<typename T, typename S>
9761
- void Isolate::SetReference(const Persistent<T>& parent,
9762
- const Persistent<S>& child) {
9763
- TYPE_CHECK(Object, T);
9764
- TYPE_CHECK(Value, S);
9765
- SetReference(reinterpret_cast<internal::Object**>(parent.val_),
9766
- reinterpret_cast<internal::Object**>(child.val_));
9767
- }
9768
-
9769
-
9770
9649
Local<Value> Context::GetEmbedderData(int index) {
9771
9650
#ifndef V8_ENABLE_CHECKS
9772
9651
typedef internal::Object O;
0 commit comments