OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ | 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ |
6 #define V8_HYDROGEN_INSTRUCTIONS_H_ | 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ |
7 | 7 |
8 #include "v8.h" | 8 #include "v8.h" |
9 | 9 |
10 #include "allocation.h" | 10 #include "allocation.h" |
(...skipping 3527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3538 bool NotInNewSpace() const { | 3538 bool NotInNewSpace() const { |
3539 return is_not_in_new_space_; | 3539 return is_not_in_new_space_; |
3540 } | 3540 } |
3541 | 3541 |
3542 bool ImmortalImmovable() const; | 3542 bool ImmortalImmovable() const; |
3543 | 3543 |
3544 bool IsCell() const { | 3544 bool IsCell() const { |
3545 return instance_type_ == CELL_TYPE || instance_type_ == PROPERTY_CELL_TYPE; | 3545 return instance_type_ == CELL_TYPE || instance_type_ == PROPERTY_CELL_TYPE; |
3546 } | 3546 } |
3547 | 3547 |
| 3548 bool IsMap() const { |
| 3549 return instance_type_ == MAP_TYPE; |
| 3550 } |
| 3551 |
3548 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 3552 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
3549 return Representation::None(); | 3553 return Representation::None(); |
3550 } | 3554 } |
3551 | 3555 |
3552 virtual Representation KnownOptimalRepresentation() V8_OVERRIDE { | 3556 virtual Representation KnownOptimalRepresentation() V8_OVERRIDE { |
3553 if (HasSmiValue() && SmiValuesAre31Bits()) return Representation::Smi(); | 3557 if (HasSmiValue() && SmiValuesAre31Bits()) return Representation::Smi(); |
3554 if (HasInteger32Value()) return Representation::Integer32(); | 3558 if (HasInteger32Value()) return Representation::Integer32(); |
3555 if (HasNumberValue()) return Representation::Double(); | 3559 if (HasNumberValue()) return Representation::Double(); |
3556 if (HasExternalReferenceValue()) return Representation::External(); | 3560 if (HasExternalReferenceValue()) return Representation::External(); |
3557 return Representation::Tagged(); | 3561 return Representation::Tagged(); |
(...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5701 // Stores to external references require no write barriers | 5705 // Stores to external references require no write barriers |
5702 return false; | 5706 return false; |
5703 } | 5707 } |
5704 if (object != new_space_dominator) return true; | 5708 if (object != new_space_dominator) return true; |
5705 if (object->IsAllocate()) { | 5709 if (object->IsAllocate()) { |
5706 // Stores to new space allocations require no write barriers if the object | 5710 // Stores to new space allocations require no write barriers if the object |
5707 // is the new space dominator. | 5711 // is the new space dominator. |
5708 if (HAllocate::cast(object)->IsNewSpaceAllocation()) { | 5712 if (HAllocate::cast(object)->IsNewSpaceAllocation()) { |
5709 return false; | 5713 return false; |
5710 } | 5714 } |
| 5715 // Storing a map or an immortal immovable object requires no write barriers |
| 5716 // if the object is the new space dominator. |
| 5717 if (value->IsConstant() && |
| 5718 (HConstant::cast(value)->IsMap() || |
| 5719 HConstant::cast(value)->ImmortalImmovable())) { |
| 5720 return false; |
| 5721 } |
5711 // Likewise we don't need a write barrier if we store a value that | 5722 // Likewise we don't need a write barrier if we store a value that |
5712 // originates from the same allocation (via allocation folding). | 5723 // originates from the same allocation (via allocation folding). |
5713 while (value->IsInnerAllocatedObject()) { | 5724 while (value->IsInnerAllocatedObject()) { |
5714 value = HInnerAllocatedObject::cast(value)->base_object(); | 5725 value = HInnerAllocatedObject::cast(value)->base_object(); |
5715 } | 5726 } |
5716 return object != value; | 5727 return object != value; |
5717 } | 5728 } |
5718 return true; | 5729 return true; |
5719 } | 5730 } |
5720 | 5731 |
(...skipping 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7697 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7708 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7698 }; | 7709 }; |
7699 | 7710 |
7700 | 7711 |
7701 #undef DECLARE_INSTRUCTION | 7712 #undef DECLARE_INSTRUCTION |
7702 #undef DECLARE_CONCRETE_INSTRUCTION | 7713 #undef DECLARE_CONCRETE_INSTRUCTION |
7703 | 7714 |
7704 } } // namespace v8::internal | 7715 } } // namespace v8::internal |
7705 | 7716 |
7706 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7717 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |