| Index: include/v8.h
|
| diff --git a/include/v8.h b/include/v8.h
|
| index 0efc8f6384816d67e7a3cd1ae6e2468bfa7dafa5..71b2d060022f63aaaebb05857b5f231226e9ce4c 100644
|
| --- a/include/v8.h
|
| +++ b/include/v8.h
|
| @@ -600,7 +600,7 @@ template <class T> class PersistentBase {
|
| * is alive. Only allowed when the embedder is asked to trace its heap by
|
| * EmbedderHeapTracer.
|
| */
|
| - V8_INLINE void RegisterExternalReference(Isolate* isolate);
|
| + V8_INLINE void RegisterExternalReference(Isolate* isolate) const;
|
|
|
| /**
|
| * Marks the reference to this object independent. Garbage collector is free
|
| @@ -7353,7 +7353,8 @@ class Internals {
|
| static const int kNodeIsPartiallyDependentShift = 4;
|
| static const int kNodeIsActiveShift = 4;
|
|
|
| - static const int kJSObjectType = 0xb6;
|
| + static const int kJSObjectType = 0xb7;
|
| + static const int kJSApiObjectType = 0xb6;
|
| static const int kFirstNonstringType = 0x80;
|
| static const int kOddballType = 0x83;
|
| static const int kForeignType = 0x87;
|
| @@ -7658,7 +7659,7 @@ P* PersistentBase<T>::ClearWeak() {
|
| }
|
|
|
| template <class T>
|
| -void PersistentBase<T>::RegisterExternalReference(Isolate* isolate) {
|
| +void PersistentBase<T>::RegisterExternalReference(Isolate* isolate) const {
|
| if (IsEmpty()) return;
|
| V8::RegisterExternallyReferencedObject(
|
| reinterpret_cast<internal::Object**>(this->val_),
|
| @@ -7985,7 +7986,9 @@ Local<Value> Object::GetInternalField(int index) {
|
| O* obj = *reinterpret_cast<O**>(this);
|
| // Fast path: If the object is a plain JSObject, which is the common case, we
|
| // know where to find the internal fields and can return the value directly.
|
| - if (I::GetInstanceType(obj) == I::kJSObjectType) {
|
| + auto instance_type = I::GetInstanceType(obj);
|
| + if (instance_type == I::kJSObjectType ||
|
| + instance_type == I::kJSApiObjectType) {
|
| int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
|
| O* value = I::ReadField<O*>(obj, offset);
|
| O** result = HandleScope::CreateHandle(reinterpret_cast<HO*>(obj), value);
|
| @@ -8003,7 +8006,9 @@ void* Object::GetAlignedPointerFromInternalField(int index) {
|
| O* obj = *reinterpret_cast<O**>(this);
|
| // Fast path: If the object is a plain JSObject, which is the common case, we
|
| // know where to find the internal fields and can return the value directly.
|
| - if (V8_LIKELY(I::GetInstanceType(obj) == I::kJSObjectType)) {
|
| + auto instance_type = I::GetInstanceType(obj);
|
| + if (V8_LIKELY(instance_type == I::kJSObjectType ||
|
| + instance_type == I::kJSApiObjectType)) {
|
| int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
|
| return I::ReadField<void*>(obj, offset);
|
| }
|
|
|