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 #include "vm/locations.h" | 5 #include "vm/locations.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 #include "vm/il_printer.h" | 8 #include "vm/il_printer.h" |
9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 } | 203 } |
204 | 204 |
205 | 205 |
206 void Location::PrintTo(BufferFormatter* f) const { | 206 void Location::PrintTo(BufferFormatter* f) const { |
207 if (kind() == kStackSlot) { | 207 if (kind() == kStackSlot) { |
208 f->Print("S%+" Pd "", stack_index()); | 208 f->Print("S%+" Pd "", stack_index()); |
209 } else if (kind() == kDoubleStackSlot) { | 209 } else if (kind() == kDoubleStackSlot) { |
210 f->Print("DS%+" Pd "", stack_index()); | 210 f->Print("DS%+" Pd "", stack_index()); |
211 } else if (kind() == kQuadStackSlot) { | 211 } else if (kind() == kQuadStackSlot) { |
212 f->Print("QS%+" Pd "", stack_index()); | 212 f->Print("QS%+" Pd "", stack_index()); |
213 } else if (IsPairLocation()) { | |
214 f->Print("("); | |
215 AsPairLocation()->At(0).PrintTo(f); | |
216 f->Print(", "); | |
217 AsPairLocation()->At(1).PrintTo(f); | |
218 f->Print(")"); | |
213 } else { | 219 } else { |
214 f->Print("%s", Name()); | 220 f->Print("%s", Name()); |
215 } | 221 } |
216 } | 222 } |
217 | 223 |
218 | 224 |
219 const char* Location::ToCString() const { | 225 const char* Location::ToCString() const { |
220 char buffer[1024]; | 226 char buffer[1024]; |
221 BufferFormatter bf(buffer, 1024); | 227 BufferFormatter bf(buffer, 1024); |
222 PrintTo(&bf); | 228 PrintTo(&bf); |
223 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); | 229 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); |
224 } | 230 } |
225 | 231 |
226 | 232 |
227 void Location::Print() const { | 233 void Location::Print() const { |
228 if (kind() == kStackSlot) { | 234 if (kind() == kStackSlot) { |
229 OS::Print("S%+" Pd "", stack_index()); | 235 OS::Print("S%+" Pd "", stack_index()); |
230 } else { | 236 } else { |
231 OS::Print("%s", Name()); | 237 OS::Print("%s", Name()); |
232 } | 238 } |
233 } | 239 } |
234 | 240 |
235 | 241 |
242 Location Location::Copy() const { | |
243 if (IsPairLocation()) { | |
244 PairLocation* pair = AsPairLocation(); | |
245 ASSERT(!pair->At(0).IsPairLocation()); | |
246 ASSERT(!pair->At(1).IsPairLocation()); | |
247 return Location::Pair(pair->At(0), pair->At(1)); | |
Florian Schneider
2014/04/30 18:55:46
I think here you should do a deep copy of the part
Cutch
2014/05/14 17:16:19
Done.
| |
248 } else { | |
249 // Copy by value. | |
250 return *this; | |
251 } | |
252 } | |
253 | |
254 | |
236 void LocationSummary::PrintTo(BufferFormatter* f) const { | 255 void LocationSummary::PrintTo(BufferFormatter* f) const { |
237 if (input_count() > 0) { | 256 if (input_count() > 0) { |
238 f->Print(" ("); | 257 f->Print(" ("); |
239 for (intptr_t i = 0; i < input_count(); i++) { | 258 for (intptr_t i = 0; i < input_count(); i++) { |
240 if (i != 0) f->Print(", "); | 259 if (i != 0) f->Print(", "); |
241 in(i).PrintTo(f); | 260 in(i).PrintTo(f); |
242 } | 261 } |
243 f->Print(")"); | 262 f->Print(")"); |
244 } | 263 } |
245 | 264 |
246 if (temp_count() > 0) { | 265 if (temp_count() > 0) { |
247 f->Print(" ["); | 266 f->Print(" ["); |
248 for (intptr_t i = 0; i < temp_count(); i++) { | 267 for (intptr_t i = 0; i < temp_count(); i++) { |
249 if (i != 0) f->Print(", "); | 268 if (i != 0) f->Print(", "); |
250 temp(i).PrintTo(f); | 269 temp(i).PrintTo(f); |
251 } | 270 } |
252 f->Print("]"); | 271 f->Print("]"); |
253 } | 272 } |
254 | 273 |
255 if (!out(0).IsInvalid()) { | 274 if (!out(0).IsInvalid()) { |
256 f->Print(" => "); | 275 f->Print(" => "); |
257 out(0).PrintTo(f); | 276 out(0).PrintTo(f); |
258 } | 277 } |
259 | 278 |
260 if (always_calls()) f->Print(" C"); | 279 if (always_calls()) f->Print(" C"); |
261 } | 280 } |
262 | 281 |
263 } // namespace dart | 282 } // namespace dart |
OLD | NEW |