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

Side by Side 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: adding proxy trap strings 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/factory.h" 8 #include "src/factory.h"
9 #include "src/objects-inl.h" 9 #include "src/objects-inl.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 13
14 RUNTIME_FUNCTION(Runtime_CreateJSProxy) { 14 RUNTIME_FUNCTION(Runtime_CreateJSProxy) {
15 HandleScope scope(isolate); 15 HandleScope scope(isolate);
16 DCHECK(args.length() == 2); 16 DCHECK(args.length() == 2);
17 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, handler, 0); 17 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, target, 0);
18 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); 18 CONVERT_ARG_HANDLE_CHECKED(Object, handler, 1);
19 if (!prototype->IsJSReceiver()) prototype = isolate->factory()->null_value(); 19 if (!handler->IsJSReceiver()) handler = isolate->factory()->null_value();
20 return *isolate->factory()->NewJSProxy(handler, prototype); 20 return *isolate->factory()->NewJSProxy(target, handler);
21 } 21 }
22 22
23 23
24 RUNTIME_FUNCTION(Runtime_CreateJSFunctionProxy) { 24 RUNTIME_FUNCTION(Runtime_CreateJSFunctionProxy) {
25 HandleScope scope(isolate); 25 HandleScope scope(isolate);
26 DCHECK(args.length() == 4); 26 DCHECK(args.length() == 4);
27 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, handler, 0); 27 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, handler, 0);
28 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, call_trap, 1); 28 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, call_trap, 1);
29 RUNTIME_ASSERT(call_trap->IsJSFunction() || call_trap->IsJSFunctionProxy()); 29 RUNTIME_ASSERT(call_trap->IsJSFunction() || call_trap->IsJSFunctionProxy());
30 CONVERT_ARG_HANDLE_CHECKED(JSFunction, construct_trap, 2); 30 CONVERT_ARG_HANDLE_CHECKED(JSFunction, construct_trap, 2);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 RUNTIME_FUNCTION(Runtime_Fix) { 78 RUNTIME_FUNCTION(Runtime_Fix) {
79 HandleScope scope(isolate); 79 HandleScope scope(isolate);
80 DCHECK(args.length() == 1); 80 DCHECK(args.length() == 1);
81 CONVERT_ARG_HANDLE_CHECKED(JSProxy, proxy, 0); 81 CONVERT_ARG_HANDLE_CHECKED(JSProxy, proxy, 0);
82 JSProxy::Fix(proxy); 82 JSProxy::Fix(proxy);
83 return isolate->heap()->undefined_value(); 83 return isolate->heap()->undefined_value();
84 } 84 }
85 } // namespace internal 85 } // namespace internal
86 } // namespace v8 86 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698