OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/interpreter/bytecode-array-builder.h" | 5 #include "src/interpreter/bytecode-array-builder.h" |
6 | 6 |
7 #include "src/globals.h" | 7 #include "src/globals.h" |
8 #include "src/interpreter/bytecode-array-writer.h" | 8 #include "src/interpreter/bytecode-array-writer.h" |
9 #include "src/interpreter/bytecode-dead-code-optimizer.h" | 9 #include "src/interpreter/bytecode-dead-code-optimizer.h" |
10 #include "src/interpreter/bytecode-label.h" | 10 #include "src/interpreter/bytecode-label.h" |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 return_seen_in_block_ = true; | 645 return_seen_in_block_ = true; |
646 return *this; | 646 return *this; |
647 } | 647 } |
648 | 648 |
649 BytecodeArrayBuilder& BytecodeArrayBuilder::Debugger() { | 649 BytecodeArrayBuilder& BytecodeArrayBuilder::Debugger() { |
650 Output(Bytecode::kDebugger); | 650 Output(Bytecode::kDebugger); |
651 return *this; | 651 return *this; |
652 } | 652 } |
653 | 653 |
654 BytecodeArrayBuilder& BytecodeArrayBuilder::ForInPrepare( | 654 BytecodeArrayBuilder& BytecodeArrayBuilder::ForInPrepare( |
655 Register receiver, Register cache_info_triple) { | 655 Register receiver, RegisterList cache_info_triple) { |
| 656 DCHECK_EQ(3, cache_info_triple.register_count()); |
656 Output(Bytecode::kForInPrepare, RegisterOperand(receiver), | 657 Output(Bytecode::kForInPrepare, RegisterOperand(receiver), |
657 RegisterOperand(cache_info_triple)); | 658 RegisterOperand(cache_info_triple.first_register())); |
658 return *this; | 659 return *this; |
659 } | 660 } |
660 | 661 |
661 BytecodeArrayBuilder& BytecodeArrayBuilder::ForInContinue( | 662 BytecodeArrayBuilder& BytecodeArrayBuilder::ForInContinue( |
662 Register index, Register cache_length) { | 663 Register index, Register cache_length) { |
663 Output(Bytecode::kForInContinue, RegisterOperand(index), | 664 Output(Bytecode::kForInContinue, RegisterOperand(index), |
664 RegisterOperand(cache_length)); | 665 RegisterOperand(cache_length)); |
665 return *this; | 666 return *this; |
666 } | 667 } |
667 | 668 |
668 BytecodeArrayBuilder& BytecodeArrayBuilder::ForInNext( | 669 BytecodeArrayBuilder& BytecodeArrayBuilder::ForInNext( |
669 Register receiver, Register index, Register cache_type_array_pair, | 670 Register receiver, Register index, RegisterList cache_type_array_pair, |
670 int feedback_slot) { | 671 int feedback_slot) { |
| 672 DCHECK_EQ(2, cache_type_array_pair.register_count()); |
671 Output(Bytecode::kForInNext, RegisterOperand(receiver), | 673 Output(Bytecode::kForInNext, RegisterOperand(receiver), |
672 RegisterOperand(index), RegisterOperand(cache_type_array_pair), | 674 RegisterOperand(index), |
| 675 RegisterOperand(cache_type_array_pair.first_register()), |
673 UnsignedOperand(feedback_slot)); | 676 UnsignedOperand(feedback_slot)); |
674 return *this; | 677 return *this; |
675 } | 678 } |
676 | 679 |
677 BytecodeArrayBuilder& BytecodeArrayBuilder::ForInStep(Register index) { | 680 BytecodeArrayBuilder& BytecodeArrayBuilder::ForInStep(Register index) { |
678 Output(Bytecode::kForInStep, RegisterOperand(index)); | 681 Output(Bytecode::kForInStep, RegisterOperand(index)); |
679 return *this; | 682 return *this; |
680 } | 683 } |
681 | 684 |
682 BytecodeArrayBuilder& BytecodeArrayBuilder::SuspendGenerator( | 685 BytecodeArrayBuilder& BytecodeArrayBuilder::SuspendGenerator( |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 Runtime::FunctionId function_id, Register arg) { | 770 Runtime::FunctionId function_id, Register arg) { |
768 return CallRuntime(function_id, RegisterList(arg.index(), 1)); | 771 return CallRuntime(function_id, RegisterList(arg.index(), 1)); |
769 } | 772 } |
770 | 773 |
771 BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntime( | 774 BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntime( |
772 Runtime::FunctionId function_id) { | 775 Runtime::FunctionId function_id) { |
773 return CallRuntime(function_id, RegisterList()); | 776 return CallRuntime(function_id, RegisterList()); |
774 } | 777 } |
775 | 778 |
776 BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntimeForPair( | 779 BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntimeForPair( |
777 Runtime::FunctionId function_id, RegisterList args, Register first_return) { | 780 Runtime::FunctionId function_id, RegisterList args, |
| 781 RegisterList return_pair) { |
778 DCHECK_EQ(2, Runtime::FunctionForId(function_id)->result_size); | 782 DCHECK_EQ(2, Runtime::FunctionForId(function_id)->result_size); |
779 DCHECK(Bytecodes::SizeForUnsignedOperand(function_id) <= OperandSize::kShort); | 783 DCHECK(Bytecodes::SizeForUnsignedOperand(function_id) <= OperandSize::kShort); |
| 784 DCHECK_EQ(2, return_pair.register_count()); |
780 Output(Bytecode::kCallRuntimeForPair, static_cast<uint16_t>(function_id), | 785 Output(Bytecode::kCallRuntimeForPair, static_cast<uint16_t>(function_id), |
781 RegisterOperand(args.first_register()), | 786 RegisterOperand(args.first_register()), |
782 UnsignedOperand(args.register_count()), RegisterOperand(first_return)); | 787 UnsignedOperand(args.register_count()), |
| 788 RegisterOperand(return_pair.first_register())); |
783 return *this; | 789 return *this; |
784 } | 790 } |
785 | 791 |
786 BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntimeForPair( | 792 BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntimeForPair( |
787 Runtime::FunctionId function_id, Register arg, Register first_return) { | 793 Runtime::FunctionId function_id, Register arg, RegisterList return_pair) { |
788 return CallRuntimeForPair(function_id, RegisterList(arg.index(), 1), | 794 return CallRuntimeForPair(function_id, RegisterList(arg.index(), 1), |
789 first_return); | 795 return_pair); |
790 } | 796 } |
791 | 797 |
792 BytecodeArrayBuilder& BytecodeArrayBuilder::CallJSRuntime(int context_index, | 798 BytecodeArrayBuilder& BytecodeArrayBuilder::CallJSRuntime(int context_index, |
793 RegisterList args) { | 799 RegisterList args) { |
794 Output(Bytecode::kCallJSRuntime, UnsignedOperand(context_index), | 800 Output(Bytecode::kCallJSRuntime, UnsignedOperand(context_index), |
795 RegisterOperand(args.first_register()), | 801 RegisterOperand(args.first_register()), |
796 UnsignedOperand(args.register_count())); | 802 UnsignedOperand(args.register_count())); |
797 return *this; | 803 return *this; |
798 } | 804 } |
799 | 805 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 UNREACHABLE(); // Dealt with in kRegList above. | 930 UNREACHABLE(); // Dealt with in kRegList above. |
925 } | 931 } |
926 } | 932 } |
927 | 933 |
928 return true; | 934 return true; |
929 } | 935 } |
930 | 936 |
931 } // namespace interpreter | 937 } // namespace interpreter |
932 } // namespace internal | 938 } // namespace internal |
933 } // namespace v8 | 939 } // namespace v8 |
OLD | NEW |