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 2859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2870 public: | 2870 public: |
2871 static HCheckMaps* New(Zone* zone, HValue* context, HValue* value, | 2871 static HCheckMaps* New(Zone* zone, HValue* context, HValue* value, |
2872 Handle<Map> map, CompilationInfo* info, | 2872 Handle<Map> map, CompilationInfo* info, |
2873 HValue *typecheck = NULL); | 2873 HValue *typecheck = NULL); |
2874 static HCheckMaps* New(Zone* zone, HValue* context, | 2874 static HCheckMaps* New(Zone* zone, HValue* context, |
2875 HValue* value, SmallMapList* maps, | 2875 HValue* value, SmallMapList* maps, |
2876 HValue *typecheck = NULL) { | 2876 HValue *typecheck = NULL) { |
2877 HCheckMaps* check_map = new(zone) HCheckMaps(value, zone, typecheck); | 2877 HCheckMaps* check_map = new(zone) HCheckMaps(value, zone, typecheck); |
2878 for (int i = 0; i < maps->length(); i++) { | 2878 for (int i = 0; i < maps->length(); i++) { |
2879 check_map->map_set_.Add(maps->at(i), zone); | 2879 check_map->map_set_.Add(maps->at(i), zone); |
| 2880 check_map->has_migration_target_ |= maps->at(i)->is_migration_target(); |
2880 } | 2881 } |
2881 check_map->map_set_.Sort(); | 2882 check_map->map_set_.Sort(); |
2882 return check_map; | 2883 return check_map; |
2883 } | 2884 } |
2884 | 2885 |
2885 bool CanOmitMapChecks() { return omit_; } | 2886 bool CanOmitMapChecks() { return omit_; } |
2886 | 2887 |
2887 virtual bool HasEscapingOperandAt(int index) { return false; } | 2888 virtual bool HasEscapingOperandAt(int index) { return false; } |
2888 virtual Representation RequiredInputRepresentation(int index) { | 2889 virtual Representation RequiredInputRepresentation(int index) { |
2889 return Representation::Tagged(); | 2890 return Representation::Tagged(); |
2890 } | 2891 } |
2891 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 2892 virtual void HandleSideEffectDominator(GVNFlag side_effect, |
2892 HValue* dominator); | 2893 HValue* dominator); |
2893 virtual void PrintDataTo(StringStream* stream); | 2894 virtual void PrintDataTo(StringStream* stream); |
2894 | 2895 |
2895 HValue* value() { return OperandAt(0); } | 2896 HValue* value() { return OperandAt(0); } |
2896 SmallMapList* map_set() { return &map_set_; } | 2897 SmallMapList* map_set() { return &map_set_; } |
2897 | 2898 |
| 2899 bool has_migration_target() { |
| 2900 return has_migration_target_; |
| 2901 } |
| 2902 |
2898 virtual void FinalizeUniqueValueId(); | 2903 virtual void FinalizeUniqueValueId(); |
2899 | 2904 |
2900 DECLARE_CONCRETE_INSTRUCTION(CheckMaps) | 2905 DECLARE_CONCRETE_INSTRUCTION(CheckMaps) |
2901 | 2906 |
2902 protected: | 2907 protected: |
2903 virtual bool DataEquals(HValue* other) { | 2908 virtual bool DataEquals(HValue* other) { |
2904 ASSERT_EQ(map_set_.length(), map_unique_ids_.length()); | 2909 ASSERT_EQ(map_set_.length(), map_unique_ids_.length()); |
2905 HCheckMaps* b = HCheckMaps::cast(other); | 2910 HCheckMaps* b = HCheckMaps::cast(other); |
2906 // Relies on the fact that map_set has been sorted before. | 2911 // Relies on the fact that map_set has been sorted before. |
2907 if (map_unique_ids_.length() != b->map_unique_ids_.length()) { | 2912 if (map_unique_ids_.length() != b->map_unique_ids_.length()) { |
2908 return false; | 2913 return false; |
2909 } | 2914 } |
2910 for (int i = 0; i < map_unique_ids_.length(); i++) { | 2915 for (int i = 0; i < map_unique_ids_.length(); i++) { |
2911 if (map_unique_ids_.at(i) != b->map_unique_ids_.at(i)) { | 2916 if (map_unique_ids_.at(i) != b->map_unique_ids_.at(i)) { |
2912 return false; | 2917 return false; |
2913 } | 2918 } |
2914 } | 2919 } |
2915 return true; | 2920 return true; |
2916 } | 2921 } |
2917 | 2922 |
2918 private: | 2923 private: |
2919 // Clients should use one of the static New* methods above. | 2924 // Clients should use one of the static New* methods above. |
2920 HCheckMaps(HValue* value, Zone *zone, HValue* typecheck) | 2925 HCheckMaps(HValue* value, Zone *zone, HValue* typecheck) |
2921 : HTemplateInstruction<2>(value->type()), | 2926 : HTemplateInstruction<2>(value->type()), |
2922 omit_(false), map_unique_ids_(0, zone) { | 2927 omit_(false), has_migration_target_(false), map_unique_ids_(0, zone) { |
2923 SetOperandAt(0, value); | 2928 SetOperandAt(0, value); |
2924 // Use the object value for the dependency if NULL is passed. | 2929 // Use the object value for the dependency if NULL is passed. |
2925 // TODO(titzer): do GVN flags already express this dependency? | 2930 // TODO(titzer): do GVN flags already express this dependency? |
2926 SetOperandAt(1, typecheck != NULL ? typecheck : value); | 2931 SetOperandAt(1, typecheck != NULL ? typecheck : value); |
2927 set_representation(Representation::Tagged()); | 2932 set_representation(Representation::Tagged()); |
2928 SetFlag(kUseGVN); | 2933 SetFlag(kUseGVN); |
2929 SetFlag(kTrackSideEffectDominators); | 2934 SetFlag(kTrackSideEffectDominators); |
2930 SetGVNFlag(kDependsOnMaps); | 2935 SetGVNFlag(kDependsOnMaps); |
2931 SetGVNFlag(kDependsOnElementsKind); | 2936 SetGVNFlag(kDependsOnElementsKind); |
2932 } | 2937 } |
2933 | 2938 |
2934 void omit(CompilationInfo* info) { | 2939 void omit(CompilationInfo* info) { |
2935 omit_ = true; | 2940 omit_ = true; |
2936 for (int i = 0; i < map_set_.length(); i++) { | 2941 for (int i = 0; i < map_set_.length(); i++) { |
2937 Handle<Map> map = map_set_.at(i); | 2942 Handle<Map> map = map_set_.at(i); |
2938 map->AddDependentCompilationInfo(DependentCode::kPrototypeCheckGroup, | 2943 map->AddDependentCompilationInfo(DependentCode::kPrototypeCheckGroup, |
2939 info); | 2944 info); |
2940 } | 2945 } |
2941 } | 2946 } |
2942 | 2947 |
2943 bool omit_; | 2948 bool omit_; |
| 2949 bool has_migration_target_; |
2944 SmallMapList map_set_; | 2950 SmallMapList map_set_; |
2945 ZoneList<UniqueValueId> map_unique_ids_; | 2951 ZoneList<UniqueValueId> map_unique_ids_; |
2946 }; | 2952 }; |
2947 | 2953 |
2948 | 2954 |
2949 class HCheckFunction: public HUnaryOperation { | 2955 class HCheckFunction: public HUnaryOperation { |
2950 public: | 2956 public: |
2951 DECLARE_INSTRUCTION_FACTORY_P2(HCheckFunction, HValue*, Handle<JSFunction>); | 2957 DECLARE_INSTRUCTION_FACTORY_P2(HCheckFunction, HValue*, Handle<JSFunction>); |
2952 | 2958 |
2953 virtual Representation RequiredInputRepresentation(int index) { | 2959 virtual Representation RequiredInputRepresentation(int index) { |
(...skipping 4213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7167 virtual bool IsDeletable() const { return true; } | 7173 virtual bool IsDeletable() const { return true; } |
7168 }; | 7174 }; |
7169 | 7175 |
7170 | 7176 |
7171 #undef DECLARE_INSTRUCTION | 7177 #undef DECLARE_INSTRUCTION |
7172 #undef DECLARE_CONCRETE_INSTRUCTION | 7178 #undef DECLARE_CONCRETE_INSTRUCTION |
7173 | 7179 |
7174 } } // namespace v8::internal | 7180 } } // namespace v8::internal |
7175 | 7181 |
7176 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7182 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |