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 2244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2255 | 2255 |
2256 // Calculate power with integer exponent. | 2256 // Calculate power with integer exponent. |
2257 __ bind(&int_exponent); | 2257 __ bind(&int_exponent); |
2258 const XMMRegister double_scratch2 = double_exponent; | 2258 const XMMRegister double_scratch2 = double_exponent; |
2259 // Back up exponent as we need to check if exponent is negative later. | 2259 // Back up exponent as we need to check if exponent is negative later. |
2260 __ movq(scratch, exponent); // Back up exponent. | 2260 __ movq(scratch, exponent); // Back up exponent. |
2261 __ movsd(double_scratch, double_base); // Back up base. | 2261 __ movsd(double_scratch, double_base); // Back up base. |
2262 __ movsd(double_scratch2, double_result); // Load double_exponent with 1. | 2262 __ movsd(double_scratch2, double_result); // Load double_exponent with 1. |
2263 | 2263 |
2264 // Get absolute value of exponent. | 2264 // Get absolute value of exponent. |
2265 Label no_neg, while_true, while_false; | 2265 Label no_neg, while_true, no_multiply; |
2266 __ testl(scratch, scratch); | 2266 __ testl(scratch, scratch); |
2267 __ j(positive, &no_neg, Label::kNear); | 2267 __ j(positive, &no_neg, Label::kNear); |
2268 __ negl(scratch); | 2268 __ negl(scratch); |
2269 __ bind(&no_neg); | 2269 __ bind(&no_neg); |
2270 | 2270 |
2271 __ j(zero, &while_false, Label::kNear); | |
2272 __ shrl(scratch, Immediate(1)); | |
2273 // Above condition means CF==0 && ZF==0. This means that the | |
2274 // bit that has been shifted out is 0 and the result is not 0. | |
2275 __ j(above, &while_true, Label::kNear); | |
2276 __ movsd(double_result, double_scratch); | |
2277 __ j(zero, &while_false, Label::kNear); | |
2278 | |
2279 __ bind(&while_true); | 2271 __ bind(&while_true); |
2280 __ shrl(scratch, Immediate(1)); | 2272 __ shrl(scratch, Immediate(1)); |
| 2273 __ j(not_carry, &no_multiply, Label::kNear); |
| 2274 __ mulsd(double_result, double_scratch); |
| 2275 __ bind(&no_multiply); |
| 2276 |
2281 __ mulsd(double_scratch, double_scratch); | 2277 __ mulsd(double_scratch, double_scratch); |
2282 __ j(above, &while_true, Label::kNear); | |
2283 __ mulsd(double_result, double_scratch); | |
2284 __ j(not_zero, &while_true); | 2278 __ j(not_zero, &while_true); |
2285 | 2279 |
2286 __ bind(&while_false); | |
2287 // If the exponent is negative, return 1/result. | 2280 // If the exponent is negative, return 1/result. |
2288 __ testl(exponent, exponent); | 2281 __ testl(exponent, exponent); |
2289 __ j(greater, &done); | 2282 __ j(greater, &done); |
2290 __ divsd(double_scratch2, double_result); | 2283 __ divsd(double_scratch2, double_result); |
2291 __ movsd(double_result, double_scratch2); | 2284 __ movsd(double_result, double_scratch2); |
2292 // Test whether result is zero. Bail out to check for subnormal result. | 2285 // Test whether result is zero. Bail out to check for subnormal result. |
2293 // Due to subnormals, x^-y == (1/x)^y does not hold in all cases. | 2286 // Due to subnormals, x^-y == (1/x)^y does not hold in all cases. |
2294 __ xorps(double_scratch2, double_scratch2); | 2287 __ xorps(double_scratch2, double_scratch2); |
2295 __ ucomisd(double_scratch2, double_result); | 2288 __ ucomisd(double_scratch2, double_result); |
2296 // double_exponent aliased as double_scratch2 has already been overwritten | 2289 // double_exponent aliased as double_scratch2 has already been overwritten |
(...skipping 3840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6137 RecordWriteStub stub(entry->object, | 6130 RecordWriteStub stub(entry->object, |
6138 entry->value, | 6131 entry->value, |
6139 entry->address, | 6132 entry->address, |
6140 entry->action, | 6133 entry->action, |
6141 kDontSaveFPRegs); | 6134 kDontSaveFPRegs); |
6142 stub.GetCode()->set_is_pregenerated(true); | 6135 stub.GetCode()->set_is_pregenerated(true); |
6143 } | 6136 } |
6144 } | 6137 } |
6145 | 6138 |
6146 | 6139 |
6147 bool CodeStub::CanUseFPRegisters() { | |
6148 return true; // Always have SSE2 on x64. | |
6149 } | |
6150 | |
6151 | |
6152 // Takes the input in 3 registers: address_ value_ and object_. A pointer to | 6140 // Takes the input in 3 registers: address_ value_ and object_. A pointer to |
6153 // the value has just been written into the object, now this stub makes sure | 6141 // the value has just been written into the object, now this stub makes sure |
6154 // we keep the GC informed. The word in the object where the value has been | 6142 // we keep the GC informed. The word in the object where the value has been |
6155 // written is in the address register. | 6143 // written is in the address register. |
6156 void RecordWriteStub::Generate(MacroAssembler* masm) { | 6144 void RecordWriteStub::Generate(MacroAssembler* masm) { |
6157 Label skip_to_incremental_noncompacting; | 6145 Label skip_to_incremental_noncompacting; |
6158 Label skip_to_incremental_compacting; | 6146 Label skip_to_incremental_compacting; |
6159 | 6147 |
6160 // The first two instructions are generated with labels so as to get the | 6148 // The first two instructions are generated with labels so as to get the |
6161 // offset fixed up correctly by the bind(Label*) call. We patch it back and | 6149 // offset fixed up correctly by the bind(Label*) call. We patch it back and |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6274 | 6262 |
6275 | 6263 |
6276 void RecordWriteStub::CheckNeedsToInformIncrementalMarker( | 6264 void RecordWriteStub::CheckNeedsToInformIncrementalMarker( |
6277 MacroAssembler* masm, | 6265 MacroAssembler* masm, |
6278 OnNoNeedToInformIncrementalMarker on_no_need, | 6266 OnNoNeedToInformIncrementalMarker on_no_need, |
6279 Mode mode) { | 6267 Mode mode) { |
6280 Label on_black; | 6268 Label on_black; |
6281 Label need_incremental; | 6269 Label need_incremental; |
6282 Label need_incremental_pop_object; | 6270 Label need_incremental_pop_object; |
6283 | 6271 |
6284 __ movq(regs_.scratch0(), Immediate(~Page::kPageAlignmentMask)); | |
6285 __ and_(regs_.scratch0(), regs_.object()); | |
6286 __ movq(regs_.scratch1(), | |
6287 Operand(regs_.scratch0(), | |
6288 MemoryChunk::kWriteBarrierCounterOffset)); | |
6289 __ subq(regs_.scratch1(), Immediate(1)); | |
6290 __ movq(Operand(regs_.scratch0(), | |
6291 MemoryChunk::kWriteBarrierCounterOffset), | |
6292 regs_.scratch1()); | |
6293 __ j(negative, &need_incremental); | |
6294 | |
6295 // Let's look at the color of the object: If it is not black we don't have | 6272 // Let's look at the color of the object: If it is not black we don't have |
6296 // to inform the incremental marker. | 6273 // to inform the incremental marker. |
6297 __ JumpIfBlack(regs_.object(), | 6274 __ JumpIfBlack(regs_.object(), |
6298 regs_.scratch0(), | 6275 regs_.scratch0(), |
6299 regs_.scratch1(), | 6276 regs_.scratch1(), |
6300 &on_black, | 6277 &on_black, |
6301 Label::kNear); | 6278 Label::kNear); |
6302 | 6279 |
6303 regs_.Restore(masm); | 6280 regs_.Restore(masm); |
6304 if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) { | 6281 if (on_no_need == kUpdateRememberedSetOnNoNeedToInformIncrementalMarker) { |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6505 #endif | 6482 #endif |
6506 | 6483 |
6507 __ Ret(); | 6484 __ Ret(); |
6508 } | 6485 } |
6509 | 6486 |
6510 #undef __ | 6487 #undef __ |
6511 | 6488 |
6512 } } // namespace v8::internal | 6489 } } // namespace v8::internal |
6513 | 6490 |
6514 #endif // V8_TARGET_ARCH_X64 | 6491 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |