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

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
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | runtime/vm/locations.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 387
388 // Specification of locations for inputs and output. 388 // Specification of locations for inputs and output.
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 // Defaults to 1 output.
397 LocationSummary(intptr_t input_count, 398 LocationSummary(intptr_t input_count,
398 intptr_t temp_count, 399 intptr_t temp_count,
399 LocationSummary::ContainsCall contains_call); 400 LocationSummary::ContainsCall contains_call);
400 401
402 LocationSummary(intptr_t input_count,
403 intptr_t temp_count,
404 intptr_t output_count,
405 LocationSummary::ContainsCall contains_call);
406
401 intptr_t input_count() const { 407 intptr_t input_count() const {
402 return input_locations_.length(); 408 return input_locations_.length();
403 } 409 }
404 410
405 Location in(intptr_t index) const { 411 Location in(intptr_t index) const {
406 return input_locations_[index]; 412 return input_locations_[index];
407 } 413 }
408 414
409 Location* in_slot(intptr_t index) { 415 Location* in_slot(intptr_t index) {
410 return &input_locations_[index]; 416 return &input_locations_[index];
(...skipping 19 matching lines...) Expand all
430 void set_temp(intptr_t index, Location loc) { 436 void set_temp(intptr_t index, Location loc) {
431 ASSERT(!always_calls() || loc.IsMachineRegister()); 437 ASSERT(!always_calls() || loc.IsMachineRegister());
432 temp_locations_[index] = loc; 438 temp_locations_[index] = loc;
433 } 439 }
434 440
435 void AddTemp(Location loc) { 441 void AddTemp(Location loc) {
436 ASSERT(!always_calls() || loc.IsMachineRegister()); 442 ASSERT(!always_calls() || loc.IsMachineRegister());
437 temp_locations_.Add(loc); 443 temp_locations_.Add(loc);
438 } 444 }
439 445
440 Location out() const { 446 intptr_t output_count() const {
441 return output_location_; 447 return output_locations_.length();
442 } 448 }
443 449
444 Location* out_slot() { 450 Location out(intptr_t index) const {
445 return &output_location_; 451 return output_locations_[index];
446 } 452 }
447 453
448 void set_out(Location loc) { 454 Location* out_slot(intptr_t index) {
455 return &output_locations_[index];
456 }
457
458 void set_out(intptr_t index, Location loc) {
449 ASSERT(!always_calls() || (loc.IsMachineRegister() || loc.IsInvalid())); 459 ASSERT(!always_calls() || (loc.IsMachineRegister() || loc.IsInvalid()));
450 output_location_ = loc; 460 output_locations_[index] = loc;
451 } 461 }
452 462
453 BitmapBuilder* stack_bitmap() const { return stack_bitmap_; } 463 BitmapBuilder* stack_bitmap() const { return stack_bitmap_; }
454 464
455 bool always_calls() const { 465 bool always_calls() const {
456 return contains_call_ == kCall; 466 return contains_call_ == kCall;
457 } 467 }
458 468
459 bool can_call() { 469 bool can_call() {
460 return contains_call_ != kNoCall; 470 return contains_call_ != kNoCall;
461 } 471 }
462 472
463 void PrintTo(BufferFormatter* f) const; 473 void PrintTo(BufferFormatter* f) const;
464 474
465 static LocationSummary* Make(intptr_t input_count, 475 static LocationSummary* Make(intptr_t input_count,
466 Location out, 476 Location out,
467 ContainsCall contains_call); 477 ContainsCall contains_call);
468 478
469 RegisterSet* live_registers() { 479 RegisterSet* live_registers() {
470 return &live_registers_; 480 return &live_registers_;
471 } 481 }
472 482
473 private: 483 private:
474 // TODO(vegorov): replace with ZoneArray. 484 ZoneGrowableArray<Location> input_locations_;
475 GrowableArray<Location> input_locations_; 485 ZoneGrowableArray<Location> temp_locations_;
476 GrowableArray<Location> temp_locations_; 486 ZoneGrowableArray<Location> output_locations_;
477 Location output_location_; 487
478 BitmapBuilder* stack_bitmap_; 488 BitmapBuilder* stack_bitmap_;
479 489
480 const ContainsCall contains_call_; 490 const ContainsCall contains_call_;
481 RegisterSet live_registers_; 491 RegisterSet live_registers_;
482 }; 492 };
483 493
484 494
485 } // namespace dart 495 } // namespace dart
486 496
487 #endif // VM_LOCATIONS_H_ 497 #endif // VM_LOCATIONS_H_
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | runtime/vm/locations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698