Index: src/x64/code-stubs-x64.cc |
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc |
index 86d57043a792aed976e5940490579da9a268b88b..0f633874e6750a33411dd3449e9ed03d01f28e26 100644 |
--- a/src/x64/code-stubs-x64.cc |
+++ b/src/x64/code-stubs-x64.cc |
@@ -1422,12 +1422,23 @@ void TypeRecordingBinaryOpStub::GenerateCallRuntimeCode(MacroAssembler* masm) { |
void TypeRecordingBinaryOpStub::GenerateSmiStub(MacroAssembler* masm) { |
- Label not_smi; |
- |
- GenerateSmiCode(masm, ¬_smi, NO_HEAPNUMBER_RESULTS); |
+ Label call_runtime; |
+ if (result_type_ == TRBinaryOpIC::UNINITIALIZED || |
+ result_type_ == TRBinaryOpIC::SMI) { |
+ // Only allow smi results. |
+ GenerateSmiCode(masm, NULL, NO_HEAPNUMBER_RESULTS); |
+ } else { |
+ // Allow heap number result and don't make a transition if a heap number |
+ // cannot be allocated. |
+ GenerateSmiCode(masm, &call_runtime, ALLOW_HEAPNUMBER_RESULTS); |
+ } |
- __ bind(¬_smi); |
+ // Code falls through if the result is not returned as either a smi or heap |
+ // number. |
GenerateTypeTransition(masm); |
+ |
+ __ bind(&call_runtime); |
+ GenerateCallRuntimeCode(masm); |
} |