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

Unified Diff: runtime/vm/intermediate_language_x64.cc

Issue 264953004: For nullable/double typed fields compare with null for deoptimization, else assume double. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 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_mips.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_x64.cc
===================================================================
--- runtime/vm/intermediate_language_x64.cc (revision 35689)
+++ runtime/vm/intermediate_language_x64.cc (working copy)
@@ -3165,7 +3165,8 @@
void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- const intptr_t value_cid = value()->Type()->ToCid();
+ CompileType* value_type = value()->Type();
+ const intptr_t value_cid = value_type->ToCid();
const Register value = locs()->in(0).reg();
const XmmRegister result = locs()->out(0).fpu_reg();
@@ -3177,17 +3178,27 @@
} else {
Label* deopt = compiler->AddDeoptStub(deopt_id_,
ICData::kDeoptBinaryDoubleOp);
- Label is_smi, done;
- __ testq(value, Immediate(kSmiTagMask));
- __ j(ZERO, &is_smi);
- __ CompareClassId(value, kDoubleCid);
- __ j(NOT_EQUAL, deopt);
- __ movsd(result, FieldAddress(value, Double::value_offset()));
- __ jmp(&done);
- __ Bind(&is_smi);
- __ SmiUntag(value);
- __ cvtsi2sd(result, value);
- __ Bind(&done);
+ if (value_type->is_nullable() &&
+ (value_type->ToNullableCid() == kDoubleCid)) {
+ const Immediate& raw_null =
+ Immediate(reinterpret_cast<intptr_t>(Object::null()));
+ __ cmpq(value, raw_null);
+ __ j(EQUAL, deopt);
+ // It must be double now.
+ __ movsd(result, FieldAddress(value, Double::value_offset()));
+ } else {
+ Label is_smi, done;
+ __ testq(value, Immediate(kSmiTagMask));
+ __ j(ZERO, &is_smi);
+ __ CompareClassId(value, kDoubleCid);
+ __ j(NOT_EQUAL, deopt);
+ __ movsd(result, FieldAddress(value, Double::value_offset()));
+ __ jmp(&done);
+ __ Bind(&is_smi);
+ __ SmiUntag(value);
+ __ cvtsi2sd(result, value);
+ __ Bind(&done);
+ }
}
}
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698