| 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 2954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2965 | 2965 |
| 2966 protected: | 2966 protected: |
| 2967 virtual bool DataEquals(HValue* other) { return true; } | 2967 virtual bool DataEquals(HValue* other) { return true; } |
| 2968 }; | 2968 }; |
| 2969 | 2969 |
| 2970 | 2970 |
| 2971 class HCheckPrototypeMaps: public HTemplateInstruction<0> { | 2971 class HCheckPrototypeMaps: public HTemplateInstruction<0> { |
| 2972 public: | 2972 public: |
| 2973 HCheckPrototypeMaps(Handle<JSObject> prototype, | 2973 HCheckPrototypeMaps(Handle<JSObject> prototype, |
| 2974 Handle<JSObject> holder, | 2974 Handle<JSObject> holder, |
| 2975 Zone* zone, | 2975 Zone* zone) |
| 2976 CompilationInfo* info) | |
| 2977 : prototypes_(2, zone), | 2976 : prototypes_(2, zone), |
| 2978 maps_(2, zone), | 2977 maps_(2, zone), |
| 2979 first_prototype_unique_id_(), | 2978 first_prototype_unique_id_(), |
| 2980 last_prototype_unique_id_(), | 2979 last_prototype_unique_id_() { |
| 2981 can_omit_prototype_maps_(true) { | |
| 2982 SetFlag(kUseGVN); | 2980 SetFlag(kUseGVN); |
| 2983 SetGVNFlag(kDependsOnMaps); | 2981 SetGVNFlag(kDependsOnMaps); |
| 2984 // Keep a list of all objects on the prototype chain up to the holder | 2982 // Keep a list of all objects on the prototype chain up to the holder |
| 2985 // and the expected maps. | 2983 // and the expected maps. |
| 2986 while (true) { | 2984 while (true) { |
| 2987 prototypes_.Add(prototype, zone); | 2985 prototypes_.Add(prototype, zone); |
| 2988 Handle<Map> map(prototype->map()); | 2986 maps_.Add(Handle<Map>(prototype->map()), zone); |
| 2989 maps_.Add(map, zone); | |
| 2990 can_omit_prototype_maps_ &= map->CanOmitPrototypeChecks(); | |
| 2991 if (prototype.is_identical_to(holder)) break; | 2987 if (prototype.is_identical_to(holder)) break; |
| 2992 prototype = Handle<JSObject>(JSObject::cast(prototype->GetPrototype())); | 2988 prototype = Handle<JSObject>(JSObject::cast(prototype->GetPrototype())); |
| 2993 } | 2989 } |
| 2994 if (can_omit_prototype_maps_) { | |
| 2995 // Mark in-flight compilation as dependent on those maps. | |
| 2996 for (int i = 0; i < maps()->length(); i++) { | |
| 2997 Handle<Map> map = maps()->at(i); | |
| 2998 map->AddDependentCompilationInfo(DependentCode::kPrototypeCheckGroup, | |
| 2999 info); | |
| 3000 } | |
| 3001 } | |
| 3002 } | 2990 } |
| 3003 | 2991 |
| 3004 ZoneList<Handle<JSObject> >* prototypes() { return &prototypes_; } | 2992 ZoneList<Handle<JSObject> >* prototypes() { return &prototypes_; } |
| 3005 | 2993 |
| 3006 ZoneList<Handle<Map> >* maps() { return &maps_; } | 2994 ZoneList<Handle<Map> >* maps() { return &maps_; } |
| 3007 | 2995 |
| 3008 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps) | 2996 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps) |
| 3009 | 2997 |
| 3010 virtual Representation RequiredInputRepresentation(int index) { | 2998 virtual Representation RequiredInputRepresentation(int index) { |
| 3011 return Representation::None(); | 2999 return Representation::None(); |
| 3012 } | 3000 } |
| 3013 | 3001 |
| 3014 virtual void PrintDataTo(StringStream* stream); | 3002 virtual void PrintDataTo(StringStream* stream); |
| 3015 | 3003 |
| 3016 virtual intptr_t Hashcode() { | 3004 virtual intptr_t Hashcode() { |
| 3017 return first_prototype_unique_id_.Hashcode() * 17 + | 3005 return first_prototype_unique_id_.Hashcode() * 17 + |
| 3018 last_prototype_unique_id_.Hashcode(); | 3006 last_prototype_unique_id_.Hashcode(); |
| 3019 } | 3007 } |
| 3020 | 3008 |
| 3021 virtual void FinalizeUniqueValueId() { | 3009 virtual void FinalizeUniqueValueId() { |
| 3022 first_prototype_unique_id_ = UniqueValueId(prototypes_.first()); | 3010 first_prototype_unique_id_ = UniqueValueId(prototypes_.first()); |
| 3023 last_prototype_unique_id_ = UniqueValueId(prototypes_.last()); | 3011 last_prototype_unique_id_ = UniqueValueId(prototypes_.last()); |
| 3024 } | 3012 } |
| 3025 | 3013 |
| 3026 bool CanOmitPrototypeChecks() { return can_omit_prototype_maps_; } | 3014 bool CanOmitPrototypeChecks() { |
| 3015 for (int i = 0; i < maps()->length(); i++) { |
| 3016 if (!maps()->at(i)->CanOmitPrototypeChecks()) return false; |
| 3017 } |
| 3018 return true; |
| 3019 } |
| 3027 | 3020 |
| 3028 protected: | 3021 protected: |
| 3029 virtual bool DataEquals(HValue* other) { | 3022 virtual bool DataEquals(HValue* other) { |
| 3030 HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other); | 3023 HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other); |
| 3031 return first_prototype_unique_id_ == b->first_prototype_unique_id_ && | 3024 return first_prototype_unique_id_ == b->first_prototype_unique_id_ && |
| 3032 last_prototype_unique_id_ == b->last_prototype_unique_id_; | 3025 last_prototype_unique_id_ == b->last_prototype_unique_id_; |
| 3033 } | 3026 } |
| 3034 | 3027 |
| 3035 private: | 3028 private: |
| 3036 ZoneList<Handle<JSObject> > prototypes_; | 3029 ZoneList<Handle<JSObject> > prototypes_; |
| 3037 ZoneList<Handle<Map> > maps_; | 3030 ZoneList<Handle<Map> > maps_; |
| 3038 UniqueValueId first_prototype_unique_id_; | 3031 UniqueValueId first_prototype_unique_id_; |
| 3039 UniqueValueId last_prototype_unique_id_; | 3032 UniqueValueId last_prototype_unique_id_; |
| 3040 bool can_omit_prototype_maps_; | |
| 3041 }; | 3033 }; |
| 3042 | 3034 |
| 3043 | 3035 |
| 3044 class HPhi: public HValue { | 3036 class HPhi: public HValue { |
| 3045 public: | 3037 public: |
| 3046 HPhi(int merged_index, Zone* zone) | 3038 HPhi(int merged_index, Zone* zone) |
| 3047 : inputs_(2, zone), | 3039 : inputs_(2, zone), |
| 3048 merged_index_(merged_index), | 3040 merged_index_(merged_index), |
| 3049 phi_id_(-1) { | 3041 phi_id_(-1) { |
| 3050 for (int i = 0; i < Representation::kNumRepresentations; i++) { | 3042 for (int i = 0; i < Representation::kNumRepresentations; i++) { |
| (...skipping 2637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5688 | 5680 |
| 5689 class HStoreNamedField: public HTemplateInstruction<2> { | 5681 class HStoreNamedField: public HTemplateInstruction<2> { |
| 5690 public: | 5682 public: |
| 5691 HStoreNamedField(HValue* obj, | 5683 HStoreNamedField(HValue* obj, |
| 5692 HObjectAccess access, | 5684 HObjectAccess access, |
| 5693 HValue* val, | 5685 HValue* val, |
| 5694 Representation field_representation | 5686 Representation field_representation |
| 5695 = Representation::Tagged()) | 5687 = Representation::Tagged()) |
| 5696 : access_(access), | 5688 : access_(access), |
| 5697 field_representation_(field_representation), | 5689 field_representation_(field_representation), |
| 5698 transition_(), | |
| 5699 transition_unique_id_(), | 5690 transition_unique_id_(), |
| 5700 new_space_dominator_(NULL) { | 5691 new_space_dominator_(NULL) { |
| 5701 SetOperandAt(0, obj); | 5692 SetOperandAt(0, obj); |
| 5702 SetOperandAt(1, val); | 5693 SetOperandAt(1, val); |
| 5703 access.SetGVNFlags(this, true); | 5694 access.SetGVNFlags(this, true); |
| 5704 } | 5695 } |
| 5705 | 5696 |
| 5706 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) | 5697 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) |
| 5707 | 5698 |
| 5708 virtual Representation RequiredInputRepresentation(int index) { | 5699 virtual Representation RequiredInputRepresentation(int index) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 5720 new_space_dominator_ = dominator; | 5711 new_space_dominator_ = dominator; |
| 5721 } | 5712 } |
| 5722 virtual void PrintDataTo(StringStream* stream); | 5713 virtual void PrintDataTo(StringStream* stream); |
| 5723 | 5714 |
| 5724 HValue* object() { return OperandAt(0); } | 5715 HValue* object() { return OperandAt(0); } |
| 5725 HValue* value() { return OperandAt(1); } | 5716 HValue* value() { return OperandAt(1); } |
| 5726 | 5717 |
| 5727 HObjectAccess access() const { return access_; } | 5718 HObjectAccess access() const { return access_; } |
| 5728 Handle<Map> transition() const { return transition_; } | 5719 Handle<Map> transition() const { return transition_; } |
| 5729 UniqueValueId transition_unique_id() const { return transition_unique_id_; } | 5720 UniqueValueId transition_unique_id() const { return transition_unique_id_; } |
| 5730 void SetTransition(Handle<Map> map, CompilationInfo* info) { | 5721 void set_transition(Handle<Map> map) { transition_ = map; } |
| 5731 ASSERT(transition_.is_null()); // Only set once. | |
| 5732 if (map->CanBeDeprecated()) { | |
| 5733 map->AddDependentCompilationInfo(DependentCode::kTransitionGroup, info); | |
| 5734 } | |
| 5735 transition_ = map; | |
| 5736 } | |
| 5737 HValue* new_space_dominator() const { return new_space_dominator_; } | 5722 HValue* new_space_dominator() const { return new_space_dominator_; } |
| 5738 | 5723 |
| 5739 bool NeedsWriteBarrier() { | 5724 bool NeedsWriteBarrier() { |
| 5740 ASSERT(!(FLAG_track_double_fields && field_representation_.IsDouble()) || | 5725 ASSERT(!(FLAG_track_double_fields && field_representation_.IsDouble()) || |
| 5741 transition_.is_null()); | 5726 transition_.is_null()); |
| 5742 return (!FLAG_track_fields || !field_representation_.IsSmi()) && | 5727 return (!FLAG_track_fields || !field_representation_.IsSmi()) && |
| 5743 // If there is a transition, a new storage object needs to be allocated. | 5728 // If there is a transition, a new storage object needs to be allocated. |
| 5744 !(FLAG_track_double_fields && field_representation_.IsDouble()) && | 5729 !(FLAG_track_double_fields && field_representation_.IsDouble()) && |
| 5745 StoringValueNeedsWriteBarrier(value()) && | 5730 StoringValueNeedsWriteBarrier(value()) && |
| 5746 ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); | 5731 ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6583 virtual bool IsDeletable() const { return true; } | 6568 virtual bool IsDeletable() const { return true; } |
| 6584 }; | 6569 }; |
| 6585 | 6570 |
| 6586 | 6571 |
| 6587 #undef DECLARE_INSTRUCTION | 6572 #undef DECLARE_INSTRUCTION |
| 6588 #undef DECLARE_CONCRETE_INSTRUCTION | 6573 #undef DECLARE_CONCRETE_INSTRUCTION |
| 6589 | 6574 |
| 6590 } } // namespace v8::internal | 6575 } } // namespace v8::internal |
| 6591 | 6576 |
| 6592 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6577 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |