| Index: include/v8.h
|
| diff --git a/include/v8.h b/include/v8.h
|
| index bc2f5e7630c8c8722807bcd04358ca9a4b7c2d97..3d12193408255e8443ed7f3b0d485ec9a018156a 100644
|
| --- a/include/v8.h
|
| +++ b/include/v8.h
|
| @@ -4152,12 +4152,16 @@ class Internals {
|
| static const int kIsolateStateOffset = 0;
|
| static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize;
|
| static const int kIsolateRootsOffset = 3 * kApiPointerSize;
|
| + static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3;
|
| static const int kUndefinedValueRootIndex = 5;
|
| static const int kNullValueRootIndex = 7;
|
| static const int kTrueValueRootIndex = 8;
|
| static const int kFalseValueRootIndex = 9;
|
| static const int kEmptySymbolRootIndex = 119;
|
|
|
| + static const int kNodeIsIndependentShift = 4;
|
| + static const int kNodeIsPartiallyDependentShift = 5;
|
| +
|
| static const int kJSObjectType = 0xab;
|
| static const int kFirstNonstringType = 0x80;
|
| static const int kOddballType = 0x82;
|
| @@ -4196,6 +4200,18 @@ class Internals {
|
| return *reinterpret_cast<int*>(addr) == 1;
|
| }
|
|
|
| + V8_INLINE(static uint8_t GetNodeFlag(internal::Object** obj, int shift)) {
|
| + uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
|
| + return *addr & (1 << shift);
|
| + }
|
| +
|
| + V8_INLINE(static void UpdateNodeFlag(internal::Object** obj,
|
| + bool value, int shift)) {
|
| + uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
|
| + uint8_t mask = 1 << shift;
|
| + *addr = (*addr & ~mask) | (value << shift);
|
| + }
|
| +
|
| V8_INLINE(static void SetEmbedderData(v8::Isolate* isolate, void* data)) {
|
| uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) +
|
| kIsolateEmbedderDataOffset;
|
| @@ -4289,9 +4305,11 @@ bool Persistent<T>::IsIndependent() const {
|
|
|
| template <class T>
|
| bool Persistent<T>::IsIndependent(Isolate* isolate) const {
|
| + typedef internal::Internals I;
|
| if (this->IsEmpty()) return false;
|
| - return V8::IsGlobalIndependent(reinterpret_cast<internal::Isolate*>(isolate),
|
| - reinterpret_cast<internal::Object**>(**this));
|
| + if (!I::IsInitialized(isolate)) return false;
|
| + return I::GetNodeFlag(reinterpret_cast<internal::Object**>(**this),
|
| + I::kNodeIsIndependentShift);
|
| }
|
|
|
|
|
| @@ -4363,8 +4381,11 @@ void Persistent<T>::MarkIndependent() {
|
|
|
| template <class T>
|
| void Persistent<T>::MarkIndependent(Isolate* isolate) {
|
| - V8::MarkIndependent(reinterpret_cast<internal::Isolate*>(isolate),
|
| - reinterpret_cast<internal::Object**>(**this));
|
| + typedef internal::Internals I;
|
| + if (this->IsEmpty()) return;
|
| + if (!I::IsInitialized(isolate)) return;
|
| + I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(**this),
|
| + true, I::kNodeIsIndependentShift);
|
| }
|
|
|
| template <class T>
|
| @@ -4374,8 +4395,11 @@ void Persistent<T>::MarkPartiallyDependent() {
|
|
|
| template <class T>
|
| void Persistent<T>::MarkPartiallyDependent(Isolate* isolate) {
|
| - V8::MarkPartiallyDependent(reinterpret_cast<internal::Isolate*>(isolate),
|
| - reinterpret_cast<internal::Object**>(**this));
|
| + typedef internal::Internals I;
|
| + if (this->IsEmpty()) return;
|
| + if (!I::IsInitialized(isolate)) return;
|
| + I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(**this),
|
| + true, I::kNodeIsPartiallyDependentShift);
|
| }
|
|
|
| template <class T>
|
|
|