Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: src/api.cc

Issue 2059173002: Reland of place all remaining Oddball checks with new function (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.h ('k') | src/api-natives.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 @@
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 @@
// --- 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
arraysize(argv), argv)
.ToHandle(&result);
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
- return Just(result->IsTrue());
+ return Just(result->IsTrue(isolate));
}
@@ -6317,7 +6333,7 @@
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 @@
arraysize(argv), argv)
.ToHandle(&result);
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
- return Just(result->IsTrue());
+ return Just(result->IsTrue(isolate));
}
@@ -6409,7 +6425,7 @@
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 @@
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);
}
« no previous file with comments | « src/api.h ('k') | src/api-natives.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698