OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 | 739 |
740 // Tag the result as a smi and we're done. | 740 // Tag the result as a smi and we're done. |
741 STATIC_ASSERT(kSmiTagSize == 1); | 741 STATIC_ASSERT(kSmiTagSize == 1); |
742 __ lea(eax, Operand(ecx, times_2, kSmiTag)); | 742 __ lea(eax, Operand(ecx, times_2, kSmiTag)); |
743 __ ret(0); | 743 __ ret(0); |
744 | 744 |
745 // Try to store the result in a heap number. | 745 // Try to store the result in a heap number. |
746 __ bind(&try_float); | 746 __ bind(&try_float); |
747 if (mode_ == UNARY_NO_OVERWRITE) { | 747 if (mode_ == UNARY_NO_OVERWRITE) { |
748 Label slow_allocate_heapnumber, heapnumber_allocated; | 748 Label slow_allocate_heapnumber, heapnumber_allocated; |
| 749 __ mov(ebx, eax); |
749 __ AllocateHeapNumber(eax, edx, edi, &slow_allocate_heapnumber); | 750 __ AllocateHeapNumber(eax, edx, edi, &slow_allocate_heapnumber); |
750 __ jmp(&heapnumber_allocated); | 751 __ jmp(&heapnumber_allocated); |
751 | 752 |
752 __ bind(&slow_allocate_heapnumber); | 753 __ bind(&slow_allocate_heapnumber); |
753 __ EnterInternalFrame(); | 754 __ EnterInternalFrame(); |
754 __ push(ecx); | 755 // Push the original HeapNumber on the stack. The integer value can't |
| 756 // be stored since it's untagged and not in the smi range (so we can't |
| 757 // smi-tag it). We'll recalculate the value after the GC instead. |
| 758 __ push(ebx); |
755 __ CallRuntime(Runtime::kNumberAlloc, 0); | 759 __ CallRuntime(Runtime::kNumberAlloc, 0); |
756 __ pop(ecx); | 760 // New HeapNumber is in eax. |
| 761 __ pop(edx); |
757 __ LeaveInternalFrame(); | 762 __ LeaveInternalFrame(); |
| 763 // IntegerConvert uses ebx and edi as scratch registers. |
| 764 // This conversion won't go slow-case. |
| 765 IntegerConvert(masm, edx, CpuFeatures::IsSupported(SSE3), slow); |
| 766 __ not_(ecx); |
758 | 767 |
759 __ bind(&heapnumber_allocated); | 768 __ bind(&heapnumber_allocated); |
760 } | 769 } |
761 if (CpuFeatures::IsSupported(SSE2)) { | 770 if (CpuFeatures::IsSupported(SSE2)) { |
762 CpuFeatures::Scope use_sse2(SSE2); | 771 CpuFeatures::Scope use_sse2(SSE2); |
763 __ cvtsi2sd(xmm0, Operand(ecx)); | 772 __ cvtsi2sd(xmm0, Operand(ecx)); |
764 __ movdbl(FieldOperand(eax, HeapNumber::kValueOffset), xmm0); | 773 __ movdbl(FieldOperand(eax, HeapNumber::kValueOffset), xmm0); |
765 } else { | 774 } else { |
766 __ push(ecx); | 775 __ push(ecx); |
767 __ fild_s(Operand(esp, 0)); | 776 __ fild_s(Operand(esp, 0)); |
(...skipping 5384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6152 __ Drop(1); | 6161 __ Drop(1); |
6153 __ ret(2 * kPointerSize); | 6162 __ ret(2 * kPointerSize); |
6154 } | 6163 } |
6155 | 6164 |
6156 | 6165 |
6157 #undef __ | 6166 #undef __ |
6158 | 6167 |
6159 } } // namespace v8::internal | 6168 } } // namespace v8::internal |
6160 | 6169 |
6161 #endif // V8_TARGET_ARCH_IA32 | 6170 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |