| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 ASSERT(&obj == &loc.constant()); | 89 ASSERT(&obj == &loc.constant()); |
| 90 return loc; | 90 return loc; |
| 91 } | 91 } |
| 92 | 92 |
| 93 const Object& constant() const { | 93 const Object& constant() const { |
| 94 ASSERT(IsConstant()); | 94 ASSERT(IsConstant()); |
| 95 return *reinterpret_cast<const Object*>(value_ & ~kConstantMask); | 95 return *reinterpret_cast<const Object*>(value_ & ~kConstantMask); |
| 96 } | 96 } |
| 97 | 97 |
| 98 // Unallocated locations. | 98 // Unallocated locations. |
| 99 // TODO(vegorov): writable register policy? | |
| 100 enum Policy { | 99 enum Policy { |
| 101 kAny, | 100 kAny, |
| 102 kPrefersRegister, | 101 kPrefersRegister, |
| 103 kRequiresRegister, | 102 kRequiresRegister, |
| 104 kRequiresXmmRegister, | 103 kRequiresXmmRegister, |
| 104 kWritableRegister, |
| 105 kSameAsFirstInput, | 105 kSameAsFirstInput, |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 bool IsUnallocated() const { | 108 bool IsUnallocated() const { |
| 109 return kind() == kUnallocated; | 109 return kind() == kUnallocated; |
| 110 } | 110 } |
| 111 | 111 |
| 112 bool IsRegisterBeneficial() { | 112 bool IsRegisterBeneficial() { |
| 113 return !Equals(Any()); | 113 return !Equals(Any()); |
| 114 } | 114 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 127 } | 127 } |
| 128 | 128 |
| 129 static Location RequiresRegister() { | 129 static Location RequiresRegister() { |
| 130 return UnallocatedLocation(kRequiresRegister); | 130 return UnallocatedLocation(kRequiresRegister); |
| 131 } | 131 } |
| 132 | 132 |
| 133 static Location RequiresXmmRegister() { | 133 static Location RequiresXmmRegister() { |
| 134 return UnallocatedLocation(kRequiresXmmRegister); | 134 return UnallocatedLocation(kRequiresXmmRegister); |
| 135 } | 135 } |
| 136 | 136 |
| 137 static Location WritableRegister() { |
| 138 return UnallocatedLocation(kWritableRegister); |
| 139 } |
| 140 |
| 137 // The location of the first input to the instruction will be | 141 // The location of the first input to the instruction will be |
| 138 // used to replace this unallocated location. | 142 // used to replace this unallocated location. |
| 139 static Location SameAsFirstInput() { | 143 static Location SameAsFirstInput() { |
| 140 return UnallocatedLocation(kSameAsFirstInput); | 144 return UnallocatedLocation(kSameAsFirstInput); |
| 141 } | 145 } |
| 142 | 146 |
| 143 // Empty location. Used if there the location should be ignored. | 147 // Empty location. Used if there the location should be ignored. |
| 144 static Location NoLocation() { | 148 static Location NoLocation() { |
| 145 return Location(); | 149 return Location(); |
| 146 } | 150 } |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 BitmapBuilder* stack_bitmap_; | 414 BitmapBuilder* stack_bitmap_; |
| 411 | 415 |
| 412 const ContainsCall contains_call_; | 416 const ContainsCall contains_call_; |
| 413 RegisterSet live_registers_; | 417 RegisterSet live_registers_; |
| 414 }; | 418 }; |
| 415 | 419 |
| 416 | 420 |
| 417 } // namespace dart | 421 } // namespace dart |
| 418 | 422 |
| 419 #endif // VM_LOCATIONS_H_ | 423 #endif // VM_LOCATIONS_H_ |
| OLD | NEW |