| 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/zone.h" | 15 #include "src/zone.h" |
| 15 | 16 |
| 16 namespace v8 { | 17 namespace v8 { |
| 17 namespace internal { | 18 namespace internal { |
| 18 namespace interpreter { | 19 namespace interpreter { |
| 19 | 20 |
| 20 using compiler::Node; | 21 using compiler::Node; |
| 21 | 22 |
| 22 #define __ assembler-> | 23 #define __ assembler-> |
| 23 | 24 |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 | 1033 |
| 1033 // CallRuntime <function_id> <first_arg> <arg_count> | 1034 // CallRuntime <function_id> <first_arg> <arg_count> |
| 1034 // | 1035 // |
| 1035 // Call the runtime function |function_id| with the first argument in | 1036 // Call the runtime function |function_id| with the first argument in |
| 1036 // register |first_arg| and |arg_count| arguments in subsequent | 1037 // register |first_arg| and |arg_count| arguments in subsequent |
| 1037 // registers. | 1038 // registers. |
| 1038 void Interpreter::DoCallRuntime(InterpreterAssembler* assembler) { | 1039 void Interpreter::DoCallRuntime(InterpreterAssembler* assembler) { |
| 1039 DoCallRuntimeCommon(assembler); | 1040 DoCallRuntimeCommon(assembler); |
| 1040 } | 1041 } |
| 1041 | 1042 |
| 1043 // InvokeIntrinsic <function_id> <first_arg> <arg_count> |
| 1044 // |
| 1045 // Implements the semantic equivalent of calling the runtime function |
| 1046 // |function_id| with the first argument in |first_arg| and |arg_count| |
| 1047 // arguments in subsequent registers. |
| 1048 void Interpreter::DoInvokeIntrinsic(InterpreterAssembler* assembler) { |
| 1049 Node* function_id = __ BytecodeOperandIdx(0); |
| 1050 Node* first_arg_reg = __ BytecodeOperandReg(1); |
| 1051 Node* arg_count = __ BytecodeOperandCount(2); |
| 1052 Node* context = __ GetContext(); |
| 1053 IntrinsicsHelper helper(assembler); |
| 1054 Node* result = |
| 1055 helper.InvokeIntrinsic(function_id, context, first_arg_reg, arg_count); |
| 1056 __ SetAccumulator(result); |
| 1057 __ Dispatch(); |
| 1058 } |
| 1059 |
| 1060 void Interpreter::DoInvokeIntrinsicWide(InterpreterAssembler* assembler) { |
| 1061 DoInvokeIntrinsic(assembler); |
| 1062 } |
| 1042 | 1063 |
| 1043 // CallRuntime <function_id> <first_arg> <arg_count> | 1064 // CallRuntime <function_id> <first_arg> <arg_count> |
| 1044 // | 1065 // |
| 1045 // Call the runtime function |function_id| with the first argument in | 1066 // Call the runtime function |function_id| with the first argument in |
| 1046 // register |first_arg| and |arg_count| arguments in subsequent | 1067 // register |first_arg| and |arg_count| arguments in subsequent |
| 1047 // registers. | 1068 // registers. |
| 1048 void Interpreter::DoCallRuntimeWide(InterpreterAssembler* assembler) { | 1069 void Interpreter::DoCallRuntimeWide(InterpreterAssembler* assembler) { |
| 1049 DoCallRuntimeCommon(assembler); | 1070 DoCallRuntimeCommon(assembler); |
| 1050 } | 1071 } |
| 1051 | 1072 |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 Node* index = __ LoadRegister(index_reg); | 1934 Node* index = __ LoadRegister(index_reg); |
| 1914 Node* one = __ SmiConstant(Smi::FromInt(1)); | 1935 Node* one = __ SmiConstant(Smi::FromInt(1)); |
| 1915 Node* result = __ SmiAdd(index, one); | 1936 Node* result = __ SmiAdd(index, one); |
| 1916 __ SetAccumulator(result); | 1937 __ SetAccumulator(result); |
| 1917 __ Dispatch(); | 1938 __ Dispatch(); |
| 1918 } | 1939 } |
| 1919 | 1940 |
| 1920 } // namespace interpreter | 1941 } // namespace interpreter |
| 1921 } // namespace internal | 1942 } // namespace internal |
| 1922 } // namespace v8 | 1943 } // namespace v8 |
| OLD | NEW |