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

Unified Diff: runtime/vm/intermediate_language_x64.cc

Issue 10911214: Split array loads/stores for growable arrays into two IL instructions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: addressed comments Created 8 years, 3 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_ia32.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 12196)
+++ runtime/vm/intermediate_language_x64.cc (working copy)
@@ -882,112 +882,51 @@
LocationSummary* LoadIndexedInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 2;
- if (receiver_type() == kGrowableObjectArrayCid) {
- const intptr_t kNumTemps = 1;
- LocationSummary* locs =
- new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
- locs->set_in(0, Location::RequiresRegister());
- locs->set_in(1, Location::RequiresRegister());
- locs->set_temp(0, Location::RequiresRegister());
- locs->set_out(Location::RequiresRegister());
- return locs;
- } else {
- ASSERT((receiver_type() == kArrayCid) ||
- (receiver_type() == kImmutableArrayCid));
- return LocationSummary::Make(kNumInputs,
- Location::RequiresRegister(),
- LocationSummary::kNoCall);
- }
+ return LocationSummary::Make(kNumInputs,
+ Location::RequiresRegister(),
+ LocationSummary::kNoCall);
}
void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- Register receiver = locs()->in(0).reg();
+ Register array = locs()->in(0).reg();
Register index = locs()->in(1).reg();
Register result = locs()->out().reg();
- switch (receiver_type()) {
- case kArrayCid:
- case kImmutableArrayCid:
- // Note that index is Smi, i.e, times 4.
- ASSERT(kSmiTagShift == 1);
- __ movq(result, FieldAddress(receiver, index, TIMES_4, sizeof(RawArray)));
- break;
-
- case kGrowableObjectArrayCid: {
- Register temp = locs()->temp(0).reg();
- __ movq(temp, FieldAddress(receiver, GrowableObjectArray::data_offset()));
- // Note that index is Smi, i.e, times 4.
- ASSERT(kSmiTagShift == 1);
- __ movq(result, FieldAddress(temp, index, TIMES_4, sizeof(RawArray)));
- break;
- }
-
- default:
- UNREACHABLE();
- break;
- }
+ // Note that index is Smi, i.e, times 4.
+ ASSERT(kSmiTagShift == 1);
+ __ movq(result, FieldAddress(array, index, TIMES_4, sizeof(RawArray)));
}
LocationSummary* StoreIndexedInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 3;
- const intptr_t kNumTemps =
- (receiver_type() == kGrowableObjectArrayCid) ? 1 : 0;
+ const intptr_t kNumTemps = 0;
LocationSummary* locs =
new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
locs->set_in(0, Location::RequiresRegister());
locs->set_in(1, Location::RequiresRegister());
locs->set_in(2, value()->NeedsStoreBuffer() ? Location::WritableRegister()
: Location::RequiresRegister());
- if (receiver_type() == kGrowableObjectArrayCid) {
- locs->set_temp(0, Location::RequiresRegister());
- }
return locs;
}
void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- Register receiver = locs()->in(0).reg();
+ Register array = locs()->in(0).reg();
Register index = locs()->in(1).reg();
Register value = locs()->in(2).reg();
- switch (receiver_type()) {
- case kArrayCid:
- case kImmutableArrayCid:
- // Note that index is Smi, i.e, times 4.
- ASSERT(kSmiTagShift == 1);
- if (this->value()->NeedsStoreBuffer()) {
- __ StoreIntoObject(receiver,
- FieldAddress(receiver, index, TIMES_4, sizeof(RawArray)),
- value);
- } else {
- __ StoreIntoObjectNoBarrier(receiver,
- FieldAddress(receiver, index, TIMES_4, sizeof(RawArray)),
- value);
- }
- break;
-
- case kGrowableObjectArrayCid: {
- Register temp = locs()->temp(0).reg();
- __ movq(temp, FieldAddress(receiver, GrowableObjectArray::data_offset()));
- // Note that index is Smi, i.e, times 4.
- ASSERT(kSmiTagShift == 1);
- if (this->value()->NeedsStoreBuffer()) {
- __ StoreIntoObject(temp,
- FieldAddress(temp, index, TIMES_4, sizeof(RawArray)),
- value);
- } else {
- __ StoreIntoObjectNoBarrier(temp,
- FieldAddress(temp, index, TIMES_4, sizeof(RawArray)),
- value);
- }
- break;
- }
-
- default:
- UNREACHABLE();
- break;
+ // Note that index is Smi, i.e, times 4.
+ ASSERT(kSmiTagShift == 1);
+ if (this->value()->NeedsStoreBuffer()) {
+ __ StoreIntoObject(array,
+ FieldAddress(array, index, TIMES_4, sizeof(RawArray)),
+ value);
+ } else {
+ __ StoreIntoObjectNoBarrier(array,
+ FieldAddress(array, index, TIMES_4, sizeof(RawArray)),
+ value);
}
}
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698