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/elements.h" | 8 #include "src/elements.h" |
9 #include "src/factory.h" | 9 #include "src/factory.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 isolate, result, Execution::Call(isolate, target, receiver, | 51 isolate, result, Execution::Call(isolate, target, receiver, |
52 arguments_length, argv.start())); | 52 arguments_length, argv.start())); |
53 return *result; | 53 return *result; |
54 } | 54 } |
55 // 7. Let argArray be CreateArrayFromList(argumentsList). | 55 // 7. Let argArray be CreateArrayFromList(argumentsList). |
56 Handle<JSArray> arg_array = isolate->factory()->NewJSArray( | 56 Handle<JSArray> arg_array = isolate->factory()->NewJSArray( |
57 FAST_ELEMENTS, arguments_length, arguments_length); | 57 FAST_ELEMENTS, arguments_length, arguments_length); |
58 ElementsAccessor* accessor = arg_array->GetElementsAccessor(); | 58 ElementsAccessor* accessor = arg_array->GetElementsAccessor(); |
59 { | 59 { |
60 DisallowHeapAllocation no_gc; | 60 DisallowHeapAllocation no_gc; |
61 FixedArrayBase* elements = arg_array->elements(); | |
62 for (int i = 0; i < arguments_length; i++) { | 61 for (int i = 0; i < arguments_length; i++) { |
63 accessor->Set(elements, i, args[i + 1]); | 62 accessor->Set(arg_array, i, args[i + 1]); |
64 } | 63 } |
65 } | 64 } |
66 // 8. Return Call(trap, handler, «target, thisArgument, argArray»). | 65 // 8. Return Call(trap, handler, «target, thisArgument, argArray»). |
67 Handle<Object> trap_result; | 66 Handle<Object> trap_result; |
68 Handle<Object> trap_args[] = {target, receiver, arg_array}; | 67 Handle<Object> trap_args[] = {target, receiver, arg_array}; |
69 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 68 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
70 isolate, trap_result, | 69 isolate, trap_result, |
71 Execution::Call(isolate, trap, handler, arraysize(trap_args), trap_args)); | 70 Execution::Call(isolate, trap, handler, arraysize(trap_args), trap_args)); |
72 return *trap_result; | 71 return *trap_result; |
73 } | 72 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 isolate, result, Execution::New(isolate, target, new_target, | 111 isolate, result, Execution::New(isolate, target, new_target, |
113 arguments_length, argv.start())); | 112 arguments_length, argv.start())); |
114 return *result; | 113 return *result; |
115 } | 114 } |
116 // 7. Let argArray be CreateArrayFromList(argumentsList). | 115 // 7. Let argArray be CreateArrayFromList(argumentsList). |
117 Handle<JSArray> arg_array = isolate->factory()->NewJSArray( | 116 Handle<JSArray> arg_array = isolate->factory()->NewJSArray( |
118 FAST_ELEMENTS, arguments_length, arguments_length); | 117 FAST_ELEMENTS, arguments_length, arguments_length); |
119 ElementsAccessor* accessor = arg_array->GetElementsAccessor(); | 118 ElementsAccessor* accessor = arg_array->GetElementsAccessor(); |
120 { | 119 { |
121 DisallowHeapAllocation no_gc; | 120 DisallowHeapAllocation no_gc; |
122 FixedArrayBase* elements = arg_array->elements(); | |
123 for (int i = 0; i < arguments_length; i++) { | 121 for (int i = 0; i < arguments_length; i++) { |
124 accessor->Set(elements, i, args[i + 1]); | 122 accessor->Set(arg_array, i, args[i + 1]); |
125 } | 123 } |
126 } | 124 } |
127 // 8. Let newObj be ? Call(trap, handler, «target, argArray, newTarget »). | 125 // 8. Let newObj be ? Call(trap, handler, «target, argArray, newTarget »). |
128 Handle<Object> new_object; | 126 Handle<Object> new_object; |
129 Handle<Object> trap_args[] = {target, arg_array, new_target}; | 127 Handle<Object> trap_args[] = {target, arg_array, new_target}; |
130 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 128 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
131 isolate, new_object, | 129 isolate, new_object, |
132 Execution::Call(isolate, trap, handler, arraysize(trap_args), trap_args)); | 130 Execution::Call(isolate, trap, handler, arraysize(trap_args), trap_args)); |
133 // 9. If Type(newObj) is not Object, throw a TypeError exception. | 131 // 9. If Type(newObj) is not Object, throw a TypeError exception. |
134 if (!new_object->IsJSReceiver()) { | 132 if (!new_object->IsJSReceiver()) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 RUNTIME_FUNCTION(Runtime_JSProxyRevoke) { | 166 RUNTIME_FUNCTION(Runtime_JSProxyRevoke) { |
169 HandleScope scope(isolate); | 167 HandleScope scope(isolate); |
170 DCHECK(args.length() == 1); | 168 DCHECK(args.length() == 1); |
171 CONVERT_ARG_HANDLE_CHECKED(JSProxy, proxy, 0); | 169 CONVERT_ARG_HANDLE_CHECKED(JSProxy, proxy, 0); |
172 JSProxy::Revoke(proxy); | 170 JSProxy::Revoke(proxy); |
173 return isolate->heap()->undefined_value(); | 171 return isolate->heap()->undefined_value(); |
174 } | 172 } |
175 | 173 |
176 } // namespace internal | 174 } // namespace internal |
177 } // namespace v8 | 175 } // namespace v8 |
OLD | NEW |