Index: src/ia32/code-stubs-ia32.cc |
=================================================================== |
--- src/ia32/code-stubs-ia32.cc (revision 7711) |
+++ src/ia32/code-stubs-ia32.cc (working copy) |
@@ -2755,140 +2755,6 @@ |
} |
-void GenericUnaryOpStub::Generate(MacroAssembler* masm) { |
- Label slow, done, undo; |
- |
- if (op_ == Token::SUB) { |
- if (include_smi_code_) { |
- // Check whether the value is a smi. |
- NearLabel try_float; |
- __ test(eax, Immediate(kSmiTagMask)); |
- __ j(not_zero, &try_float, not_taken); |
- |
- if (negative_zero_ == kStrictNegativeZero) { |
- // Go slow case if the value of the expression is zero |
- // to make sure that we switch between 0 and -0. |
- __ test(eax, Operand(eax)); |
- __ j(zero, &slow, not_taken); |
- } |
- |
- // The value of the expression is a smi that is not zero. Try |
- // optimistic subtraction '0 - value'. |
- __ mov(edx, Operand(eax)); |
- __ Set(eax, Immediate(0)); |
- __ sub(eax, Operand(edx)); |
- __ j(overflow, &undo, not_taken); |
- __ StubReturn(1); |
- |
- // Try floating point case. |
- __ bind(&try_float); |
- } else if (FLAG_debug_code) { |
- __ AbortIfSmi(eax); |
- } |
- |
- __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); |
- __ cmp(edx, masm->isolate()->factory()->heap_number_map()); |
- __ j(not_equal, &slow); |
- if (overwrite_ == UNARY_OVERWRITE) { |
- __ mov(edx, FieldOperand(eax, HeapNumber::kExponentOffset)); |
- __ xor_(edx, HeapNumber::kSignMask); // Flip sign. |
- __ mov(FieldOperand(eax, HeapNumber::kExponentOffset), edx); |
- } else { |
- __ mov(edx, Operand(eax)); |
- // edx: operand |
- __ AllocateHeapNumber(eax, ebx, ecx, &undo); |
- // eax: allocated 'empty' number |
- __ mov(ecx, FieldOperand(edx, HeapNumber::kExponentOffset)); |
- __ xor_(ecx, HeapNumber::kSignMask); // Flip sign. |
- __ mov(FieldOperand(eax, HeapNumber::kExponentOffset), ecx); |
- __ mov(ecx, FieldOperand(edx, HeapNumber::kMantissaOffset)); |
- __ mov(FieldOperand(eax, HeapNumber::kMantissaOffset), ecx); |
- } |
- } else if (op_ == Token::BIT_NOT) { |
- if (include_smi_code_) { |
- Label non_smi; |
- __ test(eax, Immediate(kSmiTagMask)); |
- __ j(not_zero, &non_smi); |
- __ not_(eax); |
- __ and_(eax, ~kSmiTagMask); // Remove inverted smi-tag. |
- __ ret(0); |
- __ bind(&non_smi); |
- } else if (FLAG_debug_code) { |
- __ AbortIfSmi(eax); |
- } |
- |
- // Check if the operand is a heap number. |
- __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); |
- __ cmp(edx, masm->isolate()->factory()->heap_number_map()); |
- __ j(not_equal, &slow, not_taken); |
- |
- // Convert the heap number in eax to an untagged integer in ecx. |
- IntegerConvert(masm, |
- eax, |
- TypeInfo::Unknown(), |
- CpuFeatures::IsSupported(SSE3), |
- &slow); |
- |
- // Do the bitwise operation and check if the result fits in a smi. |
- NearLabel try_float; |
- __ not_(ecx); |
- __ cmp(ecx, 0xc0000000); |
- __ j(sign, &try_float, not_taken); |
- |
- // Tag the result as a smi and we're done. |
- STATIC_ASSERT(kSmiTagSize == 1); |
- __ lea(eax, Operand(ecx, times_2, kSmiTag)); |
- __ jmp(&done); |
- |
- // Try to store the result in a heap number. |
- __ bind(&try_float); |
- if (overwrite_ == UNARY_NO_OVERWRITE) { |
- // Allocate a fresh heap number, but don't overwrite eax until |
- // we're sure we can do it without going through the slow case |
- // that needs the value in eax. |
- __ AllocateHeapNumber(ebx, edx, edi, &slow); |
- __ mov(eax, Operand(ebx)); |
- } |
- if (CpuFeatures::IsSupported(SSE2)) { |
- CpuFeatures::Scope use_sse2(SSE2); |
- __ cvtsi2sd(xmm0, Operand(ecx)); |
- __ movdbl(FieldOperand(eax, HeapNumber::kValueOffset), xmm0); |
- } else { |
- __ push(ecx); |
- __ fild_s(Operand(esp, 0)); |
- __ pop(ecx); |
- __ fstp_d(FieldOperand(eax, HeapNumber::kValueOffset)); |
- } |
- } else { |
- UNIMPLEMENTED(); |
- } |
- |
- // Return from the stub. |
- __ bind(&done); |
- __ StubReturn(1); |
- |
- // Restore eax and go slow case. |
- __ bind(&undo); |
- __ mov(eax, Operand(edx)); |
- |
- // Handle the slow case by jumping to the JavaScript builtin. |
- __ bind(&slow); |
- __ pop(ecx); // pop return address. |
- __ push(eax); |
- __ push(ecx); // push return address |
- switch (op_) { |
- case Token::SUB: |
- __ InvokeBuiltin(Builtins::UNARY_MINUS, JUMP_FUNCTION); |
- break; |
- case Token::BIT_NOT: |
- __ InvokeBuiltin(Builtins::BIT_NOT, JUMP_FUNCTION); |
- break; |
- default: |
- UNREACHABLE(); |
- } |
-} |
- |
- |
void MathPowStub::Generate(MacroAssembler* masm) { |
// Registers are used as follows: |
// edx = base |