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

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

Issue 207063002: Refactor to support multiple outputs in location summary (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 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 #ifndef VM_LOCATIONS_H_ 5 #ifndef VM_LOCATIONS_H_
6 #define VM_LOCATIONS_H_ 6 #define VM_LOCATIONS_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/bitfield.h" 10 #include "vm/bitfield.h"
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 class LocationSummary : public ZoneAllocated { 389 class LocationSummary : public ZoneAllocated {
390 public: 390 public:
391 enum ContainsCall { 391 enum ContainsCall {
392 kNoCall, 392 kNoCall,
393 kCall, 393 kCall,
394 kCallOnSlowPath 394 kCallOnSlowPath
395 }; 395 };
396 396
397 LocationSummary(intptr_t input_count, 397 LocationSummary(intptr_t input_count,
398 intptr_t temp_count, 398 intptr_t temp_count,
399 LocationSummary::ContainsCall contains_call); 399 LocationSummary::ContainsCall contains_call,
400 intptr_t output_count = 1);
srdjan 2014/03/20 23:04:23 The count is kind of our of order. Instead of the
Cutch 2014/03/21 14:36:46 Done.
400 401
401 intptr_t input_count() const { 402 intptr_t input_count() const {
402 return input_locations_.length(); 403 return input_locations_.length();
403 } 404 }
404 405
405 Location in(intptr_t index) const { 406 Location in(intptr_t index) const {
406 return input_locations_[index]; 407 return input_locations_[index];
407 } 408 }
408 409
409 Location* in_slot(intptr_t index) { 410 Location* in_slot(intptr_t index) {
(...skipping 20 matching lines...) Expand all
430 void set_temp(intptr_t index, Location loc) { 431 void set_temp(intptr_t index, Location loc) {
431 ASSERT(!always_calls() || loc.IsMachineRegister()); 432 ASSERT(!always_calls() || loc.IsMachineRegister());
432 temp_locations_[index] = loc; 433 temp_locations_[index] = loc;
433 } 434 }
434 435
435 void AddTemp(Location loc) { 436 void AddTemp(Location loc) {
436 ASSERT(!always_calls() || loc.IsMachineRegister()); 437 ASSERT(!always_calls() || loc.IsMachineRegister());
437 temp_locations_.Add(loc); 438 temp_locations_.Add(loc);
438 } 439 }
439 440
440 Location out() const { 441 intptr_t output_count() const {
441 return output_location_; 442 return output_locations_.length();
442 } 443 }
443 444
444 Location* out_slot() { 445 Location out(intptr_t index) const {
445 return &output_location_; 446 return output_locations_[index];
446 } 447 }
447 448
448 void set_out(Location loc) { 449 Location* out_slot(intptr_t index) {
450 return &output_locations_[index];
451 }
452
453 void set_out(intptr_t index, Location loc) {
449 ASSERT(!always_calls() || (loc.IsMachineRegister() || loc.IsInvalid())); 454 ASSERT(!always_calls() || (loc.IsMachineRegister() || loc.IsInvalid()));
450 output_location_ = loc; 455 output_locations_[index] = loc;
451 } 456 }
452 457
453 BitmapBuilder* stack_bitmap() const { return stack_bitmap_; } 458 BitmapBuilder* stack_bitmap() const { return stack_bitmap_; }
454 459
455 bool always_calls() const { 460 bool always_calls() const {
456 return contains_call_ == kCall; 461 return contains_call_ == kCall;
457 } 462 }
458 463
459 bool can_call() { 464 bool can_call() {
460 return contains_call_ != kNoCall; 465 return contains_call_ != kNoCall;
461 } 466 }
462 467
463 void PrintTo(BufferFormatter* f) const; 468 void PrintTo(BufferFormatter* f) const;
464 469
465 static LocationSummary* Make(intptr_t input_count, 470 static LocationSummary* Make(intptr_t input_count,
466 Location out, 471 Location out,
467 ContainsCall contains_call); 472 ContainsCall contains_call);
468 473
469 RegisterSet* live_registers() { 474 RegisterSet* live_registers() {
470 return &live_registers_; 475 return &live_registers_;
471 } 476 }
472 477
473 private: 478 private:
474 // TODO(vegorov): replace with ZoneArray. 479 ZoneGrowableArray<Location> input_locations_;
Florian Schneider 2014/03/21 10:47:07 I wonder how often we actually want to add/remove
Cutch 2014/03/21 14:36:46 Good point but I would prefer to do that change in
475 GrowableArray<Location> input_locations_; 480 ZoneGrowableArray<Location> temp_locations_;
476 GrowableArray<Location> temp_locations_; 481 ZoneGrowableArray<Location> output_locations_;
477 Location output_location_; 482
478 BitmapBuilder* stack_bitmap_; 483 BitmapBuilder* stack_bitmap_;
479 484
480 const ContainsCall contains_call_; 485 const ContainsCall contains_call_;
481 RegisterSet live_registers_; 486 RegisterSet live_registers_;
482 }; 487 };
483 488
484 489
485 } // namespace dart 490 } // namespace dart
486 491
487 #endif // VM_LOCATIONS_H_ 492 #endif // VM_LOCATIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698