| 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(JSProxy, instance, 0); |
| 18 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); | 18 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, target, 1); |
| 19 if (!prototype->IsJSReceiver()) prototype = isolate->factory()->null_value(); | 19 CONVERT_ARG_HANDLE_CHECKED(Object, handler, 2); |
| 20 return *isolate->factory()->NewJSProxy(handler, prototype); | 20 // TODO(cbruni): Remove once we don't support JSProxy.fix |
| 21 instance->InitializeBody(instance->map()->instance_size(), Smi::FromInt(0)); |
| 22 if (!handler->IsJSReceiver()) handler = isolate->factory()->null_value(); |
| 23 instance->set_target(*target); |
| 24 instance->set_handler(*handler); |
| 25 instance->set_hash(isolate->heap()->undefined_value(), SKIP_WRITE_BARRIER); |
| 26 return *instance; |
| 21 } | 27 } |
| 22 | 28 |
| 23 | 29 |
| 24 RUNTIME_FUNCTION(Runtime_CreateJSFunctionProxy) { | 30 RUNTIME_FUNCTION(Runtime_CreateJSFunctionProxy) { |
| 25 HandleScope scope(isolate); | 31 HandleScope scope(isolate); |
| 26 DCHECK(args.length() == 4); | 32 DCHECK(args.length() == 4); |
| 27 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, handler, 0); | 33 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, handler, 0); |
| 28 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, call_trap, 1); | 34 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, call_trap, 1); |
| 29 RUNTIME_ASSERT(call_trap->IsJSFunction() || call_trap->IsJSFunctionProxy()); | 35 RUNTIME_ASSERT(call_trap->IsJSFunction() || call_trap->IsJSFunctionProxy()); |
| 30 CONVERT_ARG_HANDLE_CHECKED(JSFunction, construct_trap, 2); | 36 CONVERT_ARG_HANDLE_CHECKED(JSFunction, construct_trap, 2); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 83 |
| 78 RUNTIME_FUNCTION(Runtime_Fix) { | 84 RUNTIME_FUNCTION(Runtime_Fix) { |
| 79 HandleScope scope(isolate); | 85 HandleScope scope(isolate); |
| 80 DCHECK(args.length() == 1); | 86 DCHECK(args.length() == 1); |
| 81 CONVERT_ARG_HANDLE_CHECKED(JSProxy, proxy, 0); | 87 CONVERT_ARG_HANDLE_CHECKED(JSProxy, proxy, 0); |
| 82 JSProxy::Fix(proxy); | 88 JSProxy::Fix(proxy); |
| 83 return isolate->heap()->undefined_value(); | 89 return isolate->heap()->undefined_value(); |
| 84 } | 90 } |
| 85 } // namespace internal | 91 } // namespace internal |
| 86 } // namespace v8 | 92 } // namespace v8 |
| OLD | NEW |