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(Object, target, 0); | 17 CONVERT_ARG_HANDLE_CHECKED(Object, target, 0); |
18 CONVERT_ARG_HANDLE_CHECKED(Object, handler, 1); | 18 CONVERT_ARG_HANDLE_CHECKED(Object, handler, 1); |
19 if (!target->IsSpecObject()) { | 19 if (!target->IsJSReceiver()) { |
20 THROW_NEW_ERROR_RETURN_FAILURE( | 20 THROW_NEW_ERROR_RETURN_FAILURE( |
21 isolate, NewTypeError(MessageTemplate::kProxyTargetNonObject)); | 21 isolate, NewTypeError(MessageTemplate::kProxyTargetNonObject)); |
22 } | 22 } |
23 if (!handler->IsSpecObject()) { | 23 if (!handler->IsJSReceiver()) { |
24 THROW_NEW_ERROR_RETURN_FAILURE( | 24 THROW_NEW_ERROR_RETURN_FAILURE( |
25 isolate, NewTypeError(MessageTemplate::kProxyHandlerNonObject)); | 25 isolate, NewTypeError(MessageTemplate::kProxyHandlerNonObject)); |
26 } | 26 } |
27 if ((target->IsJSProxy() && JSProxy::cast(*target)->IsRevoked()) || | 27 if ((target->IsJSProxy() && JSProxy::cast(*target)->IsRevoked()) || |
28 (handler->IsJSProxy() && JSProxy::cast(*handler)->IsRevoked())) { | 28 (handler->IsJSProxy() && JSProxy::cast(*handler)->IsRevoked())) { |
29 THROW_NEW_ERROR_RETURN_FAILURE( | 29 THROW_NEW_ERROR_RETURN_FAILURE( |
30 isolate, NewTypeError(MessageTemplate::kProxyHandlerOrTargetRevoked)); | 30 isolate, NewTypeError(MessageTemplate::kProxyHandlerOrTargetRevoked)); |
31 } | 31 } |
32 return *isolate->factory()->NewJSProxy(Handle<JSReceiver>::cast(target), | 32 return *isolate->factory()->NewJSProxy(Handle<JSReceiver>::cast(target), |
33 Handle<JSReceiver>::cast(handler)); | 33 Handle<JSReceiver>::cast(handler)); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 RUNTIME_FUNCTION(Runtime_GetConstructTrap) { | 84 RUNTIME_FUNCTION(Runtime_GetConstructTrap) { |
85 SealHandleScope shs(isolate); | 85 SealHandleScope shs(isolate); |
86 DCHECK(args.length() == 1); | 86 DCHECK(args.length() == 1); |
87 CONVERT_ARG_CHECKED(JSFunctionProxy, proxy, 0); | 87 CONVERT_ARG_CHECKED(JSFunctionProxy, proxy, 0); |
88 return proxy->construct_trap(); | 88 return proxy->construct_trap(); |
89 } | 89 } |
90 | 90 |
91 } // namespace internal | 91 } // namespace internal |
92 } // namespace v8 | 92 } // namespace v8 |
OLD | NEW |