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

Unified Diff: runtime/vm/intermediate_language_ia32.cc

Issue 2423843002: Add DoubleTestOp instruction (Closed)
Patch Set: Cleanup Created 4 years, 2 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
Index: runtime/vm/intermediate_language_ia32.cc
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index 50027124042b40695299f94bd3dcdf134f4bdeb6..4ee2d4f48c047b95ddc0300e80fcf002a2626f3c 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -3899,6 +3899,56 @@ void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
+LocationSummary* DoubleTestOpInstr::MakeLocationSummary(Zone* zone,
+ bool opt) const {
+ const intptr_t kNumInputs = 1;
+ const intptr_t kNumTemps = 0;
+ LocationSummary* summary = new(zone) LocationSummary(
+ zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ summary->set_in(0, Location::RequiresFpuRegister());
+ summary->set_out(0, Location::RequiresRegister());
+ return summary;
+}
+
+
+void DoubleTestOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ ASSERT(compiler->is_optimizing());
+ const XmmRegister value = locs()->in(0).fpu_reg();
+ const Register result = locs()->out(0).reg();
+ if (op_kind() == MethodRecognizer::kDoubleIsNaN) {
+ Label is_nan;
+ __ LoadObject(result, Bool::True());
+ __ comisd(value, value);
+ __ j(PARITY_EVEN, &is_nan, Assembler::kNearJump);
+ __ LoadObject(result, Bool::False());
+ __ Bind(&is_nan);
+ } else {
+ ASSERT(op_kind() == MethodRecognizer::kDoubleIsInfinite);
+ Label not_inf, done;
+ __ AddImmediate(ESP, Immediate(-8));
Florian Schneider 2016/10/18 20:34:20 s/-8/-kDoubleSize/
zra 2016/10/18 22:36:32 Done.
+ __ movsd(Address(ESP, 0), value);
+ __ movl(result, Address(ESP, 0));
+ // If the low word isn't zero, then it isn't infinity.
+ __ cmpl(result, Immediate(0));
+ __ j(NOT_EQUAL, &not_inf, Assembler::kNearJump);
+ // Check the high word.
+ __ movl(result, Address(ESP, kWordSize));
+ // Mask off sign bit.
+ __ andl(result, Immediate(0x7FFFFFFF));
+ // Compare with +infinity.
+ __ cmpl(result, Immediate(0x7FF00000));
+ __ j(NOT_EQUAL, &not_inf, Assembler::kNearJump);
+ __ LoadObject(result, Bool::True());
+ __ jmp(&done);
+
+ __ Bind(&not_inf);
+ __ LoadObject(result, Bool::False());
+ __ Bind(&done);
+ __ AddImmediate(ESP, Immediate(8));
+ }
+}
+
+
LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
const intptr_t kNumInputs = 2;

Powered by Google App Engine
This is Rietveld 408576698