| 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/interpreter.h" | 5 #include "src/interpreter/interpreter.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
| 9 #include "src/compiler/interpreter-assembler.h" | 9 #include "src/compiler/interpreter-assembler.h" |
| 10 #include "src/factory.h" | 10 #include "src/factory.h" |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 compiler::InterpreterAssembler* assembler) { | 714 compiler::InterpreterAssembler* assembler) { |
| 715 Node* accumulator = __ GetAccumulator(); | 715 Node* accumulator = __ GetAccumulator(); |
| 716 Node* index = __ BytecodeOperandIdx8(0); | 716 Node* index = __ BytecodeOperandIdx8(0); |
| 717 Node* constant = __ LoadConstantPoolEntry(index); | 717 Node* constant = __ LoadConstantPoolEntry(index); |
| 718 Node* relative_jump = __ SmiUntag(constant); | 718 Node* relative_jump = __ SmiUntag(constant); |
| 719 Node* false_value = __ BooleanConstant(false); | 719 Node* false_value = __ BooleanConstant(false); |
| 720 __ JumpIfWordEqual(accumulator, false_value, relative_jump); | 720 __ JumpIfWordEqual(accumulator, false_value, relative_jump); |
| 721 } | 721 } |
| 722 | 722 |
| 723 | 723 |
| 724 void Interpreter::DoCreateLiteral(Runtime::FunctionId function_id, | |
| 725 compiler::InterpreterAssembler* assembler) { | |
| 726 Node* constant_elements = __ GetAccumulator(); | |
| 727 Node* literal_index_raw = __ BytecodeOperandIdx8(0); | |
| 728 Node* literal_index = __ SmiTag(literal_index_raw); | |
| 729 Node* flags_raw = __ BytecodeOperandImm8(1); | |
| 730 Node* flags = __ SmiTag(flags_raw); | |
| 731 Node* closure = __ LoadRegister(Register::function_closure()); | |
| 732 Node* literals_array = | |
| 733 __ LoadObjectField(closure, JSFunction::kLiteralsOffset); | |
| 734 Node* result = __ CallRuntime(function_id, literals_array, literal_index, | |
| 735 constant_elements, flags); | |
| 736 __ SetAccumulator(result); | |
| 737 __ Dispatch(); | |
| 738 } | |
| 739 | |
| 740 | |
| 741 // JumpIfToBooleanTrue <imm8> | 724 // JumpIfToBooleanTrue <imm8> |
| 742 // | 725 // |
| 743 // Jump by number of bytes represented by an immediate operand if the object | 726 // Jump by number of bytes represented by an immediate operand if the object |
| 744 // referenced by the accumulator is true when the object is cast to boolean. | 727 // referenced by the accumulator is true when the object is cast to boolean. |
| 745 void Interpreter::DoJumpIfToBooleanTrue( | 728 void Interpreter::DoJumpIfToBooleanTrue( |
| 746 compiler::InterpreterAssembler* assembler) { | 729 compiler::InterpreterAssembler* assembler) { |
| 747 Node* accumulator = __ GetAccumulator(); | 730 Node* accumulator = __ GetAccumulator(); |
| 748 Node* relative_jump = __ BytecodeOperandImm8(0); | 731 Node* relative_jump = __ BytecodeOperandImm8(0); |
| 749 Node* to_boolean_value = | 732 Node* to_boolean_value = |
| 750 __ CallRuntime(Runtime::kInterpreterToBoolean, accumulator); | 733 __ CallRuntime(Runtime::kInterpreterToBoolean, accumulator); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 Node* to_boolean_value = | 780 Node* to_boolean_value = |
| 798 __ CallRuntime(Runtime::kInterpreterToBoolean, accumulator); | 781 __ CallRuntime(Runtime::kInterpreterToBoolean, accumulator); |
| 799 Node* index = __ BytecodeOperandIdx8(0); | 782 Node* index = __ BytecodeOperandIdx8(0); |
| 800 Node* constant = __ LoadConstantPoolEntry(index); | 783 Node* constant = __ LoadConstantPoolEntry(index); |
| 801 Node* relative_jump = __ SmiUntag(constant); | 784 Node* relative_jump = __ SmiUntag(constant); |
| 802 Node* false_value = __ BooleanConstant(false); | 785 Node* false_value = __ BooleanConstant(false); |
| 803 __ JumpIfWordEqual(to_boolean_value, false_value, relative_jump); | 786 __ JumpIfWordEqual(to_boolean_value, false_value, relative_jump); |
| 804 } | 787 } |
| 805 | 788 |
| 806 | 789 |
| 790 // CreateRegExpLiteral <idx> <flags_reg> |
| 791 // |
| 792 // Creates a regular expression literal for literal index <idx> with flags held |
| 793 // in <flags_reg> and the pattern in the accumulator. |
| 794 void Interpreter::DoCreateRegExpLiteral( |
| 795 compiler::InterpreterAssembler* assembler) { |
| 796 Node* pattern = __ GetAccumulator(); |
| 797 Node* literal_index_raw = __ BytecodeOperandIdx8(0); |
| 798 Node* literal_index = __ SmiTag(literal_index_raw); |
| 799 Node* flags_reg = __ BytecodeOperandReg8(1); |
| 800 Node* flags = __ LoadRegister(flags_reg); |
| 801 Node* closure = __ LoadRegister(Register::function_closure()); |
| 802 Node* literals_array = |
| 803 __ LoadObjectField(closure, JSFunction::kLiteralsOffset); |
| 804 Node* result = __ CallRuntime(Runtime::kMaterializeRegExpLiteral, |
| 805 literals_array, literal_index, pattern, flags); |
| 806 __ SetAccumulator(result); |
| 807 __ Dispatch(); |
| 808 } |
| 809 |
| 810 |
| 811 void Interpreter::DoCreateLiteral(Runtime::FunctionId function_id, |
| 812 compiler::InterpreterAssembler* assembler) { |
| 813 Node* constant_elements = __ GetAccumulator(); |
| 814 Node* literal_index_raw = __ BytecodeOperandIdx8(0); |
| 815 Node* literal_index = __ SmiTag(literal_index_raw); |
| 816 Node* flags_raw = __ BytecodeOperandImm8(1); |
| 817 Node* flags = __ SmiTag(flags_raw); |
| 818 Node* closure = __ LoadRegister(Register::function_closure()); |
| 819 Node* literals_array = |
| 820 __ LoadObjectField(closure, JSFunction::kLiteralsOffset); |
| 821 Node* result = __ CallRuntime(function_id, literals_array, literal_index, |
| 822 constant_elements, flags); |
| 823 __ SetAccumulator(result); |
| 824 __ Dispatch(); |
| 825 } |
| 826 |
| 827 |
| 807 // CreateArrayLiteral <idx> <flags> | 828 // CreateArrayLiteral <idx> <flags> |
| 808 // | 829 // |
| 809 // Creates an array literal for literal index <idx> with flags <flags> and | 830 // Creates an array literal for literal index <idx> with flags <flags> and |
| 810 // constant elements in the accumulator. | 831 // constant elements in the accumulator. |
| 811 void Interpreter::DoCreateArrayLiteral( | 832 void Interpreter::DoCreateArrayLiteral( |
| 812 compiler::InterpreterAssembler* assembler) { | 833 compiler::InterpreterAssembler* assembler) { |
| 813 DoCreateLiteral(Runtime::kCreateArrayLiteral, assembler); | 834 DoCreateLiteral(Runtime::kCreateArrayLiteral, assembler); |
| 814 } | 835 } |
| 815 | 836 |
| 816 | 837 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 845 // | 866 // |
| 846 // Return the value in the accumulator. | 867 // Return the value in the accumulator. |
| 847 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { | 868 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { |
| 848 __ Return(); | 869 __ Return(); |
| 849 } | 870 } |
| 850 | 871 |
| 851 | 872 |
| 852 } // namespace interpreter | 873 } // namespace interpreter |
| 853 } // namespace internal | 874 } // namespace internal |
| 854 } // namespace v8 | 875 } // namespace v8 |
| OLD | NEW |