| Index: include/v8.h
|
| diff --git a/include/v8.h b/include/v8.h
|
| index 2d21355d6008851421256b534211c7cb543ea1df..628c5d1af189516ed162f34363c6c9489278fa47 100644
|
| --- a/include/v8.h
|
| +++ b/include/v8.h
|
| @@ -5301,6 +5301,7 @@ class Internals {
|
| static const int kExternalTwoByteRepresentationTag = 0x02;
|
| static const int kExternalAsciiRepresentationTag = 0x06;
|
|
|
| + static const int kIsolateStateOffset = 0;
|
| static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize;
|
| static const int kIsolateRootsOffset = 3 * kApiPointerSize;
|
| static const int kUndefinedValueRootIndex = 5;
|
| @@ -5325,12 +5326,6 @@ class Internals {
|
| static const int kUndefinedOddballKind = 5;
|
| static const int kNullOddballKind = 3;
|
|
|
| -#ifdef V8_ENABLE_CHECKS
|
| - static void CheckInitialized(v8::Isolate* isolate);
|
| -#else
|
| - static void CheckInitialized(v8::Isolate* isolate) { }
|
| -#endif
|
| -
|
| V8_INLINE(static bool HasHeapObjectTag(internal::Object* value)) {
|
| return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) ==
|
| kHeapObjectTag);
|
| @@ -5364,6 +5359,11 @@ class Internals {
|
| return representation == kExternalTwoByteRepresentationTag;
|
| }
|
|
|
| + V8_INLINE(static bool IsInitialized(v8::Isolate* isolate)) {
|
| + uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateStateOffset;
|
| + 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);
|
| @@ -5939,7 +5939,7 @@ String* String::Cast(v8::Value* value) {
|
| Local<String> String::Empty(Isolate* isolate) {
|
| typedef internal::Object* S;
|
| typedef internal::Internals I;
|
| - I::CheckInitialized(isolate);
|
| + if (!I::IsInitialized(isolate)) return Empty();
|
| S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex);
|
| return Local<String>(reinterpret_cast<String*>(slot));
|
| }
|
| @@ -6292,7 +6292,7 @@ ReturnValue<T> PropertyCallbackInfo<T>::GetReturnValue() const {
|
| Handle<Primitive> Undefined(Isolate* isolate) {
|
| typedef internal::Object* S;
|
| typedef internal::Internals I;
|
| - I::CheckInitialized(isolate);
|
| + if (!I::IsInitialized(isolate)) return Undefined();
|
| S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex);
|
| return Handle<Primitive>(reinterpret_cast<Primitive*>(slot));
|
| }
|
| @@ -6301,7 +6301,7 @@ Handle<Primitive> Undefined(Isolate* isolate) {
|
| Handle<Primitive> Null(Isolate* isolate) {
|
| typedef internal::Object* S;
|
| typedef internal::Internals I;
|
| - I::CheckInitialized(isolate);
|
| + if (!I::IsInitialized(isolate)) return Null();
|
| S* slot = I::GetRoot(isolate, I::kNullValueRootIndex);
|
| return Handle<Primitive>(reinterpret_cast<Primitive*>(slot));
|
| }
|
| @@ -6310,7 +6310,7 @@ Handle<Primitive> Null(Isolate* isolate) {
|
| Handle<Boolean> True(Isolate* isolate) {
|
| typedef internal::Object* S;
|
| typedef internal::Internals I;
|
| - I::CheckInitialized(isolate);
|
| + if (!I::IsInitialized(isolate)) return True();
|
| S* slot = I::GetRoot(isolate, I::kTrueValueRootIndex);
|
| return Handle<Boolean>(reinterpret_cast<Boolean*>(slot));
|
| }
|
| @@ -6319,7 +6319,7 @@ Handle<Boolean> True(Isolate* isolate) {
|
| Handle<Boolean> False(Isolate* isolate) {
|
| typedef internal::Object* S;
|
| typedef internal::Internals I;
|
| - I::CheckInitialized(isolate);
|
| + if (!I::IsInitialized(isolate)) return False();
|
| S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex);
|
| return Handle<Boolean>(reinterpret_cast<Boolean*>(slot));
|
| }
|
|
|