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 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 | 1112 |
1113 template <class Generator> | 1113 template <class Generator> |
1114 void Interpreter::DoUnaryOp(InterpreterAssembler* assembler) { | 1114 void Interpreter::DoUnaryOp(InterpreterAssembler* assembler) { |
1115 Node* value = __ GetAccumulator(); | 1115 Node* value = __ GetAccumulator(); |
1116 Node* context = __ GetContext(); | 1116 Node* context = __ GetContext(); |
1117 Node* result = Generator::Generate(assembler, value, context); | 1117 Node* result = Generator::Generate(assembler, value, context); |
1118 __ SetAccumulator(result); | 1118 __ SetAccumulator(result); |
1119 __ Dispatch(); | 1119 __ Dispatch(); |
1120 } | 1120 } |
1121 | 1121 |
| 1122 template <class Generator> |
| 1123 void Interpreter::DoUnaryOpWithFeedback(InterpreterAssembler* assembler) { |
| 1124 Node* value = __ GetAccumulator(); |
| 1125 Node* context = __ GetContext(); |
| 1126 Node* slot_index = __ BytecodeOperandIdx(0); |
| 1127 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
| 1128 Node* result = Generator::Generate(assembler, value, context, |
| 1129 type_feedback_vector, slot_index); |
| 1130 __ SetAccumulator(result); |
| 1131 __ Dispatch(); |
| 1132 } |
| 1133 |
1122 // ToName | 1134 // ToName |
1123 // | 1135 // |
1124 // Cast the object referenced by the accumulator to a name. | 1136 // Cast the object referenced by the accumulator to a name. |
1125 void Interpreter::DoToName(InterpreterAssembler* assembler) { | 1137 void Interpreter::DoToName(InterpreterAssembler* assembler) { |
1126 Node* result = BuildUnaryOp(CodeFactory::ToName(isolate_), assembler); | 1138 Node* result = BuildUnaryOp(CodeFactory::ToName(isolate_), assembler); |
1127 __ StoreRegister(result, __ BytecodeOperandReg(0)); | 1139 __ StoreRegister(result, __ BytecodeOperandReg(0)); |
1128 __ Dispatch(); | 1140 __ Dispatch(); |
1129 } | 1141 } |
1130 | 1142 |
1131 // ToNumber | 1143 // ToNumber |
(...skipping 11 matching lines...) Expand all Loading... |
1143 void Interpreter::DoToObject(InterpreterAssembler* assembler) { | 1155 void Interpreter::DoToObject(InterpreterAssembler* assembler) { |
1144 Node* result = BuildUnaryOp(CodeFactory::ToObject(isolate_), assembler); | 1156 Node* result = BuildUnaryOp(CodeFactory::ToObject(isolate_), assembler); |
1145 __ StoreRegister(result, __ BytecodeOperandReg(0)); | 1157 __ StoreRegister(result, __ BytecodeOperandReg(0)); |
1146 __ Dispatch(); | 1158 __ Dispatch(); |
1147 } | 1159 } |
1148 | 1160 |
1149 // Inc | 1161 // Inc |
1150 // | 1162 // |
1151 // Increments value in the accumulator by one. | 1163 // Increments value in the accumulator by one. |
1152 void Interpreter::DoInc(InterpreterAssembler* assembler) { | 1164 void Interpreter::DoInc(InterpreterAssembler* assembler) { |
1153 DoUnaryOp<IncStub>(assembler); | 1165 DoUnaryOpWithFeedback<IncStub>(assembler); |
1154 } | 1166 } |
1155 | 1167 |
1156 // Dec | 1168 // Dec |
1157 // | 1169 // |
1158 // Decrements value in the accumulator by one. | 1170 // Decrements value in the accumulator by one. |
1159 void Interpreter::DoDec(InterpreterAssembler* assembler) { | 1171 void Interpreter::DoDec(InterpreterAssembler* assembler) { |
1160 DoUnaryOp<DecStub>(assembler); | 1172 DoUnaryOpWithFeedback<DecStub>(assembler); |
1161 } | 1173 } |
1162 | 1174 |
1163 // LogicalNot | 1175 // LogicalNot |
1164 // | 1176 // |
1165 // Perform logical-not on the accumulator, first casting the | 1177 // Perform logical-not on the accumulator, first casting the |
1166 // accumulator to a boolean value if required. | 1178 // accumulator to a boolean value if required. |
1167 // ToBooleanLogicalNot | 1179 // ToBooleanLogicalNot |
1168 void Interpreter::DoToBooleanLogicalNot(InterpreterAssembler* assembler) { | 1180 void Interpreter::DoToBooleanLogicalNot(InterpreterAssembler* assembler) { |
1169 Node* value = __ GetAccumulator(); | 1181 Node* value = __ GetAccumulator(); |
1170 Variable result(assembler, MachineRepresentation::kTagged); | 1182 Variable result(assembler, MachineRepresentation::kTagged); |
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2280 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2292 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
2281 __ SmiTag(new_state)); | 2293 __ SmiTag(new_state)); |
2282 __ SetAccumulator(old_state); | 2294 __ SetAccumulator(old_state); |
2283 | 2295 |
2284 __ Dispatch(); | 2296 __ Dispatch(); |
2285 } | 2297 } |
2286 | 2298 |
2287 } // namespace interpreter | 2299 } // namespace interpreter |
2288 } // namespace internal | 2300 } // namespace internal |
2289 } // namespace v8 | 2301 } // namespace v8 |
OLD | NEW |