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 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 | 1151 |
1152 void Interpreter::DoJSCall(InterpreterAssembler* assembler, | 1152 void Interpreter::DoJSCall(InterpreterAssembler* assembler, |
1153 TailCallMode tail_call_mode) { | 1153 TailCallMode tail_call_mode) { |
1154 Node* function_reg = __ BytecodeOperandReg(0); | 1154 Node* function_reg = __ BytecodeOperandReg(0); |
1155 Node* function = __ LoadRegister(function_reg); | 1155 Node* function = __ LoadRegister(function_reg); |
1156 Node* receiver_reg = __ BytecodeOperandReg(1); | 1156 Node* receiver_reg = __ BytecodeOperandReg(1); |
1157 Node* receiver_arg = __ RegisterLocation(receiver_reg); | 1157 Node* receiver_arg = __ RegisterLocation(receiver_reg); |
1158 Node* receiver_args_count = __ BytecodeOperandCount(2); | 1158 Node* receiver_args_count = __ BytecodeOperandCount(2); |
1159 Node* receiver_count = __ Int32Constant(1); | 1159 Node* receiver_count = __ Int32Constant(1); |
1160 Node* args_count = __ Int32Sub(receiver_args_count, receiver_count); | 1160 Node* args_count = __ Int32Sub(receiver_args_count, receiver_count); |
| 1161 Node* slot_id = __ BytecodeOperandIdx(3); |
| 1162 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
1161 Node* context = __ GetContext(); | 1163 Node* context = __ GetContext(); |
1162 // TODO(rmcilroy): Use the call type feedback slot to call via CallStub. | |
1163 Node* result = | 1164 Node* result = |
1164 __ CallJS(function, context, receiver_arg, args_count, tail_call_mode); | 1165 __ CallJSWithFeedback(function, context, receiver_arg, args_count, |
| 1166 slot_id, type_feedback_vector, tail_call_mode); |
1165 __ SetAccumulator(result); | 1167 __ SetAccumulator(result); |
1166 __ Dispatch(); | 1168 __ Dispatch(); |
1167 } | 1169 } |
1168 | 1170 |
1169 // Call <callable> <receiver> <arg_count> | 1171 // Call <callable> <receiver> <arg_count> <feedback_slot_id> |
1170 // | 1172 // |
1171 // Call a JSfunction or Callable in |callable| with the |receiver| and | 1173 // Call a JSfunction or Callable in |callable| with the |receiver| and |
1172 // |arg_count| arguments in subsequent registers. | 1174 // |arg_count| arguments in subsequent registers. Collect type feedback |
| 1175 // into |feedback_slot_id| |
1173 void Interpreter::DoCall(InterpreterAssembler* assembler) { | 1176 void Interpreter::DoCall(InterpreterAssembler* assembler) { |
1174 DoJSCall(assembler, TailCallMode::kDisallow); | 1177 DoJSCall(assembler, TailCallMode::kDisallow); |
1175 } | 1178 } |
1176 | 1179 |
1177 // TailCall <callable> <receiver> <arg_count> | 1180 // TailCall <callable> <receiver> <arg_count> <feedback_slot_id> |
1178 // | 1181 // |
1179 // Tail call a JSfunction or Callable in |callable| with the |receiver| and | 1182 // Tail call a JSfunction or Callable in |callable| with the |receiver| and |
1180 // |arg_count| arguments in subsequent registers. | 1183 // |arg_count| arguments in subsequent registers. Collect type feedback |
| 1184 // into |feedback_slot_id| |
1181 void Interpreter::DoTailCall(InterpreterAssembler* assembler) { | 1185 void Interpreter::DoTailCall(InterpreterAssembler* assembler) { |
1182 DoJSCall(assembler, TailCallMode::kAllow); | 1186 DoJSCall(assembler, TailCallMode::kAllow); |
1183 } | 1187 } |
1184 | 1188 |
1185 void Interpreter::DoCallRuntimeCommon(InterpreterAssembler* assembler) { | 1189 void Interpreter::DoCallRuntimeCommon(InterpreterAssembler* assembler) { |
1186 Node* function_id = __ BytecodeOperandRuntimeId(0); | 1190 Node* function_id = __ BytecodeOperandRuntimeId(0); |
1187 Node* first_arg_reg = __ BytecodeOperandReg(1); | 1191 Node* first_arg_reg = __ BytecodeOperandReg(1); |
1188 Node* first_arg = __ RegisterLocation(first_arg_reg); | 1192 Node* first_arg = __ RegisterLocation(first_arg_reg); |
1189 Node* args_count = __ BytecodeOperandCount(2); | 1193 Node* args_count = __ BytecodeOperandCount(2); |
1190 Node* context = __ GetContext(); | 1194 Node* context = __ GetContext(); |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2024 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2028 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
2025 __ SmiTag(new_state)); | 2029 __ SmiTag(new_state)); |
2026 __ SetAccumulator(old_state); | 2030 __ SetAccumulator(old_state); |
2027 | 2031 |
2028 __ Dispatch(); | 2032 __ Dispatch(); |
2029 } | 2033 } |
2030 | 2034 |
2031 } // namespace interpreter | 2035 } // namespace interpreter |
2032 } // namespace internal | 2036 } // namespace internal |
2033 } // namespace v8 | 2037 } // namespace v8 |
OLD | NEW |