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

Side by Side Diff: src/x64/lithium-codegen-x64.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 | « src/ia32/lithium-codegen-ia32.cc ('k') | test/mjsunit/mjsunit.status » ('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 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/x64/lithium-codegen-x64.h" 9 #include "src/x64/lithium-codegen-x64.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 __ sarl(dividend, Immediate(shift)); 1127 __ sarl(dividend, Immediate(shift));
1128 return; 1128 return;
1129 } 1129 }
1130 1130
1131 // If the divisor is negative, we have to negate and handle edge cases. 1131 // If the divisor is negative, we have to negate and handle edge cases.
1132 __ negl(dividend); 1132 __ negl(dividend);
1133 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 1133 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1134 DeoptimizeIf(zero, instr->environment()); 1134 DeoptimizeIf(zero, instr->environment());
1135 } 1135 }
1136 1136
1137 // Dividing by -1 is basically negation, unless we overflow.
1138 if (divisor == -1) {
1139 if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
1140 DeoptimizeIf(overflow, instr->environment());
1141 }
1142 return;
1143 }
1144
1137 // If the negation could not overflow, simply shifting is OK. 1145 // If the negation could not overflow, simply shifting is OK.
1138 if (!instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) { 1146 if (!instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
1139 __ sarl(dividend, Immediate(shift)); 1147 __ sarl(dividend, Immediate(shift));
1140 return; 1148 return;
1141 } 1149 }
1142 1150
1143 // Note that we could emit branch-free code, but that would need one more
1144 // register.
1145 if (divisor == -1) {
1146 DeoptimizeIf(overflow, instr->environment());
1147 return;
1148 }
1149
1150 Label not_kmin_int, done; 1151 Label not_kmin_int, done;
1151 __ j(no_overflow, &not_kmin_int, Label::kNear); 1152 __ j(no_overflow, &not_kmin_int, Label::kNear);
1152 __ movl(dividend, Immediate(kMinInt / divisor)); 1153 __ movl(dividend, Immediate(kMinInt / divisor));
1153 __ jmp(&done, Label::kNear); 1154 __ jmp(&done, Label::kNear);
1154 __ bind(&not_kmin_int); 1155 __ bind(&not_kmin_int);
1155 __ sarl(dividend, Immediate(shift)); 1156 __ sarl(dividend, Immediate(shift));
1156 __ bind(&done); 1157 __ bind(&done);
1157 } 1158 }
1158 1159
1159 1160
(...skipping 4577 matching lines...) Expand 10 before | Expand all | Expand 10 after
5737 CallRuntime(Runtime::kHiddenPushBlockContext, 2, instr); 5738 CallRuntime(Runtime::kHiddenPushBlockContext, 2, instr);
5738 RecordSafepoint(Safepoint::kNoLazyDeopt); 5739 RecordSafepoint(Safepoint::kNoLazyDeopt);
5739 } 5740 }
5740 5741
5741 5742
5742 #undef __ 5743 #undef __
5743 5744
5744 } } // namespace v8::internal 5745 } } // namespace v8::internal
5745 5746
5746 #endif // V8_TARGET_ARCH_X64 5747 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698