Index: src/interpreter/interpreter-assembler.cc |
diff --git a/src/interpreter/interpreter-assembler.cc b/src/interpreter/interpreter-assembler.cc |
index d76af992240493b239b337c297084a24b19a3065..3893f560d309e405a99edec44d1f751bc7431b25 100644 |
--- a/src/interpreter/interpreter-assembler.cc |
+++ b/src/interpreter/interpreter-assembler.cc |
@@ -1151,6 +1151,43 @@ void InterpreterAssembler::DispatchWide(OperandScale operand_scale) { |
DispatchToBytecodeHandlerEntry(target_code_entry, next_bytecode_offset); |
} |
+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.
|
+ Variable* var_type_feedback) { |
+ Variable var_result(this, MachineRepresentation::kTagged); |
+ Label if_done(this), if_objectissmi(this), if_objectisnumber(this), |
+ if_objectisother(this, Label::kDeferred); |
+ |
+ GotoIf(TaggedIsSmi(object), &if_objectissmi); |
+ Node* object_map = LoadMap(object); |
+ Branch(IsHeapNumberMap(object_map), &if_objectisnumber, &if_objectisother); |
+ |
+ Bind(&if_objectissmi); |
+ { |
+ var_result.Bind(object); |
+ var_type_feedback->Bind(SmiConstant(BinaryOperationFeedback::kSignedSmall)); |
+ Goto(&if_done); |
+ } |
+ |
+ Bind(&if_objectisnumber); |
+ { |
+ var_result.Bind(object); |
+ var_type_feedback->Bind(SmiConstant(BinaryOperationFeedback::kNumber)); |
+ Goto(&if_done); |
+ } |
+ |
+ Bind(&if_objectisother); |
+ { |
+ // Convert the {object} to a Number. |
+ Callable callable = CodeFactory::NonNumberToNumber(isolate()); |
+ var_result.Bind(CallStub(callable, context, object)); |
+ var_type_feedback->Bind(SmiConstant(BinaryOperationFeedback::kAny)); |
+ Goto(&if_done); |
+ } |
+ |
+ Bind(&if_done); |
+ return var_result.value(); |
+} |
+ |
Node* InterpreterAssembler::TruncateTaggedToWord32WithFeedback( |
Node* context, Node* value, Variable* var_type_feedback) { |
// We might need to loop once due to ToNumber conversion. |