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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 bool is_valid() const { return type() != INVALID; } | 138 bool is_valid() const { return type() != INVALID; } |
139 bool is_memory() const { return type() == MEMORY; } | 139 bool is_memory() const { return type() == MEMORY; } |
140 bool is_register() const { return type() == REGISTER; } | 140 bool is_register() const { return type() == REGISTER; } |
141 bool is_constant() const { return type() == CONSTANT; } | 141 bool is_constant() const { return type() == CONSTANT; } |
142 bool is_copy() const { return type() == COPY; } | 142 bool is_copy() const { return type() == COPY; } |
143 | 143 |
144 bool is_copied() const { return CopiedField::decode(value_); } | 144 bool is_copied() const { return CopiedField::decode(value_); } |
145 void set_copied() { value_ = value_ | CopiedField::encode(true); } | 145 void set_copied() { value_ = value_ | CopiedField::encode(true); } |
146 void clear_copied() { value_ = value_ & ~CopiedField::mask(); } | 146 void clear_copied() { value_ = value_ & ~CopiedField::mask(); } |
147 | 147 |
| 148 // An untagged int32 FrameElement represents a signed int32 |
| 149 // on the stack. These are only allowed in a side-effect-free |
| 150 // int32 calculation, and if a non-int32 input shows up or an overflow |
| 151 // occurs, we bail out and drop all the int32 values. |
| 152 void set_untagged_int32(bool value) { |
| 153 value_ &= ~UntaggedInt32Field::mask(); |
| 154 value_ |= UntaggedInt32Field::encode(value); |
| 155 } |
| 156 bool is_untagged_int32() const { return UntaggedInt32Field::decode(value_); } |
| 157 |
148 Register reg() const { | 158 Register reg() const { |
149 ASSERT(is_register()); | 159 ASSERT(is_register()); |
150 uint32_t reg = DataField::decode(value_); | 160 uint32_t reg = DataField::decode(value_); |
151 Register result; | 161 Register result; |
152 result.code_ = reg; | 162 result.code_ = reg; |
153 return result; | 163 return result; |
154 } | 164 } |
155 | 165 |
156 Handle<Object> handle() const { | 166 Handle<Object> handle() const { |
157 ASSERT(is_constant()); | 167 ASSERT(is_constant()); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 value_ = value_ & ~DataField::mask(); | 258 value_ = value_ & ~DataField::mask(); |
249 value_ = value_ | DataField::encode(new_reg.code_); | 259 value_ = value_ | DataField::encode(new_reg.code_); |
250 } | 260 } |
251 | 261 |
252 // Encode type, copied, synced and data in one 32 bit integer. | 262 // Encode type, copied, synced and data in one 32 bit integer. |
253 uint32_t value_; | 263 uint32_t value_; |
254 | 264 |
255 class TypeField: public BitField<Type, 0, 3> {}; | 265 class TypeField: public BitField<Type, 0, 3> {}; |
256 class CopiedField: public BitField<bool, 3, 1> {}; | 266 class CopiedField: public BitField<bool, 3, 1> {}; |
257 class SyncedField: public BitField<bool, 4, 1> {}; | 267 class SyncedField: public BitField<bool, 4, 1> {}; |
258 class NumberInfoField: public BitField<int, 5, 4> {}; | 268 class UntaggedInt32Field: public BitField<bool, 5, 1> {}; |
259 class DataField: public BitField<uint32_t, 9, 32 - 9> {}; | 269 class NumberInfoField: public BitField<int, 6, 4> {}; |
| 270 class DataField: public BitField<uint32_t, 10, 32 - 10> {}; |
260 | 271 |
261 friend class VirtualFrame; | 272 friend class VirtualFrame; |
262 }; | 273 }; |
263 | 274 |
264 } } // namespace v8::internal | 275 } } // namespace v8::internal |
265 | 276 |
266 #endif // V8_FRAME_ELEMENT_H_ | 277 #endif // V8_FRAME_ELEMENT_H_ |
OLD | NEW |