Index: src/runtime/runtime-object.cc |
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc |
index 07ba01f957ad108153a546656c61ce1d9a418a2f..f77216e798bc54a11df42cc7a75f2ca54b31a416 100644 |
--- a/src/runtime/runtime-object.cc |
+++ b/src/runtime/runtime-object.cc |
@@ -1461,5 +1461,19 @@ RUNTIME_FUNCTION(Runtime_DefineSetterPropertyUnchecked) { |
setter, attrs)); |
return isolate->heap()->undefined_value(); |
} |
+ |
+ |
+RUNTIME_FUNCTION(Runtime_ToObject) { |
+ HandleScope scope(isolate); |
+ DCHECK_EQ(1, args.length()); |
+ CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
+ Handle<JSReceiver> receiver; |
+ if (JSReceiver::ToObject(isolate, object).ToHandle(&receiver)) { |
+ return *receiver; |
+ } |
+ THROW_NEW_ERROR_RETURN_FAILURE( |
+ isolate, NewTypeError(MessageTemplate::kUndefinedOrNullToObject)); |
+} |
+ |
} // namespace internal |
} // namespace v8 |