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

Unified Diff: runtime/vm/locations.h

Issue 10823308: Implement basic support for deferred slow path code with calls that save and restore live registers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address Kevin's comments Created 8 years, 4 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
Index: runtime/vm/locations.h
diff --git a/runtime/vm/locations.h b/runtime/vm/locations.h
index 6e4393ca6a797b7fe8e340687aa270a6547c086c..cad43ea58b04f3b02298bd6f42ca9a3b95c5d945 100644
--- a/runtime/vm/locations.h
+++ b/runtime/vm/locations.h
@@ -208,12 +208,34 @@ class Location : public ValueObject {
};
+class RegisterSet : public ValueObject {
+ public:
+ RegisterSet() : registers_(0) {
+ ASSERT(kNumberOfCpuRegisters < (kWordSize * kBitsPerByte));
+ }
+
+ void Add(Register reg) {
+ registers_ |= (1 << reg);
+ }
+
+ bool Contains(Register reg) {
+ return (registers_ & (1 << reg)) != 0;
+ }
+
+ private:
+ intptr_t registers_;
+
+ DISALLOW_COPY_AND_ASSIGN(RegisterSet);
+};
+
+
// Specification of locations for inputs and output.
class LocationSummary : public ZoneAllocated {
public:
enum ContainsCall {
kNoCall,
kCall,
+ kCallOnSlowPath
};
LocationSummary(intptr_t input_count,
@@ -262,7 +284,6 @@ class LocationSummary : public ZoneAllocated {
return &output_location_;
}
-
void set_out(Location loc) {
ASSERT(!is_call() || loc.IsRegister());
output_location_ = loc;
@@ -271,14 +292,22 @@ class LocationSummary : public ZoneAllocated {
BitmapBuilder* stack_bitmap() const { return stack_bitmap_; }
bool is_call() const {
- return is_call_;
+ return contains_call_ == kCall;
+ }
+
+ bool contains_call() const {
srdjan 2012/08/15 00:12:03 I find is_call vs contains_call too similar/confus
Vyacheslav Egorov (Google) 2012/08/15 13:08:07 I rename contains_call() into can_call(), is_call
+ return contains_call_ != kNoCall;
}
void PrintTo(BufferFormatter* f) const;
static LocationSummary* Make(intptr_t input_count,
Location out,
- LocationSummary::ContainsCall contains_call);
+ ContainsCall contains_call);
+
+ RegisterSet* live_registers() {
+ return &live_registers_;
+ }
private:
// TODO(vegorov): replace with ZoneArray.
@@ -286,7 +315,9 @@ class LocationSummary : public ZoneAllocated {
GrowableArray<Location> temp_locations_;
Location output_location_;
BitmapBuilder* stack_bitmap_;
- const bool is_call_;
+
+ const ContainsCall contains_call_;
+ RegisterSet live_registers_;
};

Powered by Google App Engine
This is Rietveld 408576698