Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 62160ddd0cbd14ca80e5dffb04f15e23554cd098..f460b5ec041b59c131de48b62ef09d1c4815053b 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -2603,7 +2603,7 @@ static bool getBoolProperty(const StackFrame* f, const char* propertyName) { |
i::Handle<i::JSObject> self = Utils::OpenHandle(f); |
i::Handle<i::Object> obj = |
i::JSReceiver::GetProperty(isolate, self, propertyName).ToHandleChecked(); |
- return obj->IsTrue(); |
+ return obj->IsTrue(isolate); |
} |
bool StackFrame::IsEval() const { return getBoolProperty(this, "isEval"); } |
@@ -2771,26 +2771,38 @@ MaybeLocal<String> JSON::Stringify(Local<Context> context, |
// --- D a t a --- |
bool Value::FullIsUndefined() const { |
- bool result = Utils::OpenHandle(this)->IsUndefined(); |
+ i::Handle<i::Object> object = Utils::OpenHandle(this); |
+ bool result = false; |
+ if (!object->IsSmi()) { |
+ result = object->IsUndefined(i::HeapObject::cast(*object)->GetIsolate()); |
+ } |
DCHECK_EQ(result, QuickIsUndefined()); |
return result; |
} |
bool Value::FullIsNull() const { |
- bool result = Utils::OpenHandle(this)->IsNull(); |
+ i::Handle<i::Object> object = Utils::OpenHandle(this); |
+ bool result = false; |
+ if (!object->IsSmi()) { |
+ result = object->IsNull(i::HeapObject::cast(*object)->GetIsolate()); |
+ } |
DCHECK_EQ(result, QuickIsNull()); |
return result; |
} |
bool Value::IsTrue() const { |
- return Utils::OpenHandle(this)->IsTrue(); |
+ i::Handle<i::Object> object = Utils::OpenHandle(this); |
+ if (object->IsSmi()) return false; |
+ return object->IsTrue(i::HeapObject::cast(*object)->GetIsolate()); |
} |
bool Value::IsFalse() const { |
- return Utils::OpenHandle(this)->IsFalse(); |
+ i::Handle<i::Object> object = Utils::OpenHandle(this); |
+ if (object->IsSmi()) return false; |
+ return object->IsFalse(i::HeapObject::cast(*object)->GetIsolate()); |
} |
@@ -4039,7 +4051,7 @@ static Maybe<bool> ObjectSetAccessor(Local<Context> context, Object* self, |
has_pending_exception = |
!i::JSObject::SetAccessor(obj, info).ToHandle(&result); |
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
- if (result->IsUndefined()) return Nothing<bool>(); |
+ if (result->IsUndefined(obj->GetIsolate())) return Nothing<bool>(); |
if (fast) { |
i::JSObject::MigrateSlowToFast(obj, 0, "APISetAccessor"); |
} |
@@ -5329,7 +5341,7 @@ double Number::Value() const { |
bool Boolean::Value() const { |
i::Handle<i::Object> obj = Utils::OpenHandle(this); |
- return obj->IsTrue(); |
+ return obj->IsTrue(i::HeapObject::cast(*obj)->GetIsolate()); |
} |
@@ -5420,7 +5432,10 @@ void v8::Object::SetAlignedPointerInInternalField(int index, void* value) { |
static void* ExternalValue(i::Object* obj) { |
// Obscure semantics for undefined, but somehow checked in our unit tests... |
- if (obj->IsUndefined()) return NULL; |
+ if (!obj->IsSmi() && |
+ obj->IsUndefined(i::HeapObject::cast(obj)->GetIsolate())) { |
+ return NULL; |
+ } |
i::Object* foreign = i::JSObject::cast(obj)->GetInternalField(0); |
return i::Foreign::cast(foreign)->foreign_address(); |
} |
@@ -5673,7 +5688,8 @@ void Context::AllowCodeGenerationFromStrings(bool allow) { |
bool Context::IsCodeGenerationFromStringsAllowed() { |
i::Handle<i::Context> context = Utils::OpenHandle(this); |
- return !context->allow_code_gen_from_strings()->IsFalse(); |
+ return !context->allow_code_gen_from_strings()->IsFalse( |
+ context->GetIsolate()); |
} |
@@ -6057,7 +6073,7 @@ bool v8::BooleanObject::ValueOf() const { |
i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); |
i::Isolate* isolate = jsvalue->GetIsolate(); |
LOG_API(isolate, BooleanObject, BooleanValue); |
- return jsvalue->value()->IsTrue(); |
+ return jsvalue->value()->IsTrue(isolate); |
} |
@@ -6304,7 +6320,7 @@ Maybe<bool> Map::Has(Local<Context> context, Local<Value> key) { |
arraysize(argv), argv) |
.ToHandle(&result); |
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
- return Just(result->IsTrue()); |
+ return Just(result->IsTrue(isolate)); |
} |
@@ -6317,7 +6333,7 @@ Maybe<bool> Map::Delete(Local<Context> context, Local<Value> key) { |
self, arraysize(argv), argv) |
.ToHandle(&result); |
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
- return Just(result->IsTrue()); |
+ return Just(result->IsTrue(isolate)); |
} |
@@ -6396,7 +6412,7 @@ Maybe<bool> Set::Has(Local<Context> context, Local<Value> key) { |
arraysize(argv), argv) |
.ToHandle(&result); |
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
- return Just(result->IsTrue()); |
+ return Just(result->IsTrue(isolate)); |
} |
@@ -6409,7 +6425,7 @@ Maybe<bool> Set::Delete(Local<Context> context, Local<Value> key) { |
self, arraysize(argv), argv) |
.ToHandle(&result); |
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
- return Just(result->IsTrue()); |
+ return Just(result->IsTrue(isolate)); |
} |
@@ -6583,7 +6599,7 @@ bool Promise::HasHandler() { |
LOG_API(isolate, Promise, HasRejectHandler); |
ENTER_V8(isolate); |
i::Handle<i::Symbol> key = isolate->factory()->promise_has_handler_symbol(); |
- return i::JSReceiver::GetDataProperty(promise, key)->IsTrue(); |
+ return i::JSReceiver::GetDataProperty(promise, key)->IsTrue(isolate); |
} |