| OLD | NEW |
| 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() == 3); |
| 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(JSReceiver, handler, 1); |
| 19 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 2); |
| 19 if (!prototype->IsJSReceiver()) prototype = isolate->factory()->null_value(); | 20 if (!prototype->IsJSReceiver()) prototype = isolate->factory()->null_value(); |
| 20 return *isolate->factory()->NewJSProxy(handler, prototype); | 21 return *isolate->factory()->NewJSProxy(target, handler, prototype); |
| 21 } | 22 } |
| 22 | 23 |
| 23 | 24 |
| 24 RUNTIME_FUNCTION(Runtime_CreateJSFunctionProxy) { | 25 RUNTIME_FUNCTION(Runtime_CreateJSFunctionProxy) { |
| 25 HandleScope scope(isolate); | 26 HandleScope scope(isolate); |
| 26 DCHECK(args.length() == 4); | 27 DCHECK(args.length() == 5); |
| 27 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, handler, 0); | 28 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, target, 0); |
| 28 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, call_trap, 1); | 29 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, handler, 1); |
| 30 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, call_trap, 2); |
| 29 RUNTIME_ASSERT(call_trap->IsJSFunction() || call_trap->IsJSFunctionProxy()); | 31 RUNTIME_ASSERT(call_trap->IsJSFunction() || call_trap->IsJSFunctionProxy()); |
| 30 CONVERT_ARG_HANDLE_CHECKED(JSFunction, construct_trap, 2); | 32 CONVERT_ARG_HANDLE_CHECKED(JSFunction, construct_trap, 3); |
| 31 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 3); | 33 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 4); |
| 32 if (!prototype->IsJSReceiver()) prototype = isolate->factory()->null_value(); | 34 if (!prototype->IsJSReceiver()) prototype = isolate->factory()->null_value(); |
| 33 return *isolate->factory()->NewJSFunctionProxy(handler, call_trap, | 35 return *isolate->factory()->NewJSFunctionProxy(target, handler, call_trap, |
| 34 construct_trap, prototype); | 36 construct_trap, prototype); |
| 35 } | 37 } |
| 36 | 38 |
| 37 | 39 |
| 38 RUNTIME_FUNCTION(Runtime_IsJSProxy) { | 40 RUNTIME_FUNCTION(Runtime_IsJSProxy) { |
| 39 SealHandleScope shs(isolate); | 41 SealHandleScope shs(isolate); |
| 40 DCHECK(args.length() == 1); | 42 DCHECK(args.length() == 1); |
| 41 CONVERT_ARG_CHECKED(Object, obj, 0); | 43 CONVERT_ARG_CHECKED(Object, obj, 0); |
| 42 return isolate->heap()->ToBoolean(obj->IsJSProxy()); | 44 return isolate->heap()->ToBoolean(obj->IsJSProxy()); |
| 43 } | 45 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 67 } | 69 } |
| 68 | 70 |
| 69 | 71 |
| 70 RUNTIME_FUNCTION(Runtime_GetConstructTrap) { | 72 RUNTIME_FUNCTION(Runtime_GetConstructTrap) { |
| 71 SealHandleScope shs(isolate); | 73 SealHandleScope shs(isolate); |
| 72 DCHECK(args.length() == 1); | 74 DCHECK(args.length() == 1); |
| 73 CONVERT_ARG_CHECKED(JSFunctionProxy, proxy, 0); | 75 CONVERT_ARG_CHECKED(JSFunctionProxy, proxy, 0); |
| 74 return proxy->construct_trap(); | 76 return proxy->construct_trap(); |
| 75 } | 77 } |
| 76 | 78 |
| 77 | |
| 78 RUNTIME_FUNCTION(Runtime_Fix) { | |
| 79 HandleScope scope(isolate); | |
| 80 DCHECK(args.length() == 1); | |
| 81 CONVERT_ARG_HANDLE_CHECKED(JSProxy, proxy, 0); | |
| 82 JSProxy::Fix(proxy); | |
| 83 return isolate->heap()->undefined_value(); | |
| 84 } | |
| 85 } // namespace internal | 79 } // namespace internal |
| 86 } // namespace v8 | 80 } // namespace v8 |
| OLD | NEW |