Index: src/mips/code-stubs-mips.cc |
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc |
index 0ce551d7b3798eada3dd33f8765a082e04281c03..42f2c6fdbeae44ca5081a30d8d3a013d19a5ba80 100644 |
--- a/src/mips/code-stubs-mips.cc |
+++ b/src/mips/code-stubs-mips.cc |
@@ -2789,9 +2789,11 @@ void BinaryOpStub::GenerateInt32Stub(MacroAssembler* masm) { |
// DIV just falls through to allocating a heap number. |
} |
+ __ bind(&return_heap_number); |
+ // Return a heap number, or fall through to type transition or runtime |
+ // call if we can't. |
if (result_type_ >= ((op_ == Token::DIV) ? BinaryOpIC::HEAP_NUMBER |
: BinaryOpIC::INT32)) { |
- __ bind(&return_heap_number); |
// We are using FPU registers so s0 is available. |
heap_number_result = s0; |
GenerateHeapResultAllocation(masm, |
@@ -2970,7 +2972,11 @@ void BinaryOpStub::GenerateInt32Stub(MacroAssembler* masm) { |
UNREACHABLE(); |
} |
- if (transition.is_linked()) { |
+ // We never expect DIV to yield an integer result, so we always generate |
+ // type transition code for DIV operations expecting an integer result: the |
+ // code will fall through to this type transition. |
+ if (transition.is_linked() || |
+ ((op_ == Token::DIV) && (result_type_ <= BinaryOpIC::INT32))) { |
__ bind(&transition); |
GenerateTypeTransition(masm); |
} |