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

Unified Diff: runtime/vm/intermediate_language_x64.cc

Issue 616873003: Use UnboxedInt32 and UnboxedUint32 representation for LoadIndexedInstr (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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_x64.cc
diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc
index 9c4fe357c896ffd58f84ce96829f7e123fefbd4e..fe361b20cff8359a8cc4c96ecae7e500574e9088 100644
--- a/runtime/vm/intermediate_language_x64.cc
+++ b/runtime/vm/intermediate_language_x64.cc
@@ -968,9 +968,11 @@ Representation LoadIndexedInstr::representation() const {
case kTypedDataUint16ArrayCid:
case kOneByteStringCid:
case kTwoByteStringCid:
+ return kTagged;
case kTypedDataInt32ArrayCid:
+ return kUnboxedInt32;
case kTypedDataUint32ArrayCid:
- return kTagged;
+ return kUnboxedUint32;
case kTypedDataFloat32ArrayCid:
case kTypedDataFloat64ArrayCid:
return kUnboxedDouble;
@@ -1052,6 +1054,29 @@ void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
return;
}
+ if ((representation() == kUnboxedUint32) ||
+ (representation() == kUnboxedInt32)) {
+ if ((index_scale() == 1) && index.IsRegister()) {
+ __ SmiUntag(index.reg());
+ }
+ Register result = locs()->out(0).reg();
+ switch (class_id()) {
+ case kTypedDataInt32ArrayCid:
+ ASSERT(representation() == kUnboxedInt32);
+ __ movsxd(result, element_address);
+ break;
+ case kTypedDataUint32ArrayCid:
+ ASSERT(representation() == kUnboxedUint32);
+ __ movl(result, element_address);
+ break;
+ default:
+ UNREACHABLE();
+ }
+ return;
+ }
+
+ ASSERT(representation() == kTagged);
+
if ((index_scale() == 1) && index.IsRegister()) {
__ SmiUntag(index.reg());
}
@@ -1078,14 +1103,6 @@ void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ movzxw(result, element_address);
__ SmiTag(result);
break;
- case kTypedDataInt32ArrayCid:
- __ movsxd(result, element_address);
- __ SmiTag(result);
- break;
- case kTypedDataUint32ArrayCid:
- __ movl(result, element_address);
- __ SmiTag(result);
- break;
default:
ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid));
__ movq(result, element_address);
@@ -4629,7 +4646,23 @@ void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
-DEFINE_UNIMPLEMENTED_INSTRUCTION(Int32ToDoubleInstr)
+LocationSummary* Int32ToDoubleInstr::MakeLocationSummary(Isolate* isolate,
+ bool opt) const {
+ const intptr_t kNumInputs = 1;
+ const intptr_t kNumTemps = 0;
+ LocationSummary* result = new(isolate) LocationSummary(
+ isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ result->set_in(0, Location::RequiresRegister());
+ result->set_out(0, Location::RequiresFpuRegister());
+ return result;
+}
+
+
+void Int32ToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ Register value = locs()->in(0).reg();
+ FpuRegister result = locs()->out(0).fpu_reg();
+ __ cvtsi2sd32(result, value);
+}
LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Isolate* isolate,

Powered by Google App Engine
This is Rietveld 408576698