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

Unified Diff: src/crankshaft/ia32/lithium-codegen-ia32.cc

Issue 1841513003: [crankshaft] Address the deoptimization loops of Math.floor, Math.round and Math.ceil. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Register constraints in Crankshaft are fun Created 4 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 | « src/crankshaft/hydrogen-instructions.cc ('k') | src/crankshaft/ia32/lithium-ia32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/ia32/lithium-codegen-ia32.cc
diff --git a/src/crankshaft/ia32/lithium-codegen-ia32.cc b/src/crankshaft/ia32/lithium-codegen-ia32.cc
index 31c70a79bb24fc4c6b63443c37897d02c6c14b3f..436521ae1dd77be824bc32b7a2746e71b61c40a8 100644
--- a/src/crankshaft/ia32/lithium-codegen-ia32.cc
+++ b/src/crankshaft/ia32/lithium-codegen-ia32.cc
@@ -3177,8 +3177,14 @@ void LCodeGen::DoMathAbs(LMathAbs* instr) {
}
}
+void LCodeGen::DoMathFloorD(LMathFloorD* instr) {
+ XMMRegister output_reg = ToDoubleRegister(instr->result());
+ XMMRegister input_reg = ToDoubleRegister(instr->value());
+ CpuFeatureScope scope(masm(), SSE4_1);
+ __ roundsd(output_reg, input_reg, kRoundDown);
+}
-void LCodeGen::DoMathFloor(LMathFloor* instr) {
+void LCodeGen::DoMathFloorI(LMathFloorI* instr) {
XMMRegister xmm_scratch = double_scratch0();
Register output_reg = ToRegister(instr->result());
XMMRegister input_reg = ToDoubleRegister(instr->value());
@@ -3242,8 +3248,23 @@ void LCodeGen::DoMathFloor(LMathFloor* instr) {
}
}
+void LCodeGen::DoMathRoundD(LMathRoundD* instr) {
+ XMMRegister xmm_scratch = double_scratch0();
+ XMMRegister output_reg = ToDoubleRegister(instr->result());
+ XMMRegister input_reg = ToDoubleRegister(instr->value());
+ CpuFeatureScope scope(masm(), SSE4_1);
+ Label done;
+ __ roundsd(output_reg, input_reg, kRoundUp);
+ __ Move(xmm_scratch, -0.5);
+ __ addsd(xmm_scratch, output_reg);
+ __ ucomisd(xmm_scratch, input_reg);
+ __ j(below_equal, &done, Label::kNear);
+ __ Move(xmm_scratch, 1.0);
+ __ subsd(output_reg, xmm_scratch);
+ __ bind(&done);
+}
-void LCodeGen::DoMathRound(LMathRound* instr) {
+void LCodeGen::DoMathRoundI(LMathRoundI* instr) {
Register output_reg = ToRegister(instr->result());
XMMRegister input_reg = ToDoubleRegister(instr->value());
XMMRegister xmm_scratch = double_scratch0();
« no previous file with comments | « src/crankshaft/hydrogen-instructions.cc ('k') | src/crankshaft/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698