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

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 280883003: Fix FlooringDivByPowerOf2I on ARM/ARM64 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/arm64/lithium-codegen-arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "arm/lithium-codegen-arm.h" 7 #include "arm/lithium-codegen-arm.h"
8 #include "arm/lithium-gap-resolver-arm.h" 8 #include "arm/lithium-gap-resolver-arm.h"
9 #include "code-stubs.h" 9 #include "code-stubs.h"
10 #include "stub-cache.h" 10 #include "stub-cache.h"
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 1428
1429 __ vmls(minuend, multiplier, multiplicand); 1429 __ vmls(minuend, multiplier, multiplicand);
1430 } 1430 }
1431 1431
1432 1432
1433 void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) { 1433 void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) {
1434 Register dividend = ToRegister(instr->dividend()); 1434 Register dividend = ToRegister(instr->dividend());
1435 Register result = ToRegister(instr->result()); 1435 Register result = ToRegister(instr->result());
1436 int32_t divisor = instr->divisor(); 1436 int32_t divisor = instr->divisor();
1437 1437
1438 // If the divisor is 1, return the dividend.
1439 if (divisor == 1) {
1440 __ Move(result, dividend);
1441 return;
1442 }
1443
1438 // If the divisor is positive, things are easy: There can be no deopts and we 1444 // If the divisor is positive, things are easy: There can be no deopts and we
1439 // can simply do an arithmetic right shift. 1445 // can simply do an arithmetic right shift.
1440 if (divisor == 1) return;
1441 int32_t shift = WhichPowerOf2Abs(divisor); 1446 int32_t shift = WhichPowerOf2Abs(divisor);
1442 if (divisor > 1) { 1447 if (divisor > 1) {
1443 __ mov(result, Operand(dividend, ASR, shift)); 1448 __ mov(result, Operand(dividend, ASR, shift));
1444 return; 1449 return;
1445 } 1450 }
1446 1451
1447 // If the divisor is negative, we have to negate and handle edge cases. 1452 // If the divisor is negative, we have to negate and handle edge cases.
1448 __ rsb(result, dividend, Operand::Zero(), SetCC); 1453 __ rsb(result, dividend, Operand::Zero(), SetCC);
1449 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 1454 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1450 DeoptimizeIf(eq, instr->environment()); 1455 DeoptimizeIf(eq, instr->environment());
(...skipping 4402 matching lines...) Expand 10 before | Expand all | Expand 10 after
5853 __ ldr(result, FieldMemOperand(scratch, 5858 __ ldr(result, FieldMemOperand(scratch,
5854 FixedArray::kHeaderSize - kPointerSize)); 5859 FixedArray::kHeaderSize - kPointerSize));
5855 __ bind(deferred->exit()); 5860 __ bind(deferred->exit());
5856 __ bind(&done); 5861 __ bind(&done);
5857 } 5862 }
5858 5863
5859 5864
5860 #undef __ 5865 #undef __
5861 5866
5862 } } // namespace v8::internal 5867 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/arm64/lithium-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698