Chromium Code Reviews| 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-assembler.h" | 5 #include "src/interpreter/interpreter-assembler.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <ostream> | 8 #include <ostream> |
| 9 | 9 |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1144 base_index = nullptr; | 1144 base_index = nullptr; |
| 1145 } | 1145 } |
| 1146 Node* target_index = IntPtrAdd(base_index, next_bytecode); | 1146 Node* target_index = IntPtrAdd(base_index, next_bytecode); |
| 1147 Node* target_code_entry = | 1147 Node* target_code_entry = |
| 1148 Load(MachineType::Pointer(), DispatchTableRawPointer(), | 1148 Load(MachineType::Pointer(), DispatchTableRawPointer(), |
| 1149 WordShl(target_index, kPointerSizeLog2)); | 1149 WordShl(target_index, kPointerSizeLog2)); |
| 1150 | 1150 |
| 1151 DispatchToBytecodeHandlerEntry(target_code_entry, next_bytecode_offset); | 1151 DispatchToBytecodeHandlerEntry(target_code_entry, next_bytecode_offset); |
| 1152 } | 1152 } |
| 1153 | 1153 |
| 1154 Node* InterpreterAssembler::ToNumberWithFeedback(Node* context, Node* object, | |
|
rmcilroy
2017/04/06 11:21:31
Please just do this inline InterpreterGenerator::D
Michael Starzinger
2017/04/06 11:28:31
+1
Benedikt Meurer
2017/04/06 11:30:00
Done.
| |
| 1155 Variable* var_type_feedback) { | |
| 1156 Variable var_result(this, MachineRepresentation::kTagged); | |
| 1157 Label if_done(this), if_objectissmi(this), if_objectisnumber(this), | |
| 1158 if_objectisother(this, Label::kDeferred); | |
| 1159 | |
| 1160 GotoIf(TaggedIsSmi(object), &if_objectissmi); | |
| 1161 Node* object_map = LoadMap(object); | |
| 1162 Branch(IsHeapNumberMap(object_map), &if_objectisnumber, &if_objectisother); | |
| 1163 | |
| 1164 Bind(&if_objectissmi); | |
| 1165 { | |
| 1166 var_result.Bind(object); | |
| 1167 var_type_feedback->Bind(SmiConstant(BinaryOperationFeedback::kSignedSmall)); | |
| 1168 Goto(&if_done); | |
| 1169 } | |
| 1170 | |
| 1171 Bind(&if_objectisnumber); | |
| 1172 { | |
| 1173 var_result.Bind(object); | |
| 1174 var_type_feedback->Bind(SmiConstant(BinaryOperationFeedback::kNumber)); | |
| 1175 Goto(&if_done); | |
| 1176 } | |
| 1177 | |
| 1178 Bind(&if_objectisother); | |
| 1179 { | |
| 1180 // Convert the {object} to a Number. | |
| 1181 Callable callable = CodeFactory::NonNumberToNumber(isolate()); | |
| 1182 var_result.Bind(CallStub(callable, context, object)); | |
| 1183 var_type_feedback->Bind(SmiConstant(BinaryOperationFeedback::kAny)); | |
| 1184 Goto(&if_done); | |
| 1185 } | |
| 1186 | |
| 1187 Bind(&if_done); | |
| 1188 return var_result.value(); | |
| 1189 } | |
| 1190 | |
| 1154 Node* InterpreterAssembler::TruncateTaggedToWord32WithFeedback( | 1191 Node* InterpreterAssembler::TruncateTaggedToWord32WithFeedback( |
| 1155 Node* context, Node* value, Variable* var_type_feedback) { | 1192 Node* context, Node* value, Variable* var_type_feedback) { |
| 1156 // We might need to loop once due to ToNumber conversion. | 1193 // We might need to loop once due to ToNumber conversion. |
| 1157 Variable var_value(this, MachineRepresentation::kTagged), | 1194 Variable var_value(this, MachineRepresentation::kTagged), |
| 1158 var_result(this, MachineRepresentation::kWord32); | 1195 var_result(this, MachineRepresentation::kWord32); |
| 1159 Variable* loop_vars[] = {&var_value, var_type_feedback}; | 1196 Variable* loop_vars[] = {&var_value, var_type_feedback}; |
| 1160 Label loop(this, 2, loop_vars), done_loop(this, &var_result); | 1197 Label loop(this, 2, loop_vars), done_loop(this, &var_result); |
| 1161 var_value.Bind(value); | 1198 var_value.Bind(value); |
| 1162 var_type_feedback->Bind(SmiConstant(BinaryOperationFeedback::kNone)); | 1199 var_type_feedback->Bind(SmiConstant(BinaryOperationFeedback::kNone)); |
| 1163 Goto(&loop); | 1200 Goto(&loop); |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1422 Goto(&loop); | 1459 Goto(&loop); |
| 1423 } | 1460 } |
| 1424 Bind(&done_loop); | 1461 Bind(&done_loop); |
| 1425 | 1462 |
| 1426 return array; | 1463 return array; |
| 1427 } | 1464 } |
| 1428 | 1465 |
| 1429 } // namespace interpreter | 1466 } // namespace interpreter |
| 1430 } // namespace internal | 1467 } // namespace internal |
| 1431 } // namespace v8 | 1468 } // namespace v8 |
| OLD | NEW |