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

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

Issue 324403003: Fixed flooring division by a power of 2, once again... (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | 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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arm/lithium-codegen-arm.h" 7 #include "src/arm/lithium-codegen-arm.h"
8 #include "src/arm/lithium-gap-resolver-arm.h" 8 #include "src/arm/lithium-gap-resolver-arm.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/stub-cache.h" 10 #include "src/stub-cache.h"
(...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 __ mov(result, Operand(dividend, ASR, shift)); 1462 __ mov(result, Operand(dividend, ASR, shift));
1463 return; 1463 return;
1464 } 1464 }
1465 1465
1466 // If the divisor is negative, we have to negate and handle edge cases. 1466 // If the divisor is negative, we have to negate and handle edge cases.
1467 __ rsb(result, dividend, Operand::Zero(), SetCC); 1467 __ rsb(result, dividend, Operand::Zero(), SetCC);
1468 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 1468 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1469 DeoptimizeIf(eq, instr->environment()); 1469 DeoptimizeIf(eq, instr->environment());
1470 } 1470 }
1471 1471
1472 // Dividing by -1 is basically negation, unless we overflow.
1473 if (divisor == -1) {
1474 if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
1475 DeoptimizeIf(vs, instr->environment());
1476 }
1477 return;
1478 }
1479
1472 // If the negation could not overflow, simply shifting is OK. 1480 // If the negation could not overflow, simply shifting is OK.
1473 if (!instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) { 1481 if (!instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
1474 __ mov(result, Operand(dividend, ASR, shift)); 1482 __ mov(result, Operand(result, ASR, shift));
1475 return;
1476 }
1477
1478 // Dividing by -1 is basically negation, unless we overflow.
1479 if (divisor == -1) {
1480 DeoptimizeIf(vs, instr->environment());
1481 return; 1483 return;
1482 } 1484 }
1483 1485
1484 __ mov(result, Operand(kMinInt / divisor), LeaveCC, vs); 1486 __ mov(result, Operand(kMinInt / divisor), LeaveCC, vs);
1485 __ mov(result, Operand(dividend, ASR, shift), LeaveCC, vc); 1487 __ mov(result, Operand(result, ASR, shift), LeaveCC, vc);
1486 } 1488 }
1487 1489
1488 1490
1489 void LCodeGen::DoFlooringDivByConstI(LFlooringDivByConstI* instr) { 1491 void LCodeGen::DoFlooringDivByConstI(LFlooringDivByConstI* instr) {
1490 Register dividend = ToRegister(instr->dividend()); 1492 Register dividend = ToRegister(instr->dividend());
1491 int32_t divisor = instr->divisor(); 1493 int32_t divisor = instr->divisor();
1492 Register result = ToRegister(instr->result()); 1494 Register result = ToRegister(instr->result());
1493 ASSERT(!dividend.is(result)); 1495 ASSERT(!dividend.is(result));
1494 1496
1495 if (divisor == 0) { 1497 if (divisor == 0) {
(...skipping 4335 matching lines...) Expand 10 before | Expand all | Expand 10 after
5831 __ Push(scope_info); 5833 __ Push(scope_info);
5832 __ push(ToRegister(instr->function())); 5834 __ push(ToRegister(instr->function()));
5833 CallRuntime(Runtime::kHiddenPushBlockContext, 2, instr); 5835 CallRuntime(Runtime::kHiddenPushBlockContext, 2, instr);
5834 RecordSafepoint(Safepoint::kNoLazyDeopt); 5836 RecordSafepoint(Safepoint::kNoLazyDeopt);
5835 } 5837 }
5836 5838
5837 5839
5838 #undef __ 5840 #undef __
5839 5841
5840 } } // namespace v8::internal 5842 } } // 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