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

Unified Diff: src/arm/lithium-arm.cc

Issue 6665006: Reduce strength of ModI for power-of-2 divisor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: port to arm and x64 Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/arm/lithium-codegen-arm.cc » ('j') | src/arm/lithium-codegen-arm.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/lithium-arm.cc
diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc
index c5b0c1dfae9c209507cfba7059a532f67cbd86a1..fb7c103a908cdcaaca468dddf48ee0720e4a9ffa 100644
--- a/src/arm/lithium-arm.cc
+++ b/src/arm/lithium-arm.cc
@@ -1350,10 +1350,21 @@ LInstruction* LChunkBuilder::DoMod(HMod* instr) {
// when we provide a native implementation.
ASSERT(instr->left()->representation().IsInteger32());
ASSERT(instr->right()->representation().IsInteger32());
- LOperand* value = UseFixed(instr->left(), r0);
- LOperand* divisor = UseFixed(instr->right(), r1);
- LInstruction* result = DefineFixed(new LModI(value, divisor), r0);
- result = AssignEnvironment(AssignPointerMap(result));
+
+ LInstruction* result;
+ if (instr->HasPowerOf2Divisor()) {
+ ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero));
+ LOperand* value = UseRegisterAtStart(instr->left());
+ LModI* mod = new LModI(value, UseOrConstant(instr->right()));
+ result = DefineSameAsFirst(mod);
+ result = AssignEnvironment(result);
+ } else {
+ LOperand* value = UseFixed(instr->left(), r0);
+ LOperand* divisor = UseFixed(instr->right(), r1);
+ result = DefineFixed(new LModI(value, divisor), r0);
+ result = AssignEnvironment(AssignPointerMap(result));
+ }
+
return result;
} else if (instr->representation().IsTagged()) {
return DoArithmeticT(Token::MOD, instr);
« no previous file with comments | « no previous file | src/arm/lithium-codegen-arm.cc » ('j') | src/arm/lithium-codegen-arm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698