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 <stdlib.h> | 7 #include <stdlib.h> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 // Prepare the array containing all passed arguments. | 544 // Prepare the array containing all passed arguments. |
545 int argument_count = frame->GetArgumentsLength(); | 545 int argument_count = frame->GetArgumentsLength(); |
546 Handle<FixedArray> elements = | 546 Handle<FixedArray> elements = |
547 isolate->factory()->NewUninitializedFixedArray(argument_count); | 547 isolate->factory()->NewUninitializedFixedArray(argument_count); |
548 for (int i = 0; i < argument_count; ++i) { | 548 for (int i = 0; i < argument_count; ++i) { |
549 elements->set(i, frame->GetParameter(i)); | 549 elements->set(i, frame->GetParameter(i)); |
550 } | 550 } |
551 Handle<JSArray> arguments = isolate->factory()->NewJSArrayWithElements( | 551 Handle<JSArray> arguments = isolate->factory()->NewJSArrayWithElements( |
552 elements, FAST_ELEMENTS, argument_count); | 552 elements, FAST_ELEMENTS, argument_count); |
553 | 553 |
554 // Call $reflectConstruct(<super>, <args>, <new.target>) now. | 554 // Call %reflect_construct(<super>, <args>, <new.target>) now. |
555 Handle<Object> reflect; | 555 Handle<JSFunction> reflect = isolate->reflect_construct(); |
556 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | |
557 isolate, reflect, | |
558 Object::GetProperty(isolate, | |
559 handle(isolate->native_context()->builtins()), | |
560 "$reflectConstruct")); | |
561 RUNTIME_ASSERT(reflect->IsJSFunction()); // Depends on --harmony-reflect. | |
562 Handle<Object> argv[] = {super_constructor, arguments, original_constructor}; | 556 Handle<Object> argv[] = {super_constructor, arguments, original_constructor}; |
563 Handle<Object> result; | 557 Handle<Object> result; |
564 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 558 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
565 isolate, result, | 559 isolate, result, |
566 Execution::Call(isolate, reflect, isolate->factory()->undefined_value(), | 560 Execution::Call(isolate, reflect, isolate->factory()->undefined_value(), |
567 arraysize(argv), argv)); | 561 arraysize(argv), argv)); |
568 | 562 |
569 return *result; | 563 return *result; |
570 } | 564 } |
571 } // namespace internal | 565 } // namespace internal |
572 } // namespace v8 | 566 } // namespace v8 |
OLD | NEW |