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 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 } | 1142 } |
1143 | 1143 |
1144 // DeletePropertySloppy | 1144 // DeletePropertySloppy |
1145 // | 1145 // |
1146 // Delete the property specified in the accumulator from the object | 1146 // Delete the property specified in the accumulator from the object |
1147 // referenced by the register operand following sloppy mode semantics. | 1147 // referenced by the register operand following sloppy mode semantics. |
1148 void Interpreter::DoDeletePropertySloppy(InterpreterAssembler* assembler) { | 1148 void Interpreter::DoDeletePropertySloppy(InterpreterAssembler* assembler) { |
1149 DoDelete(Runtime::kDeleteProperty_Sloppy, assembler); | 1149 DoDelete(Runtime::kDeleteProperty_Sloppy, assembler); |
1150 } | 1150 } |
1151 | 1151 |
| 1152 void Interpreter::DoJSCallWithFeedback(InterpreterAssembler* assembler, |
| 1153 TailCallMode tail_call_mode) { |
| 1154 Node* function_reg = __ BytecodeOperandReg(0); |
| 1155 Node* function = __ LoadRegister(function_reg); |
| 1156 Node* receiver_reg = __ BytecodeOperandReg(1); |
| 1157 Node* receiver_arg = __ RegisterLocation(receiver_reg); |
| 1158 Node* receiver_args_count = __ BytecodeOperandCount(2); |
| 1159 Node* receiver_count = __ Int32Constant(1); |
| 1160 Node* args_count = __ Int32Sub(receiver_args_count, receiver_count); |
| 1161 Node* slot_id_raw = __ BytecodeOperandIdx(3); |
| 1162 Node* slot_id = __ SmiTag(slot_id_raw); |
| 1163 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
| 1164 Node* context = __ GetContext(); |
| 1165 Node* result = |
| 1166 __ CallJSWithFeedback(function, context, receiver_arg, args_count, |
| 1167 slot_id, type_feedback_vector, tail_call_mode); |
| 1168 __ SetAccumulator(result); |
| 1169 __ Dispatch(); |
| 1170 } |
| 1171 |
| 1172 // Call <callable> <receiver> <arg_count> <feedback_slot_id> |
| 1173 // |
| 1174 // Call a JSfunction or Callable in |callable| with the |receiver| and |
| 1175 // |arg_count| arguments in subsequent registers. Collect type feedback |
| 1176 // into |feedback_slot_id| |
| 1177 void Interpreter::DoCallWithFeedback(InterpreterAssembler* assembler) { |
| 1178 DoJSCallWithFeedback(assembler, TailCallMode::kDisallow); |
| 1179 } |
| 1180 |
| 1181 // TailCall <callable> <receiver> <arg_count> <feedback_slot_id> |
| 1182 // |
| 1183 // Tail call a JSfunction or Callable in |callable| with the |receiver| and |
| 1184 // |arg_count| arguments in subsequent registers. Collect type feedback |
| 1185 // into |feedback_slot_id| |
| 1186 void Interpreter::DoTailCallWithFeedback(InterpreterAssembler* assembler) { |
| 1187 DoJSCallWithFeedback(assembler, TailCallMode::kAllow); |
| 1188 } |
| 1189 |
1152 void Interpreter::DoJSCall(InterpreterAssembler* assembler, | 1190 void Interpreter::DoJSCall(InterpreterAssembler* assembler, |
1153 TailCallMode tail_call_mode) { | 1191 TailCallMode tail_call_mode) { |
1154 Node* function_reg = __ BytecodeOperandReg(0); | 1192 Node* function_reg = __ BytecodeOperandReg(0); |
1155 Node* function = __ LoadRegister(function_reg); | 1193 Node* function = __ LoadRegister(function_reg); |
1156 Node* receiver_reg = __ BytecodeOperandReg(1); | 1194 Node* receiver_reg = __ BytecodeOperandReg(1); |
1157 Node* receiver_arg = __ RegisterLocation(receiver_reg); | 1195 Node* receiver_arg = __ RegisterLocation(receiver_reg); |
1158 Node* receiver_args_count = __ BytecodeOperandCount(2); | 1196 Node* receiver_args_count = __ BytecodeOperandCount(2); |
1159 Node* receiver_count = __ Int32Constant(1); | 1197 Node* receiver_count = __ Int32Constant(1); |
1160 Node* args_count = __ Int32Sub(receiver_args_count, receiver_count); | 1198 Node* args_count = __ Int32Sub(receiver_args_count, receiver_count); |
1161 Node* context = __ GetContext(); | 1199 Node* context = __ GetContext(); |
1162 // TODO(rmcilroy): Use the call type feedback slot to call via CallStub. | |
1163 Node* result = | 1200 Node* result = |
1164 __ CallJS(function, context, receiver_arg, args_count, tail_call_mode); | 1201 __ CallJS(function, context, receiver_arg, args_count, tail_call_mode); |
1165 __ SetAccumulator(result); | 1202 __ SetAccumulator(result); |
1166 __ Dispatch(); | 1203 __ Dispatch(); |
1167 } | 1204 } |
1168 | 1205 |
1169 // Call <callable> <receiver> <arg_count> | 1206 // Call <callable> <receiver> <arg_count> |
1170 // | 1207 // |
1171 // Call a JSfunction or Callable in |callable| with the |receiver| and | 1208 // Call a JSfunction or Callable in |callable| with the |receiver| and |
1172 // |arg_count| arguments in subsequent registers. | 1209 // |arg_count| arguments in subsequent registers. |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2024 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2061 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
2025 __ SmiTag(new_state)); | 2062 __ SmiTag(new_state)); |
2026 __ SetAccumulator(old_state); | 2063 __ SetAccumulator(old_state); |
2027 | 2064 |
2028 __ Dispatch(); | 2065 __ Dispatch(); |
2029 } | 2066 } |
2030 | 2067 |
2031 } // namespace interpreter | 2068 } // namespace interpreter |
2032 } // namespace internal | 2069 } // namespace internal |
2033 } // namespace v8 | 2070 } // namespace v8 |
OLD | NEW |