| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 | 99 |
| 100 // Specification of locations for inputs and output. | 100 // Specification of locations for inputs and output. |
| 101 class LocationSummary : public ZoneAllocated { | 101 class LocationSummary : public ZoneAllocated { |
| 102 public: | 102 public: |
| 103 enum ContainsCall { | 103 enum ContainsCall { |
| 104 kNoCall, | 104 kNoCall, |
| 105 kCall, | 105 kCall, |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 enum ContainsBranch { | |
| 109 kNoBranch, | |
| 110 kBranch | |
| 111 }; | |
| 112 | |
| 113 // TODO(vegorov): remove unsafe kNoCall default. | 108 // TODO(vegorov): remove unsafe kNoCall default. |
| 114 LocationSummary(intptr_t input_count, | 109 LocationSummary(intptr_t input_count, |
| 115 intptr_t temp_count, | 110 intptr_t temp_count, |
| 116 ContainsCall call = kNoCall, | 111 ContainsCall call = kNoCall) |
| 117 ContainsBranch branch = kNoBranch) | |
| 118 : input_locations_(input_count), | 112 : input_locations_(input_count), |
| 119 temp_locations_(temp_count), | 113 temp_locations_(temp_count), |
| 120 output_location_(), | 114 output_location_(), |
| 121 is_call_(call == kCall), | 115 is_call_(call == kCall) { |
| 122 is_branch_(branch == kBranch) { | |
| 123 for (intptr_t i = 0; i < input_count; i++) { | 116 for (intptr_t i = 0; i < input_count; i++) { |
| 124 input_locations_.Add(Location()); | 117 input_locations_.Add(Location()); |
| 125 } | 118 } |
| 126 for (intptr_t i = 0; i < temp_count; i++) { | 119 for (intptr_t i = 0; i < temp_count; i++) { |
| 127 temp_locations_.Add(Location()); | 120 temp_locations_.Add(Location()); |
| 128 } | 121 } |
| 129 } | 122 } |
| 130 | 123 |
| 131 intptr_t input_count() const { | 124 intptr_t input_count() const { |
| 132 return input_locations_.length(); | 125 return input_locations_.length(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 157 } | 150 } |
| 158 | 151 |
| 159 void set_out(Location loc) { | 152 void set_out(Location loc) { |
| 160 output_location_ = loc; | 153 output_location_ = loc; |
| 161 } | 154 } |
| 162 | 155 |
| 163 bool is_call() const { | 156 bool is_call() const { |
| 164 return is_call_; | 157 return is_call_; |
| 165 } | 158 } |
| 166 | 159 |
| 167 // TODO(vegorov): this is a temporary solution. Once we will start removing | |
| 168 // comparison operations from the flow graph when they are fused with a branch | |
| 169 // we should eliminate this. | |
| 170 bool is_branch() const { | |
| 171 return is_branch_; | |
| 172 } | |
| 173 | |
| 174 static LocationSummary* Make(intptr_t input_count, | 160 static LocationSummary* Make(intptr_t input_count, |
| 175 Location out, | 161 Location out, |
| 176 ContainsCall contains_call = kNoCall, | 162 ContainsCall contains_call = kNoCall); |
| 177 ContainsBranch contains_branch = kNoBranch); | |
| 178 | 163 |
| 179 private: | 164 private: |
| 180 // TODO(vegorov): replace with ZoneArray. | 165 // TODO(vegorov): replace with ZoneArray. |
| 181 GrowableArray<Location> input_locations_; | 166 GrowableArray<Location> input_locations_; |
| 182 GrowableArray<Location> temp_locations_; | 167 GrowableArray<Location> temp_locations_; |
| 183 Location output_location_; | 168 Location output_location_; |
| 184 | 169 |
| 185 const bool is_call_; | 170 const bool is_call_; |
| 186 const bool is_branch_; | |
| 187 }; | 171 }; |
| 188 | 172 |
| 189 | 173 |
| 190 } // namespace dart | 174 } // namespace dart |
| 191 | 175 |
| 192 #endif // VM_LOCATIONS_H_ | 176 #endif // VM_LOCATIONS_H_ |
| OLD | NEW |