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 <fstream> | 7 #include <fstream> |
8 | 8 |
9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 // ShiftRightLogical <src> | 807 // ShiftRightLogical <src> |
808 // | 808 // |
809 // Right Shifts register <src> by the count specified in the accumulator. | 809 // Right Shifts register <src> by the count specified in the accumulator. |
810 // Result is zero-filled. The accumulator and register <src> are converted to | 810 // Result is zero-filled. The accumulator and register <src> are converted to |
811 // uint32 before the operation 5 lsb bits from the accumulator are used as | 811 // uint32 before the operation 5 lsb bits from the accumulator are used as |
812 // count i.e. <src> << (accumulator & 0x1F). | 812 // count i.e. <src> << (accumulator & 0x1F). |
813 void Interpreter::DoShiftRightLogical(InterpreterAssembler* assembler) { | 813 void Interpreter::DoShiftRightLogical(InterpreterAssembler* assembler) { |
814 DoBinaryOp<ShiftRightLogicalStub>(assembler); | 814 DoBinaryOp<ShiftRightLogicalStub>(assembler); |
815 } | 815 } |
816 | 816 |
817 void Interpreter::DoCountOp(Runtime::FunctionId function_id, | 817 void Interpreter::DoCountOp(Callable callable, |
818 InterpreterAssembler* assembler) { | 818 InterpreterAssembler* assembler) { |
| 819 Node* target = __ HeapConstant(callable.code()); |
819 Node* value = __ GetAccumulator(); | 820 Node* value = __ GetAccumulator(); |
820 Node* one = __ NumberConstant(1); | |
821 Node* context = __ GetContext(); | 821 Node* context = __ GetContext(); |
822 Node* result = __ CallRuntime(function_id, context, value, one); | 822 Node* result = __ CallStub(callable.descriptor(), target, context, value); |
823 __ SetAccumulator(result); | 823 __ SetAccumulator(result); |
824 __ Dispatch(); | 824 __ Dispatch(); |
825 } | 825 } |
826 | 826 |
827 | 827 |
828 // Inc | 828 // Inc |
829 // | 829 // |
830 // Increments value in the accumulator by one. | 830 // Increments value in the accumulator by one. |
831 void Interpreter::DoInc(InterpreterAssembler* assembler) { | 831 void Interpreter::DoInc(InterpreterAssembler* assembler) { |
832 DoCountOp(Runtime::kAdd, assembler); | 832 DoCountOp(CodeFactory::Inc(isolate_), assembler); |
833 } | 833 } |
834 | 834 |
835 | 835 |
836 // Dec | 836 // Dec |
837 // | 837 // |
838 // Decrements value in the accumulator by one. | 838 // Decrements value in the accumulator by one. |
839 void Interpreter::DoDec(InterpreterAssembler* assembler) { | 839 void Interpreter::DoDec(InterpreterAssembler* assembler) { |
840 DoCountOp(Runtime::kSubtract, assembler); | 840 DoCountOp(CodeFactory::Dec(isolate_), assembler); |
841 } | 841 } |
842 | 842 |
843 | 843 |
844 // LogicalNot | 844 // LogicalNot |
845 // | 845 // |
846 // Perform logical-not on the accumulator, first casting the | 846 // Perform logical-not on the accumulator, first casting the |
847 // accumulator to a boolean value if required. | 847 // accumulator to a boolean value if required. |
848 void Interpreter::DoLogicalNot(InterpreterAssembler* assembler) { | 848 void Interpreter::DoLogicalNot(InterpreterAssembler* assembler) { |
849 Callable callable = CodeFactory::ToBoolean(isolate_); | 849 Callable callable = CodeFactory::ToBoolean(isolate_); |
850 Node* target = __ HeapConstant(callable.code()); | 850 Node* target = __ HeapConstant(callable.code()); |
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 1734 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
1735 __ SmiTag(new_state)); | 1735 __ SmiTag(new_state)); |
1736 __ SetAccumulator(old_state); | 1736 __ SetAccumulator(old_state); |
1737 | 1737 |
1738 __ Dispatch(); | 1738 __ Dispatch(); |
1739 } | 1739 } |
1740 | 1740 |
1741 } // namespace interpreter | 1741 } // namespace interpreter |
1742 } // namespace internal | 1742 } // namespace internal |
1743 } // namespace v8 | 1743 } // namespace v8 |
OLD | NEW |