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

Side by Side Diff: runtime/vm/locations.cc

Issue 811823002: Support remaping of pair location inside materializations for slow paths. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/locations.h" 5 #include "vm/locations.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/il_printer.h" 8 #include "vm/il_printer.h"
9 #include "vm/intermediate_language.h" 9 #include "vm/intermediate_language.h"
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 ASSERT(!pair->At(0).IsPairLocation()); 237 ASSERT(!pair->At(0).IsPairLocation());
238 ASSERT(!pair->At(1).IsPairLocation()); 238 ASSERT(!pair->At(1).IsPairLocation());
239 return Location::Pair(pair->At(0).Copy(), pair->At(1).Copy()); 239 return Location::Pair(pair->At(0).Copy(), pair->At(1).Copy());
240 } else { 240 } else {
241 // Copy by value. 241 // Copy by value.
242 return *this; 242 return *this;
243 } 243 }
244 } 244 }
245 245
246 246
247 Location Location::RemapForSlowPath(Definition* def,
248 intptr_t* cpu_reg_slots,
249 intptr_t* fpu_reg_slots) const {
250 if (IsRegister()) {
251 intptr_t index = cpu_reg_slots[reg()];
252 ASSERT(index >= 0);
253 return Location::StackSlot(index);
254 } else if (IsFpuRegister()) {
255 intptr_t index = fpu_reg_slots[fpu_reg()];
256 ASSERT(index >= 0);
257 switch (def->representation()) {
258 case kUnboxedDouble:
259 return Location::DoubleStackSlot(index);
260
261 case kUnboxedFloat32x4:
262 case kUnboxedInt32x4:
263 case kUnboxedFloat64x2:
264 return Location::QuadStackSlot(index);
265
266 default:
267 UNREACHABLE();
268 }
269 } else if (IsPairLocation()) {
270 ASSERT(def->representation() == kUnboxedMint);
271 PairLocation* value_pair = AsPairLocation();
272 intptr_t index_lo;
273 intptr_t index_hi;
274
275 if (value_pair->At(0).IsRegister()) {
276 index_lo = cpu_reg_slots[value_pair->At(0).reg()];
277 } else {
278 ASSERT(value_pair->At(0).IsStackSlot());
279 index_lo = value_pair->At(0).stack_index();
280 }
281
282 if (value_pair->At(1).IsRegister()) {
283 index_hi = cpu_reg_slots[value_pair->At(1).reg()];
284 } else {
285 ASSERT(value_pair->At(1).IsStackSlot());
286 index_hi = value_pair->At(1).stack_index();
287 }
288
289 return Location::Pair(Location::StackSlot(index_lo),
290 Location::StackSlot(index_hi));
291 } else if (IsInvalid() && def->IsMaterializeObject()) {
292 def->AsMaterializeObject()->RemapRegisters(cpu_reg_slots, fpu_reg_slots);
293 return *this;
294 }
295
296 return *this;
297 }
298
299
247 void LocationSummary::PrintTo(BufferFormatter* f) const { 300 void LocationSummary::PrintTo(BufferFormatter* f) const {
248 if (input_count() > 0) { 301 if (input_count() > 0) {
249 f->Print(" ("); 302 f->Print(" (");
250 for (intptr_t i = 0; i < input_count(); i++) { 303 for (intptr_t i = 0; i < input_count(); i++) {
251 if (i != 0) f->Print(", "); 304 if (i != 0) f->Print(", ");
252 in(i).PrintTo(f); 305 in(i).PrintTo(f);
253 } 306 }
254 f->Print(")"); 307 f->Print(")");
255 } 308 }
256 309
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 // with the right representation because register allocator does not know 348 // with the right representation because register allocator does not know
296 // how they are used within the instruction template. 349 // how they are used within the instruction template.
297 ASSERT(in(i).IsMachineRegister()); 350 ASSERT(in(i).IsMachineRegister());
298 ASSERT(live_registers()->Contains(in(i))); 351 ASSERT(live_registers()->Contains(in(i)));
299 } 352 }
300 } 353 }
301 } 354 }
302 #endif 355 #endif
303 356
304 } // namespace dart 357 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698