OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 99 } |
100 | 100 |
101 | 101 |
102 void RegisterAllocator::Unuse(Register reg) { | 102 void RegisterAllocator::Unuse(Register reg) { |
103 registers_.Unuse(ToNumber(reg)); | 103 registers_.Unuse(ToNumber(reg)); |
104 } | 104 } |
105 | 105 |
106 | 106 |
107 NumberInfo Result::number_info() const { | 107 NumberInfo Result::number_info() const { |
108 ASSERT(is_valid()); | 108 ASSERT(is_valid()); |
109 if (!is_constant()) { | 109 return NumberInfo::FromInt(NumberInfoField::decode(value_)); |
110 return NumberInfo::FromInt(NumberInfoField::decode(value_)); | |
111 } | |
112 Handle<Object> value = handle(); | |
113 if (value->IsSmi()) return NumberInfo::Smi(); | |
114 if (value->IsHeapNumber()) return NumberInfo::HeapNumber(); | |
115 return NumberInfo::Unknown(); | |
116 } | 110 } |
117 | 111 |
118 | 112 |
119 void Result::set_number_info(NumberInfo info) { | 113 void Result::set_number_info(NumberInfo info) { |
120 ASSERT(is_valid()); | 114 ASSERT(is_valid()); |
121 value_ &= ~NumberInfoField::mask(); | 115 value_ &= ~NumberInfoField::mask(); |
122 value_ |= NumberInfoField::encode(info.ToInt()); | 116 value_ |= NumberInfoField::encode(info.ToInt()); |
123 } | 117 } |
124 | 118 |
125 | 119 |
126 bool Result::is_number() const { | 120 bool Result::is_number() const { |
127 return number_info().IsNumber(); | 121 return number_info().IsNumber(); |
128 } | 122 } |
129 | 123 |
130 | 124 |
131 bool Result::is_smi() const { | 125 bool Result::is_smi() const { |
132 return number_info().IsSmi(); | 126 return number_info().IsSmi(); |
133 } | 127 } |
134 | 128 |
135 | 129 |
136 bool Result::is_integer32() const { | 130 bool Result::is_integer32() const { |
137 return number_info().IsInteger32(); | 131 return number_info().IsInteger32(); |
138 } | 132 } |
139 | 133 |
140 | 134 |
141 bool Result::is_heap_number() const { | 135 bool Result::is_double() const { |
142 return number_info().IsHeapNumber(); | 136 return number_info().IsDouble(); |
143 } | 137 } |
144 | 138 |
145 } } // namespace v8::internal | 139 } } // namespace v8::internal |
146 | 140 |
147 #endif // V8_REGISTER_ALLOCATOR_INL_H_ | 141 #endif // V8_REGISTER_ALLOCATOR_INL_H_ |
OLD | NEW |