| 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" |
| 11 #include "vm/stack_frame.h" | 11 #include "vm/stack_frame.h" |
| 12 | 12 |
| 13 namespace dart { | 13 namespace dart { |
| 14 | 14 |
| 15 intptr_t RegisterSet::RegisterCount(intptr_t registers) { |
| 16 // Brian Kernighan's algorithm for counting the bits set. |
| 17 intptr_t count = 0; |
| 18 while (registers != 0) { |
| 19 ++count; |
| 20 registers &= (registers - 1); // Clear the least significant bit set. |
| 21 } |
| 22 return count; |
| 23 } |
| 24 |
| 25 |
| 15 LocationSummary::LocationSummary(intptr_t input_count, | 26 LocationSummary::LocationSummary(intptr_t input_count, |
| 16 intptr_t temp_count, | 27 intptr_t temp_count, |
| 17 LocationSummary::ContainsCall contains_call) | 28 LocationSummary::ContainsCall contains_call) |
| 18 : input_locations_(input_count), | 29 : input_locations_(input_count), |
| 19 temp_locations_(temp_count), | 30 temp_locations_(temp_count), |
| 20 output_location_(), | 31 output_location_(), |
| 21 stack_bitmap_(NULL), | 32 stack_bitmap_(NULL), |
| 22 contains_call_(contains_call), | 33 contains_call_(contains_call), |
| 23 live_registers_() { | 34 live_registers_() { |
| 24 for (intptr_t i = 0; i < input_count; i++) { | 35 for (intptr_t i = 0; i < input_count; i++) { |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 195 |
| 185 if (!out().IsInvalid()) { | 196 if (!out().IsInvalid()) { |
| 186 f->Print(" => "); | 197 f->Print(" => "); |
| 187 out().PrintTo(f); | 198 out().PrintTo(f); |
| 188 } | 199 } |
| 189 | 200 |
| 190 if (always_calls()) f->Print(" C"); | 201 if (always_calls()) f->Print(" C"); |
| 191 } | 202 } |
| 192 | 203 |
| 193 } // namespace dart | 204 } // namespace dart |
| OLD | NEW |