Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: src/crankshaft/x64/lithium-codegen-x64.cc

Issue 2033413002: [crankshaft] Fix DoDeferredMathAbsTaggedHeapNumber overwriting the context with some temporary valu… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/crankshaft/x64/lithium-codegen-x64.h" 7 #include "src/crankshaft/x64/lithium-codegen-x64.h"
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 3249 matching lines...) Expand 10 before | Expand all | Expand 10 after
3260 } 3260 }
3261 3261
3262 3262
3263 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { 3263 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) {
3264 Register input_reg = ToRegister(instr->value()); 3264 Register input_reg = ToRegister(instr->value());
3265 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), 3265 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset),
3266 Heap::kHeapNumberMapRootIndex); 3266 Heap::kHeapNumberMapRootIndex);
3267 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber); 3267 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber);
3268 3268
3269 Label slow, allocated, done; 3269 Label slow, allocated, done;
3270 Register tmp = input_reg.is(rax) ? rcx : rax; 3270 uint32_t available_regs = 0xf;
3271 Register tmp2 = tmp.is(rcx) ? rdx : input_reg.is(rcx) ? rdx : rcx; 3271 if (input_reg.code() < 4) available_regs ^= input_reg.bit();
3272 if (instr->context()->IsRegister()) {
3273 // Make sure that the context isn't overwritten in the AllocateHeapNumber
3274 // macro below.
3275 Register context_reg = ToRegister(instr->context());
3276 if (context_reg.code() < 4) available_regs ^= context_reg.bit();
3277 }
3278
3279 Register tmp =
3280 Register::from_code(base::bits::CountTrailingZeros32(available_regs));
3281 available_regs ^= tmp.bit();
3282 Register tmp2 =
3283 Register::from_code(base::bits::CountTrailingZeros32(available_regs));
3272 3284
3273 // Preserve the value of all registers. 3285 // Preserve the value of all registers.
3274 PushSafepointRegistersScope scope(this); 3286 PushSafepointRegistersScope scope(this);
3275 3287
3276 __ movl(tmp, FieldOperand(input_reg, HeapNumber::kExponentOffset)); 3288 __ movl(tmp, FieldOperand(input_reg, HeapNumber::kExponentOffset));
3277 // Check the sign of the argument. If the argument is positive, just 3289 // Check the sign of the argument. If the argument is positive, just
3278 // return it. We do not need to patch the stack since |input| and 3290 // return it. We do not need to patch the stack since |input| and
3279 // |result| are the same register and |input| will be restored 3291 // |result| are the same register and |input| will be restored
3280 // unchanged by popping safepoint registers. 3292 // unchanged by popping safepoint registers.
3281 __ testl(tmp, Immediate(HeapNumber::kSignMask)); 3293 __ testl(tmp, Immediate(HeapNumber::kSignMask));
(...skipping 2332 matching lines...) Expand 10 before | Expand all | Expand 10 after
5614 __ bind(deferred->exit()); 5626 __ bind(deferred->exit());
5615 __ bind(&done); 5627 __ bind(&done);
5616 } 5628 }
5617 5629
5618 #undef __ 5630 #undef __
5619 5631
5620 } // namespace internal 5632 } // namespace internal
5621 } // namespace v8 5633 } // namespace v8
5622 5634
5623 #endif // V8_TARGET_ARCH_X64 5635 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698