| Index: src/api.cc
|
| diff --git a/src/api.cc b/src/api.cc
|
| index 73b72ccfa15b7224b9cbefd9e5503330ae8307c1..ee8133a3960c71040454a5720d66d0dc3687ae25 100644
|
| --- a/src/api.cc
|
| +++ b/src/api.cc
|
| @@ -2619,7 +2619,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"); }
|
| @@ -2787,26 +2787,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());
|
| }
|
|
|
|
|
| @@ -4055,7 +4067,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");
|
| }
|
| @@ -5345,7 +5357,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());
|
| }
|
|
|
|
|
| @@ -5436,7 +5448,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();
|
| }
|
| @@ -5685,7 +5700,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());
|
| }
|
|
|
|
|
| @@ -6072,7 +6088,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);
|
| }
|
|
|
|
|
| @@ -6319,7 +6335,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));
|
| }
|
|
|
|
|
| @@ -6332,7 +6348,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));
|
| }
|
|
|
|
|
| @@ -6411,7 +6427,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));
|
| }
|
|
|
|
|
| @@ -6424,7 +6440,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));
|
| }
|
|
|
|
|
| @@ -6598,7 +6614,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);
|
| }
|
|
|
|
|
|
|