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

Unified Diff: src/objects.cc

Issue 1589323002: [runtime] Unify the ToObject handling. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 4d40f417f977598e99a11878e141a915b49dcdbe..902fccccf8dc14c11603b385ce1e6027ded4fe21 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -98,7 +98,9 @@ MaybeHandle<JSReceiver> Object::ToObject(Isolate* isolate,
int constructor_function_index =
Handle<HeapObject>::cast(object)->map()->GetConstructorFunctionIndex();
if (constructor_function_index == Map::kNoConstructorFunctionIndex) {
- return MaybeHandle<JSReceiver>();
+ THROW_NEW_ERROR(isolate,
+ NewTypeError(MessageTemplate::kUndefinedOrNullToObject),
+ JSReceiver);
}
constructor = handle(
JSFunction::cast(native_context->get(constructor_function_index)),
@@ -16553,8 +16555,8 @@ MaybeHandle<String> Object::ObjectProtoToString(Isolate* isolate,
if (object->IsUndefined()) return isolate->factory()->undefined_to_string();
if (object->IsNull()) return isolate->factory()->null_to_string();
- Handle<JSReceiver> receiver;
- CHECK(Object::ToObject(isolate, object).ToHandle(&receiver));
+ Handle<JSReceiver> receiver =
+ Object::ToObject(isolate, object).ToHandleChecked();
Handle<String> tag;
if (FLAG_harmony_tostring) {
« src/builtins.cc ('K') | « src/objects.h ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698