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

Side by Side Diff: src/ia32/lithium-codegen-ia32.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/arm64/lithium-codegen-arm64.cc ('k') | src/x64/lithium-codegen-x64.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 #if V8_TARGET_ARCH_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/ia32/lithium-codegen-ia32.h" 9 #include "src/ia32/lithium-codegen-ia32.h"
10 #include "src/ic.h" 10 #include "src/ic.h"
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 __ sar(dividend, shift); 1346 __ sar(dividend, shift);
1347 return; 1347 return;
1348 } 1348 }
1349 1349
1350 // If the divisor is negative, we have to negate and handle edge cases. 1350 // If the divisor is negative, we have to negate and handle edge cases.
1351 __ neg(dividend); 1351 __ neg(dividend);
1352 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 1352 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
1353 DeoptimizeIf(zero, instr->environment()); 1353 DeoptimizeIf(zero, instr->environment());
1354 } 1354 }
1355 1355
1356 // Dividing by -1 is basically negation, unless we overflow.
1357 if (divisor == -1) {
1358 if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
1359 DeoptimizeIf(overflow, instr->environment());
1360 }
1361 return;
1362 }
1363
1364 // If the negation could not overflow, simply shifting is OK.
1356 if (!instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) { 1365 if (!instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
1357 __ sar(dividend, shift); 1366 __ sar(dividend, shift);
1358 return; 1367 return;
1359 } 1368 }
1360 1369
1361 // Dividing by -1 is basically negation, unless we overflow.
1362 if (divisor == -1) {
1363 DeoptimizeIf(overflow, instr->environment());
1364 return;
1365 }
1366
1367 Label not_kmin_int, done; 1370 Label not_kmin_int, done;
1368 __ j(no_overflow, &not_kmin_int, Label::kNear); 1371 __ j(no_overflow, &not_kmin_int, Label::kNear);
1369 __ mov(dividend, Immediate(kMinInt / divisor)); 1372 __ mov(dividend, Immediate(kMinInt / divisor));
1370 __ jmp(&done, Label::kNear); 1373 __ jmp(&done, Label::kNear);
1371 __ bind(&not_kmin_int); 1374 __ bind(&not_kmin_int);
1372 __ sar(dividend, shift); 1375 __ sar(dividend, shift);
1373 __ bind(&done); 1376 __ bind(&done);
1374 } 1377 }
1375 1378
1376 1379
(...skipping 4282 matching lines...) Expand 10 before | Expand all | Expand 10 after
5659 CallRuntime(Runtime::kHiddenPushBlockContext, 2, instr); 5662 CallRuntime(Runtime::kHiddenPushBlockContext, 2, instr);
5660 RecordSafepoint(Safepoint::kNoLazyDeopt); 5663 RecordSafepoint(Safepoint::kNoLazyDeopt);
5661 } 5664 }
5662 5665
5663 5666
5664 #undef __ 5667 #undef __
5665 5668
5666 } } // namespace v8::internal 5669 } } // namespace v8::internal
5667 5670
5668 #endif // V8_TARGET_ARCH_IA32 5671 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm64/lithium-codegen-arm64.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698