| 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/log.h" |
| 11 #include "vm/stack_frame.h" | 12 #include "vm/stack_frame.h" |
| 12 | 13 |
| 13 namespace dart { | 14 namespace dart { |
| 14 | 15 |
| 15 intptr_t RegisterSet::RegisterCount(intptr_t registers) { | 16 intptr_t RegisterSet::RegisterCount(intptr_t registers) { |
| 16 // Brian Kernighan's algorithm for counting the bits set. | 17 // Brian Kernighan's algorithm for counting the bits set. |
| 17 intptr_t count = 0; | 18 intptr_t count = 0; |
| 18 while (registers != 0) { | 19 while (registers != 0) { |
| 19 ++count; | 20 ++count; |
| 20 registers &= (registers - 1); // Clear the least significant bit set. | 21 registers &= (registers - 1); // Clear the least significant bit set. |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 const char* Location::ToCString() const { | 218 const char* Location::ToCString() const { |
| 218 char buffer[1024]; | 219 char buffer[1024]; |
| 219 BufferFormatter bf(buffer, 1024); | 220 BufferFormatter bf(buffer, 1024); |
| 220 PrintTo(&bf); | 221 PrintTo(&bf); |
| 221 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); | 222 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); |
| 222 } | 223 } |
| 223 | 224 |
| 224 | 225 |
| 225 void Location::Print() const { | 226 void Location::Print() const { |
| 226 if (kind() == kStackSlot) { | 227 if (kind() == kStackSlot) { |
| 227 OS::Print("S%+" Pd "", stack_index()); | 228 ISL_Print("S%+" Pd "", stack_index()); |
| 228 } else { | 229 } else { |
| 229 OS::Print("%s", Name()); | 230 ISL_Print("%s", Name()); |
| 230 } | 231 } |
| 231 } | 232 } |
| 232 | 233 |
| 233 | 234 |
| 234 Location Location::Copy() const { | 235 Location Location::Copy() const { |
| 235 if (IsPairLocation()) { | 236 if (IsPairLocation()) { |
| 236 PairLocation* pair = AsPairLocation(); | 237 PairLocation* pair = AsPairLocation(); |
| 237 ASSERT(!pair->At(0).IsPairLocation()); | 238 ASSERT(!pair->At(0).IsPairLocation()); |
| 238 ASSERT(!pair->At(1).IsPairLocation()); | 239 ASSERT(!pair->At(1).IsPairLocation()); |
| 239 return Location::Pair(pair->At(0).Copy(), pair->At(1).Copy()); | 240 return Location::Pair(pair->At(0).Copy(), pair->At(1).Copy()); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 // with the right representation because register allocator does not know | 349 // with the right representation because register allocator does not know |
| 349 // how they are used within the instruction template. | 350 // how they are used within the instruction template. |
| 350 ASSERT(in(i).IsMachineRegister()); | 351 ASSERT(in(i).IsMachineRegister()); |
| 351 ASSERT(live_registers()->Contains(in(i))); | 352 ASSERT(live_registers()->Contains(in(i))); |
| 352 } | 353 } |
| 353 } | 354 } |
| 354 } | 355 } |
| 355 #endif | 356 #endif |
| 356 | 357 |
| 357 } // namespace dart | 358 } // namespace dart |
| OLD | NEW |