Index: src/ia32/macro-assembler-ia32.cc |
diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc |
index cc0f392f185212826144898536c1945fef233d7f..d914bcc9197d83fcb9460c79923c03f0161cf4f7 100644 |
--- a/src/ia32/macro-assembler-ia32.cc |
+++ b/src/ia32/macro-assembler-ia32.cc |
@@ -3603,6 +3603,22 @@ void MacroAssembler::JumpIfDictionaryInPrototypeChain( |
j(not_equal, &loop_again); |
} |
+ |
+void MacroAssembler::FlooringDiv(Register dividend, int32_t divisor) { |
+ ASSERT(!dividend.is(eax)); |
+ ASSERT(!dividend.is(edx)); |
+ MultiplierAndShift ms(divisor); |
+ mov(eax, Immediate(ms.multiplier())); |
+ imul(dividend); |
+ if (divisor > 0 && ms.multiplier() < 0) add(edx, dividend); |
+ if (divisor < 0 && ms.multiplier() > 0) sub(edx, dividend); |
+ if (ms.shift() > 0) sar(edx, ms.shift()); |
+ mov(eax, dividend); |
+ shr(eax, 31); |
+ add(edx, eax); |
+} |
+ |
+ |
} } // namespace v8::internal |
#endif // V8_TARGET_ARCH_IA32 |