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() == 2); |
17 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, handler, 0); | 17 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, handler, 0); |
18 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); | 18 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); |
19 if (!prototype->IsJSReceiver()) prototype = isolate->factory()->null_value(); | 19 if (!prototype->IsJSReceiver()) prototype = isolate->factory()->null_value(); |
20 return *isolate->factory()->NewJSProxy(handler, prototype); | 20 return *isolate->factory()->NewJSProxy(handler, prototype); |
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(Object, 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); |
31 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 3); | 31 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 3); |
32 if (!prototype->IsJSReceiver()) prototype = isolate->factory()->null_value(); | 32 if (!prototype->IsJSReceiver()) prototype = isolate->factory()->null_value(); |
33 return *isolate->factory()->NewJSFunctionProxy(handler, call_trap, | 33 return *isolate->factory()->NewJSFunctionProxy(handler, call_trap, |
34 construct_trap, prototype); | 34 construct_trap, prototype); |
35 } | 35 } |
36 | 36 |
37 | 37 |
38 RUNTIME_FUNCTION(Runtime_IsJSProxy) { | 38 RUNTIME_FUNCTION(Runtime_IsJSProxy) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |