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

Unified Diff: runtime/vm/intermediate_language_ia32.cc

Issue 2423843002: Add DoubleTestOp instruction (Closed)
Patch Set: Address comments 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
« no previous file with comments | « runtime/vm/intermediate_language_dbc.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..965cbeb998a3e88ec3f6c74134b69479a7ef7662 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::kDouble_getIsNaN) {
+ 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::kDouble_getIsInfinite);
+ Label not_inf, done;
+ __ AddImmediate(ESP, Immediate(-kDoubleSize));
+ __ 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(kDoubleSize));
+ }
+}
+
+
LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
const intptr_t kNumInputs = 2;
« no previous file with comments | « runtime/vm/intermediate_language_dbc.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698