OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2252 | 2252 |
2253 | 2253 |
2254 class HConstant: public HTemplateInstruction<0> { | 2254 class HConstant: public HTemplateInstruction<0> { |
2255 public: | 2255 public: |
2256 HConstant(Handle<Object> handle, Representation r); | 2256 HConstant(Handle<Object> handle, Representation r); |
2257 | 2257 |
2258 Handle<Object> handle() const { return handle_; } | 2258 Handle<Object> handle() const { return handle_; } |
2259 | 2259 |
2260 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } | 2260 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } |
2261 | 2261 |
| 2262 bool ImmortalImmovable() const { |
| 2263 Heap* heap = HEAP; |
| 2264 if (*handle_ == heap->undefined_value()) return true; |
| 2265 if (*handle_ == heap->null_value()) return true; |
| 2266 if (*handle_ == heap->true_value()) return true; |
| 2267 if (*handle_ == heap->false_value()) return true; |
| 2268 if (*handle_ == heap->the_hole_value()) return true; |
| 2269 if (*handle_ == heap->minus_zero_value()) return true; |
| 2270 if (*handle_ == heap->nan_value()) return true; |
| 2271 if (*handle_ == heap->empty_string()) return true; |
| 2272 return false; |
| 2273 } |
| 2274 |
2262 virtual Representation RequiredInputRepresentation(int index) const { | 2275 virtual Representation RequiredInputRepresentation(int index) const { |
2263 return Representation::None(); | 2276 return Representation::None(); |
2264 } | 2277 } |
2265 | 2278 |
2266 virtual bool IsConvertibleToInteger() const { | 2279 virtual bool IsConvertibleToInteger() const { |
2267 if (handle_->IsSmi()) return true; | 2280 if (handle_->IsSmi()) return true; |
2268 if (handle_->IsHeapNumber() && | 2281 if (handle_->IsHeapNumber() && |
2269 (HeapNumber::cast(*handle_)->value() == | 2282 (HeapNumber::cast(*handle_)->value() == |
2270 static_cast<double>(NumberToInt32(*handle_)))) return true; | 2283 static_cast<double>(NumberToInt32(*handle_)))) return true; |
2271 return false; | 2284 return false; |
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3337 } | 3350 } |
3338 | 3351 |
3339 private: | 3352 private: |
3340 int slot_index_; | 3353 int slot_index_; |
3341 }; | 3354 }; |
3342 | 3355 |
3343 | 3356 |
3344 static inline bool StoringValueNeedsWriteBarrier(HValue* value) { | 3357 static inline bool StoringValueNeedsWriteBarrier(HValue* value) { |
3345 return !value->type().IsBoolean() | 3358 return !value->type().IsBoolean() |
3346 && !value->type().IsSmi() | 3359 && !value->type().IsSmi() |
3347 && !(value->IsConstant() && HConstant::cast(value)->InOldSpace()); | 3360 && !(value->IsConstant() && HConstant::cast(value)->ImmortalImmovable()); |
3348 } | 3361 } |
3349 | 3362 |
3350 | 3363 |
3351 class HStoreContextSlot: public HTemplateInstruction<2> { | 3364 class HStoreContextSlot: public HTemplateInstruction<2> { |
3352 public: | 3365 public: |
3353 HStoreContextSlot(HValue* context, int slot_index, HValue* value) | 3366 HStoreContextSlot(HValue* context, int slot_index, HValue* value) |
3354 : slot_index_(slot_index) { | 3367 : slot_index_(slot_index) { |
3355 SetOperandAt(0, context); | 3368 SetOperandAt(0, context); |
3356 SetOperandAt(1, value); | 3369 SetOperandAt(1, value); |
3357 SetFlag(kChangesContextSlots); | 3370 SetFlag(kChangesContextSlots); |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4203 | 4216 |
4204 DECLARE_CONCRETE_INSTRUCTION(In) | 4217 DECLARE_CONCRETE_INSTRUCTION(In) |
4205 }; | 4218 }; |
4206 | 4219 |
4207 #undef DECLARE_INSTRUCTION | 4220 #undef DECLARE_INSTRUCTION |
4208 #undef DECLARE_CONCRETE_INSTRUCTION | 4221 #undef DECLARE_CONCRETE_INSTRUCTION |
4209 | 4222 |
4210 } } // namespace v8::internal | 4223 } } // namespace v8::internal |
4211 | 4224 |
4212 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4225 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |