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 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 | 1037 |
1037 // CallRuntime <function_id> <first_arg> <arg_count> | 1038 // CallRuntime <function_id> <first_arg> <arg_count> |
1038 // | 1039 // |
1039 // Call the runtime function |function_id| with the first argument in | 1040 // Call the runtime function |function_id| with the first argument in |
1040 // register |first_arg| and |arg_count| arguments in subsequent | 1041 // register |first_arg| and |arg_count| arguments in subsequent |
1041 // registers. | 1042 // registers. |
1042 void Interpreter::DoCallRuntime(InterpreterAssembler* assembler) { | 1043 void Interpreter::DoCallRuntime(InterpreterAssembler* assembler) { |
1043 DoCallRuntimeCommon(assembler); | 1044 DoCallRuntimeCommon(assembler); |
1044 } | 1045 } |
1045 | 1046 |
| 1047 // InvokeIntrinsic <function_id> <first_arg> <arg_count> |
| 1048 // |
| 1049 // Implements the semantic equivalent of calling the runtime function |
| 1050 // |function_id| with the first argument in |first_arg| and |arg_count| |
| 1051 // arguments in subsequent registers. |
| 1052 void Interpreter::DoInvokeIntrinsic(InterpreterAssembler* assembler) { |
| 1053 Node* function_id = __ BytecodeOperandIdx(0); |
| 1054 Node* first_arg_reg = __ BytecodeOperandReg(1); |
| 1055 Node* arg_count = __ BytecodeOperandCount(2); |
| 1056 Node* context = __ GetContext(); |
| 1057 IntrinsicsHelper helper(assembler); |
| 1058 Node* result = |
| 1059 helper.InvokeIntrinsic(function_id, context, first_arg_reg, arg_count); |
| 1060 __ SetAccumulator(result); |
| 1061 __ Dispatch(); |
| 1062 } |
| 1063 |
| 1064 void Interpreter::DoInvokeIntrinsicWide(InterpreterAssembler* assembler) { |
| 1065 DoInvokeIntrinsic(assembler); |
| 1066 } |
1046 | 1067 |
1047 // CallRuntime <function_id> <first_arg> <arg_count> | 1068 // CallRuntime <function_id> <first_arg> <arg_count> |
1048 // | 1069 // |
1049 // Call the runtime function |function_id| with the first argument in | 1070 // Call the runtime function |function_id| with the first argument in |
1050 // register |first_arg| and |arg_count| arguments in subsequent | 1071 // register |first_arg| and |arg_count| arguments in subsequent |
1051 // registers. | 1072 // registers. |
1052 void Interpreter::DoCallRuntimeWide(InterpreterAssembler* assembler) { | 1073 void Interpreter::DoCallRuntimeWide(InterpreterAssembler* assembler) { |
1053 DoCallRuntimeCommon(assembler); | 1074 DoCallRuntimeCommon(assembler); |
1054 } | 1075 } |
1055 | 1076 |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1908 Node* index = __ LoadRegister(index_reg); | 1929 Node* index = __ LoadRegister(index_reg); |
1909 Node* one = __ SmiConstant(Smi::FromInt(1)); | 1930 Node* one = __ SmiConstant(Smi::FromInt(1)); |
1910 Node* result = __ SmiAdd(index, one); | 1931 Node* result = __ SmiAdd(index, one); |
1911 __ SetAccumulator(result); | 1932 __ SetAccumulator(result); |
1912 __ Dispatch(); | 1933 __ Dispatch(); |
1913 } | 1934 } |
1914 | 1935 |
1915 } // namespace interpreter | 1936 } // namespace interpreter |
1916 } // namespace internal | 1937 } // namespace internal |
1917 } // namespace v8 | 1938 } // namespace v8 |
OLD | NEW |