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

Unified Diff: src/execution.cc

Issue 1266013006: [stubs] Unify (and optimize) implementation of ToObject. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add missing support for %_ToObject in TurboFan and Crankshaft. Created 5 years, 5 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/deoptimizer.h ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/execution.cc
diff --git a/src/execution.cc b/src/execution.cc
index cdfa787447203b677f68fd499404e04f8b1a0db4..687c0f99f9d8be23d213c1b647000fc51c428f0a 100644
--- a/src/execution.cc
+++ b/src/execution.cc
@@ -548,14 +548,6 @@ MaybeHandle<Object> Execution::ToDetailString(
}
-MaybeHandle<Object> Execution::ToObject(
- Isolate* isolate, Handle<Object> obj) {
- if (obj->IsSpecObject()) return obj;
- // TODO(verwaest): Use Object::ToObject but throw an exception on failure.
- RETURN_NATIVE_CALL(to_object, { obj });
-}
-
-
MaybeHandle<Object> Execution::ToInteger(
Isolate* isolate, Handle<Object> obj) {
RETURN_NATIVE_CALL(to_integer, { obj });
@@ -589,6 +581,16 @@ MaybeHandle<Object> Execution::NewDate(Isolate* isolate, double time) {
#undef RETURN_NATIVE_CALL
+MaybeHandle<Object> Execution::ToObject(Isolate* isolate, Handle<Object> obj) {
+ Handle<JSReceiver> receiver;
+ if (JSReceiver::ToObject(isolate, obj).ToHandle(&receiver)) {
+ return receiver;
+ }
+ THROW_NEW_ERROR(
+ isolate, NewTypeError(MessageTemplate::kUndefinedOrNullToObject), Object);
+}
+
+
MaybeHandle<JSRegExp> Execution::NewJSRegExp(Handle<String> pattern,
Handle<String> flags) {
Isolate* isolate = pattern->GetIsolate();
« no previous file with comments | « src/deoptimizer.h ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698