Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index 12cc499a7777797695004ae49938228325fecdd5..b373a01fb88479aac0ca38f8a731e159a0b183a9 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -779,18 +779,6 @@ void DoubleToIStub::Generate(MacroAssembler* masm) { |
} |
-// Uses SSE2 to convert the heap number in |source| to an integer. Jumps to |
-// |conversion_failure| if the heap number did not contain an int32 value. |
-// Result is in ecx. Trashes ebx, xmm0, and xmm1. |
-static void ConvertHeapNumberToInt32(MacroAssembler* masm, |
- Register source, |
- Label* conversion_failure) { |
- __ movdbl(xmm0, FieldOperand(source, HeapNumber::kValueOffset)); |
- FloatingPointHelper::CheckSSE2OperandIsInt32( |
- masm, conversion_failure, xmm0, ecx, ebx, xmm1); |
-} |
- |
- |
void BinaryOpStub::Initialize() { |
platform_specific_bit_ = CpuFeatures::IsSupported(SSE3); |
} |
@@ -2391,15 +2379,7 @@ void FloatingPointHelper::LoadUnknownsAsIntegers( |
__ cmp(ebx, factory->heap_number_map()); |
__ j(not_equal, &check_undefined_arg1); |
- // Get the untagged integer version of the edx heap number in ecx. |
- if (left_type == BinaryOpIC::INT32 && CpuFeatures::IsSupported(SSE2)) { |
- CpuFeatureScope use_sse2(masm, SSE2); |
- ConvertHeapNumberToInt32(masm, edx, conversion_failure); |
- } else { |
- DoubleToIStub stub(edx, ecx, HeapNumber::kValueOffset - kHeapObjectTag, |
- true); |
- __ call(stub.GetCode(masm->isolate()), RelocInfo::CODE_TARGET); |
- } |
+ __ TruncateHeapNumberToI(edx, ecx); |
Toon Verwaest
2013/08/27 14:49:28
I'd prefer to have the target on the left, as we h
oliv
2013/08/28 08:28:54
Done.
|
__ mov(edx, ecx); |
Toon Verwaest
2013/08/27 14:49:28
Why is edx overwritten by ecx here, rather than Tr
oliv
2013/08/28 08:28:54
mechanical refactoring...
|
// Here edx has the untagged integer, eax has a Smi or a heap number. |
@@ -2429,14 +2409,7 @@ void FloatingPointHelper::LoadUnknownsAsIntegers( |
__ j(not_equal, &check_undefined_arg2); |
// Get the untagged integer version of the eax heap number in ecx. |
- if (right_type == BinaryOpIC::INT32 && CpuFeatures::IsSupported(SSE2)) { |
- CpuFeatureScope use_sse2(masm, SSE2); |
- ConvertHeapNumberToInt32(masm, eax, conversion_failure); |
- } else { |
- DoubleToIStub stub(eax, ecx, HeapNumber::kValueOffset - kHeapObjectTag, |
- true); |
- __ call(stub.GetCode(masm->isolate()), RelocInfo::CODE_TARGET); |
- } |
+ __ TruncateHeapNumberToI(eax, ecx); |
__ bind(&done); |
__ mov(eax, edx); |
@@ -2691,15 +2664,9 @@ void MathPowStub::Generate(MacroAssembler* masm) { |
if (exponent_type_ != INTEGER) { |
Label fast_power; |
- // Detect integer exponents stored as double. |
- __ cvttsd2si(exponent, Operand(double_exponent)); |
- // Skip to runtime if possibly NaN (indicated by the indefinite integer). |
- __ cmp(exponent, Immediate(0x80000000u)); |
- __ j(equal, &call_runtime); |
- __ cvtsi2sd(double_scratch, exponent); |
- // Already ruled out NaNs for exponent. |
- __ ucomisd(double_exponent, double_scratch); |
- __ j(equal, &int_exponent); |
+ __ DoubleToI(double_exponent, exponent, double_scratch, |
+ TREAT_MINUS_ZERO_AS_ZERO, &call_runtime); |
+ __ jmp(&int_exponent); |
Toon Verwaest
2013/08/27 14:49:28
Unconditional jump with unlabeled code below?
oliv
2013/08/28 08:28:54
mechanical refactoring again... sry
|
if (exponent_type_ == ON_STACK) { |
// Detect square root case. Crankshaft detects constant +/-0.5 at |