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/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/conversions-inl.h" | 9 #include "src/conversions-inl.h" |
10 #include "src/elements.h" | 10 #include "src/elements.h" |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 Handle<JSFunction> spread_iterable_function = isolate->spread_iterable(); | 641 Handle<JSFunction> spread_iterable_function = isolate->spread_iterable(); |
642 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 642 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
643 isolate, spread, | 643 isolate, spread, |
644 Execution::Call(isolate, spread_iterable_function, | 644 Execution::Call(isolate, spread_iterable_function, |
645 isolate->factory()->undefined_value(), 1, &spread)); | 645 isolate->factory()->undefined_value(), 1, &spread)); |
646 } | 646 } |
647 | 647 |
648 return *spread; | 648 return *spread; |
649 } | 649 } |
650 | 650 |
| 651 RUNTIME_FUNCTION(Runtime_SpreadIterablePrepareFixed) { |
| 652 HandleScope scope(isolate); |
| 653 DCHECK_EQ(1, args.length()); |
| 654 CONVERT_ARG_HANDLE_CHECKED(Object, spread, 0); |
| 655 |
| 656 // Iterate over the spread if we need to. |
| 657 if (spread->IterationHasObservableEffects()) { |
| 658 Handle<JSFunction> spread_iterable_function = isolate->spread_iterable(); |
| 659 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 660 isolate, spread, |
| 661 Execution::Call(isolate, spread_iterable_function, |
| 662 isolate->factory()->undefined_value(), 1, &spread)); |
| 663 } |
| 664 // Return the backing store fixed array. |
| 665 Handle<JSArray> spread_array = Handle<JSArray>::cast(spread); |
| 666 uint32_t spread_length; |
| 667 CHECK(spread_array->length()->ToArrayIndex(&spread_length)); |
| 668 |
| 669 FixedArrayBase* a = spread_array->elements(); |
| 670 a->set_length(spread_length); |
| 671 return a; |
| 672 } |
| 673 |
651 } // namespace internal | 674 } // namespace internal |
652 } // namespace v8 | 675 } // namespace v8 |
OLD | NEW |