OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1786 case Token::ADD: __ addsd(xmm0, xmm1); break; | 1786 case Token::ADD: __ addsd(xmm0, xmm1); break; |
1787 case Token::SUB: __ subsd(xmm0, xmm1); break; | 1787 case Token::SUB: __ subsd(xmm0, xmm1); break; |
1788 case Token::MUL: __ mulsd(xmm0, xmm1); break; | 1788 case Token::MUL: __ mulsd(xmm0, xmm1); break; |
1789 case Token::DIV: __ divsd(xmm0, xmm1); break; | 1789 case Token::DIV: __ divsd(xmm0, xmm1); break; |
1790 default: UNREACHABLE(); | 1790 default: UNREACHABLE(); |
1791 } | 1791 } |
1792 // Check result type if it is currently Int32. | 1792 // Check result type if it is currently Int32. |
1793 if (result_type_ <= BinaryOpIC::INT32) { | 1793 if (result_type_ <= BinaryOpIC::INT32) { |
1794 __ cvttsd2si(ecx, Operand(xmm0)); | 1794 __ cvttsd2si(ecx, Operand(xmm0)); |
1795 __ cvtsi2sd(xmm2, ecx); | 1795 __ cvtsi2sd(xmm2, ecx); |
1796 __ pcmpeqd(xmm2, xmm0); | 1796 __ ucomisd(xmm0, xmm2); |
1797 __ movmskpd(ecx, xmm2); | 1797 __ j(not_zero, ¬_int32); |
1798 __ test(ecx, Immediate(1)); | 1798 __ j(carry, ¬_int32); |
1799 __ j(zero, ¬_int32); | |
1800 } | 1799 } |
1801 GenerateHeapResultAllocation(masm, &call_runtime); | 1800 GenerateHeapResultAllocation(masm, &call_runtime); |
1802 __ movdbl(FieldOperand(eax, HeapNumber::kValueOffset), xmm0); | 1801 __ movdbl(FieldOperand(eax, HeapNumber::kValueOffset), xmm0); |
1803 __ ret(0); | 1802 __ ret(0); |
1804 } | 1803 } |
1805 } else { // SSE2 not available, use FPU. | 1804 } else { // SSE2 not available, use FPU. |
1806 FloatingPointHelper::CheckFloatOperands(masm, ¬_floats, ebx); | 1805 FloatingPointHelper::CheckFloatOperands(masm, ¬_floats, ebx); |
1807 FloatingPointHelper::LoadFloatOperands( | 1806 FloatingPointHelper::LoadFloatOperands( |
1808 masm, | 1807 masm, |
1809 ecx, | 1808 ecx, |
(...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3207 } | 3206 } |
3208 | 3207 |
3209 // Calculate power with integer exponent. | 3208 // Calculate power with integer exponent. |
3210 __ bind(&int_exponent); | 3209 __ bind(&int_exponent); |
3211 const XMMRegister double_scratch2 = double_exponent; | 3210 const XMMRegister double_scratch2 = double_exponent; |
3212 __ mov(scratch, exponent); // Back up exponent. | 3211 __ mov(scratch, exponent); // Back up exponent. |
3213 __ movsd(double_scratch, double_base); // Back up base. | 3212 __ movsd(double_scratch, double_base); // Back up base. |
3214 __ movsd(double_scratch2, double_result); // Load double_exponent with 1. | 3213 __ movsd(double_scratch2, double_result); // Load double_exponent with 1. |
3215 | 3214 |
3216 // Get absolute value of exponent. | 3215 // Get absolute value of exponent. |
3217 Label no_neg, while_true, while_false; | 3216 Label no_neg, while_true, no_multiply, while_false; |
3218 __ test(scratch, scratch); | 3217 __ test(scratch, scratch); |
3219 __ j(positive, &no_neg, Label::kNear); | 3218 __ j(positive, &no_neg, Label::kNear); |
3220 __ neg(scratch); | 3219 __ neg(scratch); |
3221 __ bind(&no_neg); | 3220 __ bind(&no_neg); |
3222 | 3221 |
3223 __ j(zero, &while_false, Label::kNear); | 3222 __ j(zero, &while_false, Label::kNear); |
3224 __ shr(scratch, 1); | 3223 __ shr(scratch, 1); |
3225 // Above condition means CF==0 && ZF==0. This means that the | 3224 // Above condition means CF==0 && ZF==0. This means that the |
3226 // bit that has been shifted out is 0 and the result is not 0. | 3225 // bit that has been shifted out is 0 and the result is not 0. |
3227 __ j(above, &while_true, Label::kNear); | 3226 __ j(above, &while_true, Label::kNear); |
(...skipping 3971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7199 RecordWriteStub stub(entry->object, | 7198 RecordWriteStub stub(entry->object, |
7200 entry->value, | 7199 entry->value, |
7201 entry->address, | 7200 entry->address, |
7202 entry->action, | 7201 entry->action, |
7203 kDontSaveFPRegs); | 7202 kDontSaveFPRegs); |
7204 stub.GetCode()->set_is_pregenerated(true); | 7203 stub.GetCode()->set_is_pregenerated(true); |
7205 } | 7204 } |
7206 } | 7205 } |
7207 | 7206 |
7208 | 7207 |
7209 bool CodeStub::CanUseFPRegisters() { | |
7210 return CpuFeatures::IsSupported(SSE2); | |
7211 } | |
7212 | |
7213 | |
7214 // Takes the input in 3 registers: address_ value_ and object_. A pointer to | 7208 // Takes the input in 3 registers: address_ value_ and object_. A pointer to |
7215 // the value has just been written into the object, now this stub makes sure | 7209 // the value has just been written into the object, now this stub makes sure |
7216 // we keep the GC informed. The word in the object where the value has been | 7210 // we keep the GC informed. The word in the object where the value has been |
7217 // written is in the address register. | 7211 // written is in the address register. |
7218 void RecordWriteStub::Generate(MacroAssembler* masm) { | 7212 void RecordWriteStub::Generate(MacroAssembler* masm) { |
7219 Label skip_to_incremental_noncompacting; | 7213 Label skip_to_incremental_noncompacting; |
7220 Label skip_to_incremental_compacting; | 7214 Label skip_to_incremental_compacting; |
7221 | 7215 |
7222 // The first two instructions are generated with labels so as to get the | 7216 // The first two instructions are generated with labels so as to get the |
7223 // offset fixed up correctly by the bind(Label*) call. We patch it back and | 7217 // offset fixed up correctly by the bind(Label*) call. We patch it back and |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7324 regs_.RestoreCallerSaveRegisters(masm, save_fp_regs_mode_); | 7318 regs_.RestoreCallerSaveRegisters(masm, save_fp_regs_mode_); |
7325 } | 7319 } |
7326 | 7320 |
7327 | 7321 |
7328 void RecordWriteStub::CheckNeedsToInformIncrementalMarker( | 7322 void RecordWriteStub::CheckNeedsToInformIncrementalMarker( |
7329 MacroAssembler* masm, | 7323 MacroAssembler* masm, |
7330 OnNoNeedToInformIncrementalMarker on_no_need, | 7324 OnNoNeedToInformIncrementalMarker on_no_need, |
7331 Mode mode) { | 7325 Mode mode) { |
7332 Label object_is_black, need_incremental, need_incremental_pop_object; | 7326 Label object_is_black, need_incremental, need_incremental_pop_object; |
7333 | 7327 |
7334 __ mov(regs_.scratch0(), Immediate(~Page::kPageAlignmentMask)); | |
7335 __ and_(regs_.scratch0(), regs_.object()); | |
7336 __ mov(regs_.scratch1(), | |
7337 Operand(regs_.scratch0(), | |
7338 MemoryChunk::kWriteBarrierCounterOffset)); | |
7339 __ sub(regs_.scratch1(), Immediate(1)); | |
7340 __ mov(Operand(regs_.scratch0(), | |
7341 MemoryChunk::kWriteBarrierCounterOffset), | |
7342 regs_.scratch1()); | |
7343 __ j(negative, &need_incremental); | |
7344 | |
7345 // Let's look at the color of the object: If it is not black we don't have | 7328 // Let's look at the color of the object: If it is not black we don't have |
7346 // to inform the incremental marker. | 7329 // to inform the incremental marker. |
7347 __ JumpIfBlack(regs_.object(), | 7330 __ JumpIfBlack(regs_.object(), |
7348 regs_.scratch0(), | 7331 regs_.scratch0(), |
7349 regs_.scratch1(), | 7332 regs_.scratch1(), |
7350 &object_is_black, | 7333 &object_is_black, |
7351 Label::kNear); | 7334 Label::kNear); |
7352 | 7335 |
7353 regs_.Restore(masm); | 7336 regs_.Restore(masm); |
7354 if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) { | 7337 if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) { |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7528 // Restore ecx. | 7511 // Restore ecx. |
7529 __ pop(ecx); | 7512 __ pop(ecx); |
7530 __ ret(0); | 7513 __ ret(0); |
7531 } | 7514 } |
7532 | 7515 |
7533 #undef __ | 7516 #undef __ |
7534 | 7517 |
7535 } } // namespace v8::internal | 7518 } } // namespace v8::internal |
7536 | 7519 |
7537 #endif // V8_TARGET_ARCH_IA32 | 7520 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |