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

Unified Diff: src/objects.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/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index dabc1f980050b1f77414e883c2011a6064fbe0d2..06e130737616b84e7801f137cf34e72a85df17e9 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -232,10 +232,10 @@
bool Object::BooleanValue() {
if (IsSmi()) return Smi::cast(this)->value() != 0;
- if (IsBoolean()) return IsTrue();
DCHECK(IsHeapObject());
Isolate* isolate = HeapObject::cast(this)->GetIsolate();
- if (IsUndefined(isolate) || IsNull()) return false;
+ if (IsBoolean()) return IsTrue(isolate);
+ if (IsUndefined(isolate) || IsNull(isolate)) return false;
if (IsUndetectable()) return false; // Undetectable object is false.
if (IsString()) return String::cast(this)->length() != 0;
if (IsHeapNumber()) return HeapNumber::cast(this)->HeapNumberBooleanValue();
@@ -694,7 +694,7 @@
Isolate* isolate = receiver->GetIsolate();
ASSIGN_RETURN_ON_EXCEPTION(isolate, func,
JSReceiver::GetProperty(receiver, name), Object);
- if (func->IsNull() || func->IsUndefined(isolate)) {
+ if (func->IsNull(isolate) || func->IsUndefined(isolate)) {
return isolate->factory()->undefined_value();
}
if (!func->IsCallable()) {
@@ -1111,7 +1111,7 @@
isolate, handler_proto,
Execution::Call(isolate, trap, handler, arraysize(argv), argv), Object);
// 8. If Type(handlerProto) is neither Object nor Null, throw a TypeError.
- if (!(handler_proto->IsJSReceiver() || handler_proto->IsNull())) {
+ if (!(handler_proto->IsJSReceiver() || handler_proto->IsNull(isolate))) {
THROW_NEW_ERROR(isolate,
NewTypeError(MessageTemplate::kProxyGetPrototypeOfInvalid),
Object);
@@ -1693,7 +1693,7 @@
JSReceiver::GetProperty(Handle<JSReceiver>::cast(constructor),
isolate->factory()->species_symbol()),
Object);
- if (constructor->IsNull()) {
+ if (constructor->IsNull(isolate)) {
constructor = isolate->factory()->undefined_value();
}
}
@@ -2326,11 +2326,11 @@
os << "<undefined>";
} else if (IsTheHole(isolate)) {
os << "<the hole>";
- } else if (IsNull()) {
+ } else if (IsNull(isolate)) {
os << "<null>";
- } else if (IsTrue()) {
+ } else if (IsTrue(isolate)) {
os << "<true>";
- } else if (IsFalse()) {
+ } else if (IsFalse(isolate)) {
os << "<false>";
} else {
os << "<Odd Oddball: ";
@@ -6019,7 +6019,7 @@
DCHECK(result->IsBoolean());
// Rebox CustomArguments::kReturnValueOffset before returning.
- return Just(result->IsTrue());
+ return Just(result->IsTrue(isolate));
}
@@ -8426,9 +8426,9 @@
}
DCHECK(getter->IsCallable() || getter->IsUndefined(isolate) ||
- getter->IsNull() || getter->IsFunctionTemplateInfo());
+ getter->IsNull(isolate) || getter->IsFunctionTemplateInfo());
DCHECK(setter->IsCallable() || setter->IsUndefined(isolate) ||
- setter->IsNull() || getter->IsFunctionTemplateInfo());
+ setter->IsNull(isolate) || getter->IsFunctionTemplateInfo());
it->TransitionToAccessorProperty(getter, setter, attributes);
return isolate->factory()->undefined_value();
@@ -9249,7 +9249,7 @@
: &RuntimeCallStats::Map_TransitionToAccessorProperty);
// At least one of the accessors needs to be a new value.
- DCHECK(!getter->IsNull() || !setter->IsNull());
+ DCHECK(!getter->IsNull(isolate) || !setter->IsNull(isolate));
DCHECK(name->IsUniqueName());
// Dictionary maps can always have additional data properties.
@@ -9310,11 +9310,13 @@
if (current_pair->Equals(*getter, *setter)) return map;
bool overwriting_accessor = false;
- if (!getter->IsNull() && !current_pair->get(ACCESSOR_GETTER)->IsNull() &&
+ if (!getter->IsNull(isolate) &&
+ !current_pair->get(ACCESSOR_GETTER)->IsNull(isolate) &&
current_pair->get(ACCESSOR_GETTER) != *getter) {
overwriting_accessor = true;
}
- if (!setter->IsNull() && !current_pair->get(ACCESSOR_SETTER)->IsNull() &&
+ if (!setter->IsNull(isolate) &&
+ !current_pair->get(ACCESSOR_SETTER)->IsNull(isolate) &&
current_pair->get(ACCESSOR_SETTER) != *setter) {
overwriting_accessor = true;
}
@@ -10090,7 +10092,7 @@
.ToHandleChecked();
}
Isolate* isolate = accessor_pair->GetIsolate();
- if (accessor->IsNull()) {
+ if (accessor->IsNull(isolate)) {
return isolate->factory()->undefined_value();
}
return handle(accessor, isolate);
@@ -12127,8 +12129,9 @@
}
map->set_has_hidden_prototype(is_hidden);
- WriteBarrierMode wb_mode =
- prototype->IsNull() ? SKIP_WRITE_BARRIER : UPDATE_WRITE_BARRIER;
+ WriteBarrierMode wb_mode = prototype->IsNull(map->GetIsolate())
+ ? SKIP_WRITE_BARRIER
+ : UPDATE_WRITE_BARRIER;
map->set_prototype(*prototype, wb_mode);
}
@@ -14802,7 +14805,7 @@
STACK_CHECK(isolate, Nothing<bool>());
Handle<Name> trap_name = isolate->factory()->setPrototypeOf_string();
// 1. Assert: Either Type(V) is Object or Type(V) is Null.
- DCHECK(value->IsJSReceiver() || value->IsNull());
+ DCHECK(value->IsJSReceiver() || value->IsNull(isolate));
// 2. Let handler be the value of the [[ProxyHandler]] internal slot of O.
Handle<Object> handler(proxy->handler(), isolate);
// 3. If handler is null, throw a TypeError exception.
@@ -14889,7 +14892,7 @@
Heap* heap = isolate->heap();
// Silently ignore the change if value is not a JSObject or null.
// SpiderMonkey behaves this way.
- if (!value->IsJSReceiver() && !value->IsNull()) return Just(true);
+ if (!value->IsJSReceiver() && !value->IsNull(isolate)) return Just(true);
bool dictionary_elements_in_chain =
object->map()->DictionaryElementsInPrototypeChainOnly();
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698