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

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

Issue 12342037: Handle negative input in inlined Math.round on Intel CPUs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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 | « src/x64/lithium-codegen-x64.cc ('k') | test/mjsunit/regress/regress-2451.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/lithium-x64.cc
diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc
index 1075b2ed0ea52f255ea3cd01873db76f12c74fb3..7d680ae1d227683076373c9f5d2da33f62305005 100644
--- a/src/x64/lithium-x64.cc
+++ b/src/x64/lithium-x64.cc
@@ -1084,7 +1084,16 @@ LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
LMathExp* result = new(zone()) LMathExp(value, temp1, temp2);
return DefineAsRegister(result);
} else {
- LOperand* input = UseRegisterAtStart(instr->value());
+ LOperand* input;
+ if (op == kMathRound &&
+ (!CpuFeatures::IsSupported(SSE4_1) ||
+ instr->CheckFlag(HValue::kBailoutOnMinusZero))) {
+ // Math.round implemented without roundsd. Input may be overwritten.
+ ASSERT(instr->value()->representation().IsDouble());
+ input = UseTempRegister(instr->value());
+ } else {
+ input = UseRegisterAtStart(instr->value());
+ }
LUnaryMathOperation* result = new(zone()) LUnaryMathOperation(input);
switch (op) {
case kMathAbs:
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | test/mjsunit/regress/regress-2451.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698