| OLD | NEW |
| 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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 // Specification of locations for inputs and output. | 515 // Specification of locations for inputs and output. |
| 516 class LocationSummary : public ZoneAllocated { | 516 class LocationSummary : public ZoneAllocated { |
| 517 public: | 517 public: |
| 518 enum ContainsCall { | 518 enum ContainsCall { |
| 519 kNoCall, | 519 kNoCall, |
| 520 kCall, | 520 kCall, |
| 521 kCallOnSlowPath | 521 kCallOnSlowPath |
| 522 }; | 522 }; |
| 523 | 523 |
| 524 // Defaults to 1 output. | 524 // Defaults to 1 output. |
| 525 LocationSummary(intptr_t input_count, | 525 LocationSummary(Isolate* isolate, |
| 526 intptr_t input_count, |
| 526 intptr_t temp_count, | 527 intptr_t temp_count, |
| 527 LocationSummary::ContainsCall contains_call); | 528 LocationSummary::ContainsCall contains_call); |
| 528 | 529 |
| 529 LocationSummary(intptr_t input_count, | 530 LocationSummary(Isolate* isolate, |
| 531 intptr_t input_count, |
| 530 intptr_t temp_count, | 532 intptr_t temp_count, |
| 531 intptr_t output_count, | 533 intptr_t output_count, |
| 532 LocationSummary::ContainsCall contains_call); | 534 LocationSummary::ContainsCall contains_call); |
| 533 | 535 |
| 534 intptr_t input_count() const { | 536 intptr_t input_count() const { |
| 535 return input_locations_.length(); | 537 return input_locations_.length(); |
| 536 } | 538 } |
| 537 | 539 |
| 538 Location in(intptr_t index) const { | 540 Location in(intptr_t index) const { |
| 539 return input_locations_[index]; | 541 return input_locations_[index]; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 return &output_locations_[index]; | 584 return &output_locations_[index]; |
| 583 } | 585 } |
| 584 | 586 |
| 585 void set_out(intptr_t index, Location loc) { | 587 void set_out(intptr_t index, Location loc) { |
| 586 ASSERT(!always_calls() || | 588 ASSERT(!always_calls() || |
| 587 (loc.IsMachineRegister() || loc.IsInvalid() || | 589 (loc.IsMachineRegister() || loc.IsInvalid() || |
| 588 loc.IsPairLocation())); | 590 loc.IsPairLocation())); |
| 589 output_locations_[index] = loc; | 591 output_locations_[index] = loc; |
| 590 } | 592 } |
| 591 | 593 |
| 592 BitmapBuilder* stack_bitmap() const { return stack_bitmap_; } | 594 BitmapBuilder* stack_bitmap() { |
| 595 if (stack_bitmap_ == NULL) { |
| 596 stack_bitmap_ = new BitmapBuilder(); |
| 597 } |
| 598 return stack_bitmap_; |
| 599 } |
| 600 void SetStackBit(intptr_t index) { |
| 601 stack_bitmap()->Set(index, true); |
| 602 } |
| 593 | 603 |
| 594 bool always_calls() const { | 604 bool always_calls() const { |
| 595 return contains_call_ == kCall; | 605 return contains_call_ == kCall; |
| 596 } | 606 } |
| 597 | 607 |
| 598 bool can_call() { | 608 bool can_call() { |
| 599 return contains_call_ != kNoCall; | 609 return contains_call_ != kNoCall; |
| 600 } | 610 } |
| 601 | 611 |
| 602 bool HasCallOnSlowPath() { | 612 bool HasCallOnSlowPath() { |
| 603 return can_call() && !always_calls(); | 613 return can_call() && !always_calls(); |
| 604 } | 614 } |
| 605 | 615 |
| 606 void PrintTo(BufferFormatter* f) const; | 616 void PrintTo(BufferFormatter* f) const; |
| 607 | 617 |
| 608 static LocationSummary* Make(intptr_t input_count, | 618 static LocationSummary* Make(intptr_t input_count, |
| 609 Location out, | 619 Location out, |
| 610 ContainsCall contains_call); | 620 ContainsCall contains_call); |
| 611 | 621 |
| 612 RegisterSet* live_registers() { | 622 RegisterSet* live_registers() { |
| 613 return &live_registers_; | 623 return &live_registers_; |
| 614 } | 624 } |
| 615 | 625 |
| 616 private: | 626 private: |
| 617 ZoneGrowableArray<Location> input_locations_; | 627 GrowableArray<Location> input_locations_; |
| 618 ZoneGrowableArray<Location> temp_locations_; | 628 GrowableArray<Location> temp_locations_; |
| 619 ZoneGrowableArray<Location> output_locations_; | 629 GrowableArray<Location> output_locations_; |
| 620 | 630 |
| 621 BitmapBuilder* stack_bitmap_; | 631 BitmapBuilder* stack_bitmap_; |
| 622 | 632 |
| 623 const ContainsCall contains_call_; | 633 const ContainsCall contains_call_; |
| 624 RegisterSet live_registers_; | 634 RegisterSet live_registers_; |
| 625 }; | 635 }; |
| 626 | 636 |
| 627 | 637 |
| 628 } // namespace dart | 638 } // namespace dart |
| 629 | 639 |
| 630 #endif // VM_LOCATIONS_H_ | 640 #endif // VM_LOCATIONS_H_ |
| OLD | NEW |