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 26 matching lines...) Expand all Loading... |
37 Handle<Object> trap; | 37 Handle<Object> trap; |
38 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 38 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
39 isolate, trap, | 39 isolate, trap, |
40 Object::GetMethod(Handle<JSReceiver>::cast(handler), trap_name)); | 40 Object::GetMethod(Handle<JSReceiver>::cast(handler), trap_name)); |
41 // 6. If trap is undefined, then | 41 // 6. If trap is undefined, then |
42 int const arguments_length = args.length() - 2; | 42 int const arguments_length = args.length() - 2; |
43 if (trap->IsUndefined(isolate)) { | 43 if (trap->IsUndefined(isolate)) { |
44 // 6.a. Return Call(target, thisArgument, argumentsList). | 44 // 6.a. Return Call(target, thisArgument, argumentsList). |
45 ScopedVector<Handle<Object>> argv(arguments_length); | 45 ScopedVector<Handle<Object>> argv(arguments_length); |
46 for (int i = 0; i < arguments_length; ++i) { | 46 for (int i = 0; i < arguments_length; ++i) { |
47 argv[i] = args.at<Object>(i + 1); | 47 argv[i] = args.at(i + 1); |
48 } | 48 } |
49 RETURN_RESULT_OR_FAILURE( | 49 RETURN_RESULT_OR_FAILURE( |
50 isolate, Execution::Call(isolate, target, receiver, arguments_length, | 50 isolate, Execution::Call(isolate, target, receiver, arguments_length, |
51 argv.start())); | 51 argv.start())); |
52 } | 52 } |
53 // 7. Let argArray be CreateArrayFromList(argumentsList). | 53 // 7. Let argArray be CreateArrayFromList(argumentsList). |
54 Handle<JSArray> arg_array = isolate->factory()->NewJSArray( | 54 Handle<JSArray> arg_array = isolate->factory()->NewJSArray( |
55 FAST_ELEMENTS, arguments_length, arguments_length); | 55 FAST_ELEMENTS, arguments_length, arguments_length); |
56 ElementsAccessor* accessor = arg_array->GetElementsAccessor(); | 56 ElementsAccessor* accessor = arg_array->GetElementsAccessor(); |
57 { | 57 { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 isolate, trap, | 93 isolate, trap, |
94 Object::GetMethod(Handle<JSReceiver>::cast(handler), trap_name)); | 94 Object::GetMethod(Handle<JSReceiver>::cast(handler), trap_name)); |
95 // 6. If trap is undefined, then | 95 // 6. If trap is undefined, then |
96 int const arguments_length = args.length() - 3; | 96 int const arguments_length = args.length() - 3; |
97 if (trap->IsUndefined(isolate)) { | 97 if (trap->IsUndefined(isolate)) { |
98 // 6.a. Assert: target has a [[Construct]] internal method. | 98 // 6.a. Assert: target has a [[Construct]] internal method. |
99 DCHECK(target->IsConstructor()); | 99 DCHECK(target->IsConstructor()); |
100 // 6.b. Return Construct(target, argumentsList, newTarget). | 100 // 6.b. Return Construct(target, argumentsList, newTarget). |
101 ScopedVector<Handle<Object>> argv(arguments_length); | 101 ScopedVector<Handle<Object>> argv(arguments_length); |
102 for (int i = 0; i < arguments_length; ++i) { | 102 for (int i = 0; i < arguments_length; ++i) { |
103 argv[i] = args.at<Object>(i + 1); | 103 argv[i] = args.at(i + 1); |
104 } | 104 } |
105 RETURN_RESULT_OR_FAILURE( | 105 RETURN_RESULT_OR_FAILURE( |
106 isolate, Execution::New(isolate, target, new_target, arguments_length, | 106 isolate, Execution::New(isolate, target, new_target, arguments_length, |
107 argv.start())); | 107 argv.start())); |
108 } | 108 } |
109 // 7. Let argArray be CreateArrayFromList(argumentsList). | 109 // 7. Let argArray be CreateArrayFromList(argumentsList). |
110 Handle<JSArray> arg_array = isolate->factory()->NewJSArray( | 110 Handle<JSArray> arg_array = isolate->factory()->NewJSArray( |
111 FAST_ELEMENTS, arguments_length, arguments_length); | 111 FAST_ELEMENTS, arguments_length, arguments_length); |
112 ElementsAccessor* accessor = arg_array->GetElementsAccessor(); | 112 ElementsAccessor* accessor = arg_array->GetElementsAccessor(); |
113 { | 113 { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 RUNTIME_FUNCTION(Runtime_JSProxyRevoke) { | 160 RUNTIME_FUNCTION(Runtime_JSProxyRevoke) { |
161 HandleScope scope(isolate); | 161 HandleScope scope(isolate); |
162 DCHECK(args.length() == 1); | 162 DCHECK(args.length() == 1); |
163 CONVERT_ARG_HANDLE_CHECKED(JSProxy, proxy, 0); | 163 CONVERT_ARG_HANDLE_CHECKED(JSProxy, proxy, 0); |
164 JSProxy::Revoke(proxy); | 164 JSProxy::Revoke(proxy); |
165 return isolate->heap()->undefined_value(); | 165 return isolate->heap()->undefined_value(); |
166 } | 166 } |
167 | 167 |
168 } // namespace internal | 168 } // namespace internal |
169 } // namespace v8 | 169 } // namespace v8 |
OLD | NEW |