| 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/ast/prettyprinter.h" | 7 #include "src/ast/prettyprinter.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/factory.h" | 10 #include "src/factory.h" |
| 11 #include "src/interpreter/bytecode-generator.h" | 11 #include "src/interpreter/bytecode-generator.h" |
| 12 #include "src/interpreter/bytecodes.h" | 12 #include "src/interpreter/bytecodes.h" |
| 13 #include "src/interpreter/interpreter-assembler.h" | 13 #include "src/interpreter/interpreter-assembler.h" |
| 14 #include "src/interpreter/interpreter-intrinsics.h" |
| 14 #include "src/log.h" | 15 #include "src/log.h" |
| 15 #include "src/zone.h" | 16 #include "src/zone.h" |
| 16 | 17 |
| 17 namespace v8 { | 18 namespace v8 { |
| 18 namespace internal { | 19 namespace internal { |
| 19 namespace interpreter { | 20 namespace interpreter { |
| 20 | 21 |
| 21 using compiler::Node; | 22 using compiler::Node; |
| 22 | 23 |
| 23 #define __ assembler-> | 24 #define __ assembler-> |
| (...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 | 888 |
| 888 // CallRuntime <function_id> <first_arg> <arg_count> | 889 // CallRuntime <function_id> <first_arg> <arg_count> |
| 889 // | 890 // |
| 890 // Call the runtime function |function_id| with the first argument in | 891 // Call the runtime function |function_id| with the first argument in |
| 891 // register |first_arg| and |arg_count| arguments in subsequent | 892 // register |first_arg| and |arg_count| arguments in subsequent |
| 892 // registers. | 893 // registers. |
| 893 void Interpreter::DoCallRuntime(InterpreterAssembler* assembler) { | 894 void Interpreter::DoCallRuntime(InterpreterAssembler* assembler) { |
| 894 DoCallRuntimeCommon(assembler); | 895 DoCallRuntimeCommon(assembler); |
| 895 } | 896 } |
| 896 | 897 |
| 898 // InvokeIntrinsic <function_id> <first_arg> <arg_count> |
| 899 // |
| 900 // Implements the semantic equivalent of calling the runtime function |
| 901 // |function_id| with the first argument in |first_arg| and |arg_count| |
| 902 // arguments in subsequent registers. |
| 903 void Interpreter::DoInvokeIntrinsic(InterpreterAssembler* assembler) { |
| 904 Node* function_id = __ BytecodeOperandRuntimeId(0); |
| 905 Node* first_arg_reg = __ BytecodeOperandReg(1); |
| 906 Node* arg_count = __ BytecodeOperandCount(2); |
| 907 Node* context = __ GetContext(); |
| 908 IntrinsicsHelper helper(assembler); |
| 909 Node* result = |
| 910 helper.InvokeIntrinsic(function_id, context, first_arg_reg, arg_count); |
| 911 __ SetAccumulator(result); |
| 912 __ Dispatch(); |
| 913 } |
| 914 |
| 897 void Interpreter::DoCallRuntimeForPairCommon(InterpreterAssembler* assembler) { | 915 void Interpreter::DoCallRuntimeForPairCommon(InterpreterAssembler* assembler) { |
| 898 // Call the runtime function. | 916 // Call the runtime function. |
| 899 Node* function_id = __ BytecodeOperandRuntimeId(0); | 917 Node* function_id = __ BytecodeOperandRuntimeId(0); |
| 900 Node* first_arg_reg = __ BytecodeOperandReg(1); | 918 Node* first_arg_reg = __ BytecodeOperandReg(1); |
| 901 Node* first_arg = __ RegisterLocation(first_arg_reg); | 919 Node* first_arg = __ RegisterLocation(first_arg_reg); |
| 902 Node* args_count = __ BytecodeOperandCount(2); | 920 Node* args_count = __ BytecodeOperandCount(2); |
| 903 Node* context = __ GetContext(); | 921 Node* context = __ GetContext(); |
| 904 Node* result_pair = | 922 Node* result_pair = |
| 905 __ CallRuntimeN(function_id, context, first_arg, args_count, 2); | 923 __ CallRuntimeN(function_id, context, first_arg, args_count, 2); |
| 906 | 924 |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1587 // Illegal | 1605 // Illegal |
| 1588 // | 1606 // |
| 1589 // An invalid bytecode aborting execution if dispatched. | 1607 // An invalid bytecode aborting execution if dispatched. |
| 1590 void Interpreter::DoIllegal(InterpreterAssembler* assembler) { | 1608 void Interpreter::DoIllegal(InterpreterAssembler* assembler) { |
| 1591 __ Abort(kInvalidBytecode); | 1609 __ Abort(kInvalidBytecode); |
| 1592 } | 1610 } |
| 1593 | 1611 |
| 1594 } // namespace interpreter | 1612 } // namespace interpreter |
| 1595 } // namespace internal | 1613 } // namespace internal |
| 1596 } // namespace v8 | 1614 } // namespace v8 |
| OLD | NEW |