| 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 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 LocationSummary::LocationSummary(Isolate* isolate, | 26 LocationSummary::LocationSummary(Isolate* isolate, |
| 27 intptr_t input_count, | 27 intptr_t input_count, |
| 28 intptr_t temp_count, | 28 intptr_t temp_count, |
| 29 LocationSummary::ContainsCall contains_call) | 29 LocationSummary::ContainsCall contains_call) |
| 30 : num_inputs_(input_count), | 30 : num_inputs_(input_count), |
| 31 num_temps_(temp_count), | 31 num_temps_(temp_count), |
| 32 stack_bitmap_(NULL), | 32 stack_bitmap_(NULL), |
| 33 contains_call_(contains_call), | 33 contains_call_(contains_call), |
| 34 live_registers_() { | 34 live_registers_() { |
| 35 #if defined(DEBUG) |
| 36 writable_inputs_ = 0; |
| 37 #endif |
| 35 input_locations_ = isolate->current_zone()->Alloc<Location>(num_inputs_); | 38 input_locations_ = isolate->current_zone()->Alloc<Location>(num_inputs_); |
| 36 temp_locations_ = isolate->current_zone()->Alloc<Location>(num_temps_); | 39 temp_locations_ = isolate->current_zone()->Alloc<Location>(num_temps_); |
| 37 } | 40 } |
| 38 | 41 |
| 39 | 42 |
| 40 LocationSummary* LocationSummary::Make( | 43 LocationSummary* LocationSummary::Make( |
| 41 Isolate* isolate, | 44 Isolate* isolate, |
| 42 intptr_t input_count, | 45 intptr_t input_count, |
| 43 Location out, | 46 Location out, |
| 44 LocationSummary::ContainsCall contains_call) { | 47 LocationSummary::ContainsCall contains_call) { |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 } | 253 } |
| 251 | 254 |
| 252 if (!out(0).IsInvalid()) { | 255 if (!out(0).IsInvalid()) { |
| 253 f->Print(" => "); | 256 f->Print(" => "); |
| 254 out(0).PrintTo(f); | 257 out(0).PrintTo(f); |
| 255 } | 258 } |
| 256 | 259 |
| 257 if (always_calls()) f->Print(" C"); | 260 if (always_calls()) f->Print(" C"); |
| 258 } | 261 } |
| 259 | 262 |
| 263 |
| 264 #if defined(DEBUG) |
| 265 void LocationSummary::DiscoverWritableInputs() { |
| 266 if (!HasCallOnSlowPath()) { |
| 267 return; |
| 268 } |
| 269 |
| 270 for (intptr_t i = 0; i < input_count(); i++) { |
| 271 if (in(i).IsUnallocated() && |
| 272 (in(i).policy() == Location::kWritableRegister)) { |
| 273 writable_inputs_ |= 1 << i; |
| 274 } |
| 275 } |
| 276 } |
| 277 |
| 278 |
| 279 void LocationSummary::CheckWritableInputs() { |
| 280 ASSERT(HasCallOnSlowPath()); |
| 281 for (intptr_t i = 0; i < input_count(); i++) { |
| 282 if ((writable_inputs_ & (1 << i)) != 0) { |
| 283 // Writable registers have to be manually preserved because |
| 284 // with the right representation because register allocator does not know |
| 285 // how they are used within the instruction template. |
| 286 ASSERT(in(i).IsMachineRegister()); |
| 287 ASSERT(live_registers()->Contains(in(i))); |
| 288 } |
| 289 } |
| 290 } |
| 291 #endif |
| 292 |
| 260 } // namespace dart | 293 } // namespace dart |
| OLD | NEW |