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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
676 compiler::InterpreterAssembler* assembler) { | 676 compiler::InterpreterAssembler* assembler) { |
677 Node* accumulator = __ GetAccumulator(); | 677 Node* accumulator = __ GetAccumulator(); |
678 Node* index = __ BytecodeOperandIdx8(0); | 678 Node* index = __ BytecodeOperandIdx8(0); |
679 Node* constant = __ LoadConstantPoolEntry(index); | 679 Node* constant = __ LoadConstantPoolEntry(index); |
680 Node* relative_jump = __ SmiUntag(constant); | 680 Node* relative_jump = __ SmiUntag(constant); |
681 Node* true_value = __ BooleanConstant(true); | 681 Node* true_value = __ BooleanConstant(true); |
682 __ JumpIfWordEqual(accumulator, true_value, relative_jump); | 682 __ JumpIfWordEqual(accumulator, true_value, relative_jump); |
683 } | 683 } |
684 | 684 |
685 | 685 |
686 // JumpIfToBooleanTrue <imm8> | |
rmcilroy
2015/10/13 15:43:24
nit - group all ToBoolean versions together below
mythria
2015/10/14 13:33:42
Done.
| |
687 // | |
688 // Jump by number of bytes represented by an immediate operand if the object | |
689 // referenced by the accumulator is true when the object is cast to boolean. | |
690 void Interpreter::DoJumpIfToBooleanTrue( | |
691 compiler::InterpreterAssembler* assembler) { | |
692 Node* accumulator = __ GetAccumulator(); | |
693 Node* relative_jump = __ BytecodeOperandImm8(0); | |
694 Node* toBoolean = __ CallRuntime(Runtime::kInterpreterToBoolean, accumulator); | |
rmcilroy
2015/10/13 15:43:24
/s/toBoolean/to_boolean_value (throughout)
mythria
2015/10/14 13:33:42
Done.
| |
695 Node* true_value = __ BooleanConstant(true); | |
696 __ JumpIfWordEqual(toBoolean, true_value, relative_jump); | |
697 } | |
698 | |
699 | |
700 // JumpIfToBooleanTrueConstant <idx> | |
701 // | |
702 // Jump by number of bytes in the Smi in the |idx| entry in the constant pool | |
703 // if the object referenced by the accumulator is true when the object is cast | |
704 // to boolean. | |
705 void Interpreter::DoJumpIfToBooleanTrueConstant( | |
706 compiler::InterpreterAssembler* assembler) { | |
707 Node* accumulator = __ GetAccumulator(); | |
708 Node* toBoolean = __ CallRuntime(Runtime::kInterpreterToBoolean, accumulator); | |
709 Node* index = __ BytecodeOperandIdx8(0); | |
710 Node* constant = __ LoadConstantPoolEntry(index); | |
711 Node* relative_jump = __ SmiUntag(constant); | |
712 Node* true_value = __ BooleanConstant(true); | |
713 __ JumpIfWordEqual(toBoolean, true_value, relative_jump); | |
714 } | |
715 | |
716 | |
686 // JumpIfFalse <imm8> | 717 // JumpIfFalse <imm8> |
687 // | 718 // |
688 // Jump by number of bytes represented by an immediate operand if the | 719 // Jump by number of bytes represented by an immediate operand if the |
689 // accumulator contains false. | 720 // accumulator contains false. |
690 void Interpreter::DoJumpIfFalse(compiler::InterpreterAssembler* assembler) { | 721 void Interpreter::DoJumpIfFalse(compiler::InterpreterAssembler* assembler) { |
691 Node* accumulator = __ GetAccumulator(); | 722 Node* accumulator = __ GetAccumulator(); |
692 Node* relative_jump = __ BytecodeOperandImm8(0); | 723 Node* relative_jump = __ BytecodeOperandImm8(0); |
693 Node* false_value = __ BooleanConstant(false); | 724 Node* false_value = __ BooleanConstant(false); |
694 __ JumpIfWordEqual(accumulator, false_value, relative_jump); | 725 __ JumpIfWordEqual(accumulator, false_value, relative_jump); |
695 } | 726 } |
696 | 727 |
697 | 728 |
698 // JumpIfFalseConstant <idx> | 729 // JumpIfFalseConstant <idx> |
699 // | 730 // |
700 // Jump by number of bytes in the Smi in the |idx| entry in the constant pool | 731 // Jump by number of bytes in the Smi in the |idx| entry in the constant pool |
701 // if the accumulator contains false. | 732 // if the accumulator contains false. |
702 void Interpreter::DoJumpIfFalseConstant( | 733 void Interpreter::DoJumpIfFalseConstant( |
703 compiler::InterpreterAssembler* assembler) { | 734 compiler::InterpreterAssembler* assembler) { |
704 Node* accumulator = __ GetAccumulator(); | 735 Node* accumulator = __ GetAccumulator(); |
705 Node* index = __ BytecodeOperandIdx8(0); | 736 Node* index = __ BytecodeOperandIdx8(0); |
706 Node* constant = __ LoadConstantPoolEntry(index); | 737 Node* constant = __ LoadConstantPoolEntry(index); |
707 Node* relative_jump = __ SmiUntag(constant); | 738 Node* relative_jump = __ SmiUntag(constant); |
708 Node* false_value = __ BooleanConstant(false); | 739 Node* false_value = __ BooleanConstant(false); |
709 __ JumpIfWordEqual(accumulator, false_value, relative_jump); | 740 __ JumpIfWordEqual(accumulator, false_value, relative_jump); |
710 } | 741 } |
711 | 742 |
712 | 743 |
744 // JumpIfToBooleanFalse <imm8> | |
745 // | |
746 // Jump by number of bytes represented by an immediate operand if the object | |
747 // referenced by the accumulator is false when the object is cast to boolean. | |
748 void Interpreter::DoJumpIfToBooleanFalse( | |
749 compiler::InterpreterAssembler* assembler) { | |
750 Node* accumulator = __ GetAccumulator(); | |
751 Node* relative_jump = __ BytecodeOperandImm8(0); | |
752 Node* toBoolean = __ CallRuntime(Runtime::kInterpreterToBoolean, accumulator); | |
753 Node* false_value = __ BooleanConstant(false); | |
754 __ JumpIfWordEqual(toBoolean, false_value, relative_jump); | |
755 } | |
756 | |
757 | |
758 // JumpIfToBooleanFalseConstant <idx> | |
759 // | |
760 // Jump by number of bytes in the Smi in the |idx| entry in the constant pool | |
761 // if the object referenced by the accumulator is false when the object is cast | |
762 // to boolean. | |
763 void Interpreter::DoJumpIfToBooleanFalseConstant( | |
764 compiler::InterpreterAssembler* assembler) { | |
765 Node* accumulator = __ GetAccumulator(); | |
766 Node* toBoolean = __ CallRuntime(Runtime::kInterpreterToBoolean, accumulator); | |
767 Node* index = __ BytecodeOperandIdx8(0); | |
768 Node* constant = __ LoadConstantPoolEntry(index); | |
769 Node* relative_jump = __ SmiUntag(constant); | |
770 Node* false_value = __ BooleanConstant(false); | |
771 __ JumpIfWordEqual(toBoolean, false_value, relative_jump); | |
772 } | |
773 | |
774 | |
713 // CreateClosure <tenured> | 775 // CreateClosure <tenured> |
714 // | 776 // |
715 // Creates a new closure for SharedFunctionInfo in the accumulator with the | 777 // Creates a new closure for SharedFunctionInfo in the accumulator with the |
716 // PretenureFlag <tenured>. | 778 // PretenureFlag <tenured>. |
717 void Interpreter::DoCreateClosure(compiler::InterpreterAssembler* assembler) { | 779 void Interpreter::DoCreateClosure(compiler::InterpreterAssembler* assembler) { |
718 // TODO(rmcilroy): Possibly call FastNewClosureStub when possible instead of | 780 // TODO(rmcilroy): Possibly call FastNewClosureStub when possible instead of |
719 // calling into the runtime. | 781 // calling into the runtime. |
720 Node* shared = __ GetAccumulator(); | 782 Node* shared = __ GetAccumulator(); |
721 Node* tenured_raw = __ BytecodeOperandImm8(0); | 783 Node* tenured_raw = __ BytecodeOperandImm8(0); |
722 Node* tenured = __ SmiTag(tenured_raw); | 784 Node* tenured = __ SmiTag(tenured_raw); |
723 Node* result = | 785 Node* result = |
724 __ CallRuntime(Runtime::kInterpreterNewClosure, shared, tenured); | 786 __ CallRuntime(Runtime::kInterpreterNewClosure, shared, tenured); |
725 __ SetAccumulator(result); | 787 __ SetAccumulator(result); |
726 __ Dispatch(); | 788 __ Dispatch(); |
727 } | 789 } |
728 | 790 |
729 | 791 |
730 // Return | 792 // Return |
731 // | 793 // |
732 // Return the value in the accumulator. | 794 // Return the value in the accumulator. |
733 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { | 795 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { |
734 __ Return(); | 796 __ Return(); |
735 } | 797 } |
736 | 798 |
737 | 799 |
738 } // namespace interpreter | 800 } // namespace interpreter |
739 } // namespace internal | 801 } // namespace internal |
740 } // namespace v8 | 802 } // namespace v8 |
OLD | NEW |