OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 V(WrapReceiver) | 199 V(WrapReceiver) |
200 | 200 |
201 #define GVN_TRACKED_FLAG_LIST(V) \ | 201 #define GVN_TRACKED_FLAG_LIST(V) \ |
202 V(Maps) \ | 202 V(Maps) \ |
203 V(NewSpacePromotion) | 203 V(NewSpacePromotion) |
204 | 204 |
205 #define GVN_UNTRACKED_FLAG_LIST(V) \ | 205 #define GVN_UNTRACKED_FLAG_LIST(V) \ |
206 V(Calls) \ | 206 V(Calls) \ |
207 V(InobjectFields) \ | 207 V(InobjectFields) \ |
208 V(BackingStoreFields) \ | 208 V(BackingStoreFields) \ |
| 209 V(DoubleFields) \ |
209 V(ElementsKind) \ | 210 V(ElementsKind) \ |
210 V(ElementsPointer) \ | 211 V(ElementsPointer) \ |
211 V(ArrayElements) \ | 212 V(ArrayElements) \ |
212 V(DoubleArrayElements) \ | 213 V(DoubleArrayElements) \ |
213 V(SpecializedArrayElements) \ | 214 V(SpecializedArrayElements) \ |
214 V(GlobalVars) \ | 215 V(GlobalVars) \ |
215 V(ArrayLengths) \ | 216 V(ArrayLengths) \ |
216 V(ContextSlots) \ | 217 V(ContextSlots) \ |
217 V(OsrEntries) | 218 V(OsrEntries) |
218 | 219 |
(...skipping 4981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5200 | 5201 |
5201 if (FLAG_track_fields && field_representation.IsSmi()) { | 5202 if (FLAG_track_fields && field_representation.IsSmi()) { |
5202 set_type(HType::Smi()); | 5203 set_type(HType::Smi()); |
5203 set_representation(Representation::Tagged()); | 5204 set_representation(Representation::Tagged()); |
5204 } else if (FLAG_track_double_fields && field_representation.IsDouble()) { | 5205 } else if (FLAG_track_double_fields && field_representation.IsDouble()) { |
5205 set_representation(field_representation); | 5206 set_representation(field_representation); |
5206 } else { | 5207 } else { |
5207 set_representation(Representation::Tagged()); | 5208 set_representation(Representation::Tagged()); |
5208 } | 5209 } |
5209 SetFlag(kUseGVN); | 5210 SetFlag(kUseGVN); |
5210 SetGVNFlag(kDependsOnMaps); | 5211 if (FLAG_track_double_fields && representation().IsDouble()) { |
5211 if (is_in_object) { | 5212 ASSERT(is_in_object); |
| 5213 ASSERT(offset == HeapNumber::kValueOffset); |
| 5214 SetGVNFlag(kDependsOnDoubleFields); |
| 5215 } else if (is_in_object) { |
5212 SetGVNFlag(kDependsOnInobjectFields); | 5216 SetGVNFlag(kDependsOnInobjectFields); |
| 5217 SetGVNFlag(kDependsOnMaps); |
5213 } else { | 5218 } else { |
5214 SetGVNFlag(kDependsOnBackingStoreFields); | 5219 SetGVNFlag(kDependsOnBackingStoreFields); |
| 5220 SetGVNFlag(kDependsOnMaps); |
5215 } | 5221 } |
5216 } | 5222 } |
5217 | 5223 |
5218 static HLoadNamedField* NewArrayLength(Zone* zone, HValue* object, | 5224 static HLoadNamedField* NewArrayLength(Zone* zone, HValue* object, |
5219 HValue* typecheck, | 5225 HValue* typecheck, |
5220 HType type = HType::Tagged()) { | 5226 HType type = HType::Tagged()) { |
5221 Representation representation = | 5227 Representation representation = |
5222 type.IsSmi() ? Representation::Smi() : Representation::Tagged(); | 5228 type.IsSmi() ? Representation::Smi() : Representation::Tagged(); |
5223 HLoadNamedField* result = new(zone) HLoadNamedField( | 5229 HLoadNamedField* result = new(zone) HLoadNamedField( |
5224 object, true, representation, JSArray::kLengthOffset, typecheck); | 5230 object, true, representation, JSArray::kLengthOffset, typecheck); |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5544 | 5550 |
5545 virtual HValue* Canonicalize(); | 5551 virtual HValue* Canonicalize(); |
5546 | 5552 |
5547 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) | 5553 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) |
5548 }; | 5554 }; |
5549 | 5555 |
5550 | 5556 |
5551 class HStoreNamedField: public HTemplateInstruction<2> { | 5557 class HStoreNamedField: public HTemplateInstruction<2> { |
5552 public: | 5558 public: |
5553 HStoreNamedField(HValue* obj, | 5559 HStoreNamedField(HValue* obj, |
5554 Handle<String> name, | 5560 Handle<Name> name, |
5555 HValue* val, | 5561 HValue* val, |
5556 bool in_object, | 5562 bool in_object, |
5557 Representation field_representation, | 5563 Representation field_representation, |
5558 int offset) | 5564 int offset) |
5559 : name_(name), | 5565 : name_(name), |
5560 is_in_object_(in_object), | 5566 is_in_object_(in_object), |
5561 field_representation_(field_representation), | 5567 field_representation_(field_representation), |
5562 offset_(offset), | 5568 offset_(offset), |
5563 transition_unique_id_(), | 5569 transition_unique_id_(), |
5564 new_space_dominator_(NULL) { | 5570 new_space_dominator_(NULL) { |
5565 SetOperandAt(0, obj); | 5571 SetOperandAt(0, obj); |
5566 SetOperandAt(1, val); | 5572 SetOperandAt(1, val); |
5567 SetFlag(kTrackSideEffectDominators); | 5573 SetFlag(kTrackSideEffectDominators); |
5568 SetGVNFlag(kDependsOnNewSpacePromotion); | 5574 if (FLAG_track_double_fields && field_representation.IsDouble()) { |
5569 if (is_in_object_) { | 5575 SetGVNFlag(kChangesDoubleFields); |
| 5576 } else if (is_in_object_) { |
5570 SetGVNFlag(kChangesInobjectFields); | 5577 SetGVNFlag(kChangesInobjectFields); |
| 5578 SetGVNFlag(kDependsOnNewSpacePromotion); |
5571 } else { | 5579 } else { |
5572 SetGVNFlag(kChangesBackingStoreFields); | 5580 SetGVNFlag(kChangesBackingStoreFields); |
| 5581 SetGVNFlag(kDependsOnNewSpacePromotion); |
5573 } | 5582 } |
5574 } | 5583 } |
5575 | 5584 |
5576 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) | 5585 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) |
5577 | 5586 |
5578 virtual Representation RequiredInputRepresentation(int index) { | 5587 virtual Representation RequiredInputRepresentation(int index) { |
5579 if (FLAG_track_fields && index == 1 && field_representation_.IsSmi()) { | 5588 if (FLAG_track_double_fields && |
| 5589 index == 1 && field_representation_.IsDouble()) { |
| 5590 return field_representation_; |
| 5591 } else if (FLAG_track_fields && |
| 5592 index == 1 && field_representation_.IsSmi()) { |
5580 return Representation::Integer32(); | 5593 return Representation::Integer32(); |
5581 } | 5594 } |
5582 return Representation::Tagged(); | 5595 return Representation::Tagged(); |
5583 } | 5596 } |
5584 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { | 5597 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { |
5585 ASSERT(side_effect == kChangesNewSpacePromotion); | 5598 ASSERT(side_effect == kChangesNewSpacePromotion); |
5586 new_space_dominator_ = dominator; | 5599 new_space_dominator_ = dominator; |
5587 } | 5600 } |
5588 virtual void PrintDataTo(StringStream* stream); | 5601 virtual void PrintDataTo(StringStream* stream); |
5589 | 5602 |
5590 HValue* object() { return OperandAt(0); } | 5603 HValue* object() { return OperandAt(0); } |
5591 HValue* value() { return OperandAt(1); } | 5604 HValue* value() { return OperandAt(1); } |
5592 | 5605 |
5593 Handle<String> name() const { return name_; } | 5606 Handle<Name> name() const { return name_; } |
5594 bool is_in_object() const { return is_in_object_; } | 5607 bool is_in_object() const { return is_in_object_; } |
5595 int offset() const { return offset_; } | 5608 int offset() const { return offset_; } |
5596 Handle<Map> transition() const { return transition_; } | 5609 Handle<Map> transition() const { return transition_; } |
5597 UniqueValueId transition_unique_id() const { return transition_unique_id_; } | 5610 UniqueValueId transition_unique_id() const { return transition_unique_id_; } |
5598 void set_transition(Handle<Map> map) { transition_ = map; } | 5611 void set_transition(Handle<Map> map) { transition_ = map; } |
5599 HValue* new_space_dominator() const { return new_space_dominator_; } | 5612 HValue* new_space_dominator() const { return new_space_dominator_; } |
5600 | 5613 |
5601 bool NeedsWriteBarrier() { | 5614 bool NeedsWriteBarrier() { |
| 5615 ASSERT(!(FLAG_track_double_fields && field_representation_.IsDouble()) || |
| 5616 transition_.is_null()); |
5602 return (!FLAG_track_fields || !field_representation_.IsSmi()) && | 5617 return (!FLAG_track_fields || !field_representation_.IsSmi()) && |
| 5618 // If there is a transition, a new storage object needs to be allocated. |
| 5619 !(FLAG_track_double_fields && field_representation_.IsDouble()) && |
5603 StoringValueNeedsWriteBarrier(value()) && | 5620 StoringValueNeedsWriteBarrier(value()) && |
5604 ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); | 5621 ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); |
5605 } | 5622 } |
5606 | 5623 |
5607 bool NeedsWriteBarrierForMap() { | 5624 bool NeedsWriteBarrierForMap() { |
5608 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); | 5625 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); |
5609 } | 5626 } |
5610 | 5627 |
5611 virtual void FinalizeUniqueValueId() { | 5628 virtual void FinalizeUniqueValueId() { |
5612 transition_unique_id_ = UniqueValueId(transition_); | 5629 transition_unique_id_ = UniqueValueId(transition_); |
5613 } | 5630 } |
5614 | 5631 |
5615 Representation field_representation() const { | 5632 Representation field_representation() const { |
5616 return field_representation_; | 5633 return field_representation_; |
5617 } | 5634 } |
5618 | 5635 |
5619 private: | 5636 private: |
5620 Handle<String> name_; | 5637 Handle<Name> name_; |
5621 bool is_in_object_; | 5638 bool is_in_object_; |
5622 Representation field_representation_; | 5639 Representation field_representation_; |
5623 int offset_; | 5640 int offset_; |
5624 Handle<Map> transition_; | 5641 Handle<Map> transition_; |
5625 UniqueValueId transition_unique_id_; | 5642 UniqueValueId transition_unique_id_; |
5626 HValue* new_space_dominator_; | 5643 HValue* new_space_dominator_; |
5627 }; | 5644 }; |
5628 | 5645 |
5629 | 5646 |
5630 class HStoreNamedGeneric: public HTemplateInstruction<3> { | 5647 class HStoreNamedGeneric: public HTemplateInstruction<3> { |
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6522 virtual bool IsDeletable() const { return true; } | 6539 virtual bool IsDeletable() const { return true; } |
6523 }; | 6540 }; |
6524 | 6541 |
6525 | 6542 |
6526 #undef DECLARE_INSTRUCTION | 6543 #undef DECLARE_INSTRUCTION |
6527 #undef DECLARE_CONCRETE_INSTRUCTION | 6544 #undef DECLARE_CONCRETE_INSTRUCTION |
6528 | 6545 |
6529 } } // namespace v8::internal | 6546 } } // namespace v8::internal |
6530 | 6547 |
6531 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6548 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |