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

Unified Diff: src/runtime/runtime-proxy.cc

Issue 1417063011: [runtime] support new Proxy() instead of Proxy.create and install getPrototypeOf trap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: removing unreachable code Created 5 years, 1 month 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/runtime/runtime-object.cc ('k') | test/mjsunit/es6/iteration-semantics.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-proxy.cc
diff --git a/src/runtime/runtime-proxy.cc b/src/runtime/runtime-proxy.cc
index b4f7f61e0b625cbc7329a1e0ff266e1001d7accc..5a12f1050aff985065973386035f552dc1dee377 100644
--- a/src/runtime/runtime-proxy.cc
+++ b/src/runtime/runtime-proxy.cc
@@ -14,11 +14,31 @@ namespace internal {
RUNTIME_FUNCTION(Runtime_CreateJSProxy) {
HandleScope scope(isolate);
DCHECK(args.length() == 3);
- CONVERT_ARG_HANDLE_CHECKED(JSReceiver, target, 0);
- CONVERT_ARG_HANDLE_CHECKED(JSReceiver, handler, 1);
- CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 2);
- if (!prototype->IsJSReceiver()) prototype = isolate->factory()->null_value();
- return *isolate->factory()->NewJSProxy(target, handler, prototype);
+ CONVERT_ARG_HANDLE_CHECKED(JSProxy, instance, 0);
+ CONVERT_ARG_HANDLE_CHECKED(JSReceiver, target, 1);
+ CONVERT_ARG_HANDLE_CHECKED(Object, handler, 2);
+ if (!target->IsSpecObject()) {
+ THROW_NEW_ERROR_RETURN_FAILURE(
+ isolate, NewTypeError(MessageTemplate::kProxyTargetNonObject));
+ }
+ if (target->IsJSProxy() && !JSProxy::cast(*target)->has_handler()) {
+ // TODO(cbruni): Use better error message.
+ THROW_NEW_ERROR_RETURN_FAILURE(
+ isolate, NewTypeError(MessageTemplate::kProxyTargetNonObject));
+ }
+ if (!handler->IsSpecObject()) {
+ THROW_NEW_ERROR_RETURN_FAILURE(
+ isolate, NewTypeError(MessageTemplate::kProxyHandlerNonObject));
+ }
+ if (handler->IsJSProxy() && !JSProxy::cast(*handler)->has_handler()) {
+ // TODO(cbruni): Use better error message.
+ THROW_NEW_ERROR_RETURN_FAILURE(
+ isolate, NewTypeError(MessageTemplate::kProxyHandlerNonObject));
+ }
+ instance->set_target(*target);
+ instance->set_handler(*handler);
+ instance->set_hash(isolate->heap()->undefined_value(), SKIP_WRITE_BARRIER);
+ return *instance;
}
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | test/mjsunit/es6/iteration-semantics.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698