| 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 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 // ShiftRightLogical <src> | 829 // ShiftRightLogical <src> |
| 830 // | 830 // |
| 831 // Right Shifts register <src> by the count specified in the accumulator. | 831 // Right Shifts register <src> by the count specified in the accumulator. |
| 832 // Result is zero-filled. The accumulator and register <src> are converted to | 832 // Result is zero-filled. The accumulator and register <src> are converted to |
| 833 // uint32 before the operation 5 lsb bits from the accumulator are used as | 833 // uint32 before the operation 5 lsb bits from the accumulator are used as |
| 834 // count i.e. <src> << (accumulator & 0x1F). | 834 // count i.e. <src> << (accumulator & 0x1F). |
| 835 void Interpreter::DoShiftRightLogical(InterpreterAssembler* assembler) { | 835 void Interpreter::DoShiftRightLogical(InterpreterAssembler* assembler) { |
| 836 DoBinaryOp<ShiftRightLogicalStub>(assembler); | 836 DoBinaryOp<ShiftRightLogicalStub>(assembler); |
| 837 } | 837 } |
| 838 | 838 |
| 839 void Interpreter::DoCountOp(Callable callable, | 839 template <class Generator> |
| 840 InterpreterAssembler* assembler) { | 840 void Interpreter::DoCountOp(InterpreterAssembler* assembler) { |
| 841 Node* target = __ HeapConstant(callable.code()); | |
| 842 Node* value = __ GetAccumulator(); | 841 Node* value = __ GetAccumulator(); |
| 843 Node* context = __ GetContext(); | 842 Node* context = __ GetContext(); |
| 844 Node* result = __ CallStub(callable.descriptor(), target, context, value); | 843 Node* result = Generator::Generate(assembler, value, context); |
| 845 __ SetAccumulator(result); | 844 __ SetAccumulator(result); |
| 846 __ Dispatch(); | 845 __ Dispatch(); |
| 847 } | 846 } |
| 848 | 847 |
| 849 | |
| 850 // Inc | 848 // Inc |
| 851 // | 849 // |
| 852 // Increments value in the accumulator by one. | 850 // Increments value in the accumulator by one. |
| 853 void Interpreter::DoInc(InterpreterAssembler* assembler) { | 851 void Interpreter::DoInc(InterpreterAssembler* assembler) { |
| 854 DoCountOp(CodeFactory::Inc(isolate_), assembler); | 852 DoCountOp<IncStub>(assembler); |
| 855 } | 853 } |
| 856 | 854 |
| 857 | |
| 858 // Dec | 855 // Dec |
| 859 // | 856 // |
| 860 // Decrements value in the accumulator by one. | 857 // Decrements value in the accumulator by one. |
| 861 void Interpreter::DoDec(InterpreterAssembler* assembler) { | 858 void Interpreter::DoDec(InterpreterAssembler* assembler) { |
| 862 DoCountOp(CodeFactory::Dec(isolate_), assembler); | 859 DoCountOp<DecStub>(assembler); |
| 863 } | 860 } |
| 864 | 861 |
| 865 | |
| 866 // LogicalNot | 862 // LogicalNot |
| 867 // | 863 // |
| 868 // Perform logical-not on the accumulator, first casting the | 864 // Perform logical-not on the accumulator, first casting the |
| 869 // accumulator to a boolean value if required. | 865 // accumulator to a boolean value if required. |
| 870 void Interpreter::DoLogicalNot(InterpreterAssembler* assembler) { | 866 void Interpreter::DoLogicalNot(InterpreterAssembler* assembler) { |
| 871 Callable callable = CodeFactory::ToBoolean(isolate_); | 867 Callable callable = CodeFactory::ToBoolean(isolate_); |
| 872 Node* target = __ HeapConstant(callable.code()); | 868 Node* target = __ HeapConstant(callable.code()); |
| 873 Node* accumulator = __ GetAccumulator(); | 869 Node* accumulator = __ GetAccumulator(); |
| 874 Node* context = __ GetContext(); | 870 Node* context = __ GetContext(); |
| 875 Node* to_boolean_value = | 871 Node* to_boolean_value = |
| (...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1839 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 1835 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
| 1840 __ SmiTag(new_state)); | 1836 __ SmiTag(new_state)); |
| 1841 __ SetAccumulator(old_state); | 1837 __ SetAccumulator(old_state); |
| 1842 | 1838 |
| 1843 __ Dispatch(); | 1839 __ Dispatch(); |
| 1844 } | 1840 } |
| 1845 | 1841 |
| 1846 } // namespace interpreter | 1842 } // namespace interpreter |
| 1847 } // namespace internal | 1843 } // namespace internal |
| 1848 } // namespace v8 | 1844 } // namespace v8 |
| OLD | NEW |