| 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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 // Right Shifts register <src> by the count specified in the accumulator. | 584 // Right Shifts register <src> by the count specified in the accumulator. |
| 585 // Result is zero-filled. The accumulator and register <src> are converted to | 585 // Result is zero-filled. The accumulator and register <src> are converted to |
| 586 // uint32 before the operation 5 lsb bits from the accumulator are used as | 586 // uint32 before the operation 5 lsb bits from the accumulator are used as |
| 587 // count i.e. <src> << (accumulator & 0x1F). | 587 // count i.e. <src> << (accumulator & 0x1F). |
| 588 void Interpreter::DoShiftRightLogical( | 588 void Interpreter::DoShiftRightLogical( |
| 589 compiler::InterpreterAssembler* assembler) { | 589 compiler::InterpreterAssembler* assembler) { |
| 590 DoBinaryOp(Runtime::kShiftRightLogical, assembler); | 590 DoBinaryOp(Runtime::kShiftRightLogical, assembler); |
| 591 } | 591 } |
| 592 | 592 |
| 593 | 593 |
| 594 void Interpreter::DoCountOp(Runtime::FunctionId function_id, |
| 595 compiler::InterpreterAssembler* assembler) { |
| 596 Node* value = __ GetAccumulator(); |
| 597 Node* one = __ NumberConstant(1); |
| 598 Node* result = __ CallRuntime(function_id, value, one); |
| 599 __ SetAccumulator(result); |
| 600 __ Dispatch(); |
| 601 } |
| 602 |
| 603 |
| 604 // Inc |
| 605 // |
| 606 // Increments value in the accumulator by one. |
| 607 void Interpreter::DoInc(compiler::InterpreterAssembler* assembler) { |
| 608 DoCountOp(Runtime::kAdd, assembler); |
| 609 } |
| 610 |
| 611 |
| 612 // Dec |
| 613 // |
| 614 // Decrements value in the accumulator by one. |
| 615 void Interpreter::DoDec(compiler::InterpreterAssembler* assembler) { |
| 616 DoCountOp(Runtime::kSubtract, assembler); |
| 617 } |
| 618 |
| 619 |
| 594 // LogicalNot | 620 // LogicalNot |
| 595 // | 621 // |
| 596 // Perform logical-not on the accumulator, first casting the | 622 // Perform logical-not on the accumulator, first casting the |
| 597 // accumulator to a boolean value if required. | 623 // accumulator to a boolean value if required. |
| 598 void Interpreter::DoLogicalNot(compiler::InterpreterAssembler* assembler) { | 624 void Interpreter::DoLogicalNot(compiler::InterpreterAssembler* assembler) { |
| 599 Node* accumulator = __ GetAccumulator(); | 625 Node* accumulator = __ GetAccumulator(); |
| 600 Node* result = __ CallRuntime(Runtime::kInterpreterLogicalNot, accumulator); | 626 Node* result = __ CallRuntime(Runtime::kInterpreterLogicalNot, accumulator); |
| 601 __ SetAccumulator(result); | 627 __ SetAccumulator(result); |
| 602 __ Dispatch(); | 628 __ Dispatch(); |
| 603 } | 629 } |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 // | 795 // |
| 770 // Cast the object referenced by the accumulator to a name. | 796 // Cast the object referenced by the accumulator to a name. |
| 771 void Interpreter::DoToName(compiler::InterpreterAssembler* assembler) { | 797 void Interpreter::DoToName(compiler::InterpreterAssembler* assembler) { |
| 772 Node* accumulator = __ GetAccumulator(); | 798 Node* accumulator = __ GetAccumulator(); |
| 773 Node* result = __ CallRuntime(Runtime::kToName, accumulator); | 799 Node* result = __ CallRuntime(Runtime::kToName, accumulator); |
| 774 __ SetAccumulator(result); | 800 __ SetAccumulator(result); |
| 775 __ Dispatch(); | 801 __ Dispatch(); |
| 776 } | 802 } |
| 777 | 803 |
| 778 | 804 |
| 805 // ToNumber |
| 806 // |
| 807 // Cast the object referenced by the accumulator to a number. |
| 808 void Interpreter::DoToNumber(compiler::InterpreterAssembler* assembler) { |
| 809 Node* accumulator = __ GetAccumulator(); |
| 810 Node* result = __ CallRuntime(Runtime::kToNumber, accumulator); |
| 811 __ SetAccumulator(result); |
| 812 __ Dispatch(); |
| 813 } |
| 814 |
| 815 |
| 779 // Jump <imm8> | 816 // Jump <imm8> |
| 780 // | 817 // |
| 781 // Jump by number of bytes represented by the immediate operand |imm8|. | 818 // Jump by number of bytes represented by the immediate operand |imm8|. |
| 782 void Interpreter::DoJump(compiler::InterpreterAssembler* assembler) { | 819 void Interpreter::DoJump(compiler::InterpreterAssembler* assembler) { |
| 783 Node* relative_jump = __ BytecodeOperandImm8(0); | 820 Node* relative_jump = __ BytecodeOperandImm8(0); |
| 784 __ Jump(relative_jump); | 821 __ Jump(relative_jump); |
| 785 } | 822 } |
| 786 | 823 |
| 787 | 824 |
| 788 // JumpConstant <idx> | 825 // JumpConstant <idx> |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 // | 1043 // |
| 1007 // Return the value in the accumulator. | 1044 // Return the value in the accumulator. |
| 1008 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { | 1045 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { |
| 1009 __ Return(); | 1046 __ Return(); |
| 1010 } | 1047 } |
| 1011 | 1048 |
| 1012 | 1049 |
| 1013 } // namespace interpreter | 1050 } // namespace interpreter |
| 1014 } // namespace internal | 1051 } // namespace internal |
| 1015 } // namespace v8 | 1052 } // namespace v8 |
| OLD | NEW |