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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 227 |
228 #define DECLARE_CONCRETE_INSTRUCTION(type) \ | 228 #define DECLARE_CONCRETE_INSTRUCTION(type) \ |
229 virtual LInstruction* CompileToLithium(LChunkBuilder* builder); \ | 229 virtual LInstruction* CompileToLithium(LChunkBuilder* builder); \ |
230 static H##type* cast(HValue* value) { \ | 230 static H##type* cast(HValue* value) { \ |
231 ASSERT(value->Is##type()); \ | 231 ASSERT(value->Is##type()); \ |
232 return reinterpret_cast<H##type*>(value); \ | 232 return reinterpret_cast<H##type*>(value); \ |
233 } \ | 233 } \ |
234 virtual Opcode opcode() const { return HValue::k##type; } | 234 virtual Opcode opcode() const { return HValue::k##type; } |
235 | 235 |
236 | 236 |
237 #ifdef DEBUG | |
238 #define ASSERT_ALLOCATION_DISABLED \ | |
239 ASSERT(isolate()->optimizing_compiler_thread()->IsOptimizerThread() || \ | |
240 !isolate()->heap()->IsAllocationAllowed()) | |
241 #else | |
242 #define ASSERT_ALLOCATION_DISABLED do {} while (0) | |
243 #endif | |
244 | |
245 class Range: public ZoneObject { | 237 class Range: public ZoneObject { |
246 public: | 238 public: |
247 Range() | 239 Range() |
248 : lower_(kMinInt), | 240 : lower_(kMinInt), |
249 upper_(kMaxInt), | 241 upper_(kMaxInt), |
250 next_(NULL), | 242 next_(NULL), |
251 can_be_minus_zero_(false) { } | 243 can_be_minus_zero_(false) { } |
252 | 244 |
253 Range(int32_t lower, int32_t upper) | 245 Range(int32_t lower, int32_t upper) |
254 : lower_(lower), | 246 : lower_(lower), |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 | 1042 |
1051 // This gives the instruction an opportunity to replace itself with an | 1043 // This gives the instruction an opportunity to replace itself with an |
1052 // instruction that does the same in some better way. To replace an | 1044 // instruction that does the same in some better way. To replace an |
1053 // instruction with a new one, first add the new instruction to the graph, | 1045 // instruction with a new one, first add the new instruction to the graph, |
1054 // then return it. Return NULL to have the instruction deleted. | 1046 // then return it. Return NULL to have the instruction deleted. |
1055 virtual HValue* Canonicalize() { return this; } | 1047 virtual HValue* Canonicalize() { return this; } |
1056 | 1048 |
1057 bool Equals(HValue* other); | 1049 bool Equals(HValue* other); |
1058 virtual intptr_t Hashcode(); | 1050 virtual intptr_t Hashcode(); |
1059 | 1051 |
| 1052 // Some instructions' hash code is dependent on object addresses and are not |
| 1053 // safe regarding GC and parallel recompilation. Compute the hash upfront. |
| 1054 virtual void FinalizeUniqueId() { } |
| 1055 |
1060 // Printing support. | 1056 // Printing support. |
1061 virtual void PrintTo(StringStream* stream) = 0; | 1057 virtual void PrintTo(StringStream* stream) = 0; |
1062 void PrintNameTo(StringStream* stream); | 1058 void PrintNameTo(StringStream* stream); |
1063 void PrintTypeTo(StringStream* stream); | 1059 void PrintTypeTo(StringStream* stream); |
1064 void PrintRangeTo(StringStream* stream); | 1060 void PrintRangeTo(StringStream* stream); |
1065 void PrintChangesTo(StringStream* stream); | 1061 void PrintChangesTo(StringStream* stream); |
1066 | 1062 |
1067 const char* Mnemonic() const; | 1063 const char* Mnemonic() const; |
1068 | 1064 |
1069 // Type information helpers. | 1065 // Type information helpers. |
(...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2636 virtual bool DataEquals(HValue* other) { return true; } | 2632 virtual bool DataEquals(HValue* other) { return true; } |
2637 | 2633 |
2638 private: | 2634 private: |
2639 virtual bool IsDeletable() const { return true; } | 2635 virtual bool IsDeletable() const { return true; } |
2640 }; | 2636 }; |
2641 | 2637 |
2642 | 2638 |
2643 class HCheckMaps: public HTemplateInstruction<2> { | 2639 class HCheckMaps: public HTemplateInstruction<2> { |
2644 public: | 2640 public: |
2645 HCheckMaps(HValue* value, Handle<Map> map, Zone* zone, | 2641 HCheckMaps(HValue* value, Handle<Map> map, Zone* zone, |
2646 HValue* typecheck = NULL) { | 2642 HValue* typecheck = NULL) |
| 2643 : map_raw_addresses_(0, zone) { |
2647 SetOperandAt(0, value); | 2644 SetOperandAt(0, value); |
2648 // If callers don't depend on a typecheck, they can pass in NULL. In that | 2645 // If callers don't depend on a typecheck, they can pass in NULL. In that |
2649 // case we use a copy of the |value| argument as a dummy value. | 2646 // case we use a copy of the |value| argument as a dummy value. |
2650 SetOperandAt(1, typecheck != NULL ? typecheck : value); | 2647 SetOperandAt(1, typecheck != NULL ? typecheck : value); |
2651 set_representation(Representation::Tagged()); | 2648 set_representation(Representation::Tagged()); |
2652 SetFlag(kUseGVN); | 2649 SetFlag(kUseGVN); |
2653 SetFlag(kTrackSideEffectDominators); | 2650 SetFlag(kTrackSideEffectDominators); |
2654 SetGVNFlag(kDependsOnMaps); | 2651 SetGVNFlag(kDependsOnMaps); |
2655 SetGVNFlag(kDependsOnElementsKind); | 2652 SetGVNFlag(kDependsOnElementsKind); |
2656 map_set()->Add(map, zone); | 2653 map_set()->Add(map, zone); |
2657 } | 2654 } |
2658 HCheckMaps(HValue* value, SmallMapList* maps, Zone* zone) { | 2655 HCheckMaps(HValue* value, SmallMapList* maps, Zone* zone) |
| 2656 : map_raw_addresses_(0, zone) { |
2659 SetOperandAt(0, value); | 2657 SetOperandAt(0, value); |
2660 SetOperandAt(1, value); | 2658 SetOperandAt(1, value); |
2661 set_representation(Representation::Tagged()); | 2659 set_representation(Representation::Tagged()); |
2662 SetFlag(kUseGVN); | 2660 SetFlag(kUseGVN); |
2663 SetFlag(kTrackSideEffectDominators); | 2661 SetFlag(kTrackSideEffectDominators); |
2664 SetGVNFlag(kDependsOnMaps); | 2662 SetGVNFlag(kDependsOnMaps); |
2665 SetGVNFlag(kDependsOnElementsKind); | 2663 SetGVNFlag(kDependsOnElementsKind); |
2666 for (int i = 0; i < maps->length(); i++) { | 2664 for (int i = 0; i < maps->length(); i++) { |
2667 map_set()->Add(maps->at(i), zone); | 2665 map_set()->Add(maps->at(i), zone); |
2668 } | 2666 } |
(...skipping 26 matching lines...) Expand all Loading... |
2695 virtual Representation RequiredInputRepresentation(int index) { | 2693 virtual Representation RequiredInputRepresentation(int index) { |
2696 return Representation::Tagged(); | 2694 return Representation::Tagged(); |
2697 } | 2695 } |
2698 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator); | 2696 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator); |
2699 virtual void PrintDataTo(StringStream* stream); | 2697 virtual void PrintDataTo(StringStream* stream); |
2700 virtual HType CalculateInferredType(); | 2698 virtual HType CalculateInferredType(); |
2701 | 2699 |
2702 HValue* value() { return OperandAt(0); } | 2700 HValue* value() { return OperandAt(0); } |
2703 SmallMapList* map_set() { return &map_set_; } | 2701 SmallMapList* map_set() { return &map_set_; } |
2704 | 2702 |
| 2703 virtual void FinalizeUniqueId(); |
| 2704 |
2705 DECLARE_CONCRETE_INSTRUCTION(CheckMaps) | 2705 DECLARE_CONCRETE_INSTRUCTION(CheckMaps) |
2706 | 2706 |
2707 protected: | 2707 protected: |
2708 virtual bool DataEquals(HValue* other) { | 2708 virtual bool DataEquals(HValue* other) { |
| 2709 ASSERT_EQ(map_set_.length(), map_raw_addresses_.length()); |
2709 HCheckMaps* b = HCheckMaps::cast(other); | 2710 HCheckMaps* b = HCheckMaps::cast(other); |
2710 // Relies on the fact that map_set has been sorted before. | 2711 // Relies on the fact that map_set has been sorted before. |
2711 if (map_set()->length() != b->map_set()->length()) return false; | 2712 if (map_raw_addresses_.length() != b->map_raw_addresses_.length()) { |
2712 for (int i = 0; i < map_set()->length(); i++) { | 2713 return false; |
2713 if (!map_set()->at(i).is_identical_to(b->map_set()->at(i))) return false; | 2714 } |
| 2715 for (int i = 0; i < map_raw_addresses_.length(); i++) { |
| 2716 if (map_raw_addresses_.at(i) != b->map_raw_addresses_.at(i)) { |
| 2717 return false; |
| 2718 } |
2714 } | 2719 } |
2715 return true; | 2720 return true; |
2716 } | 2721 } |
2717 | 2722 |
2718 private: | 2723 private: |
2719 SmallMapList map_set_; | 2724 SmallMapList map_set_; |
| 2725 ZoneList<Address> map_raw_addresses_; |
2720 }; | 2726 }; |
2721 | 2727 |
2722 | 2728 |
2723 class HCheckFunction: public HUnaryOperation { | 2729 class HCheckFunction: public HUnaryOperation { |
2724 public: | 2730 public: |
2725 HCheckFunction(HValue* value, Handle<JSFunction> function) | 2731 HCheckFunction(HValue* value, Handle<JSFunction> function) |
2726 : HUnaryOperation(value), target_(function) { | 2732 : HUnaryOperation(value), target_(function), raw_address_(NULL) { |
2727 set_representation(Representation::Tagged()); | 2733 set_representation(Representation::Tagged()); |
2728 SetFlag(kUseGVN); | 2734 SetFlag(kUseGVN); |
2729 target_in_new_space_ = Isolate::Current()->heap()->InNewSpace(*function); | 2735 target_in_new_space_ = Isolate::Current()->heap()->InNewSpace(*function); |
2730 } | 2736 } |
2731 | 2737 |
2732 virtual Representation RequiredInputRepresentation(int index) { | 2738 virtual Representation RequiredInputRepresentation(int index) { |
2733 return Representation::Tagged(); | 2739 return Representation::Tagged(); |
2734 } | 2740 } |
2735 virtual void PrintDataTo(StringStream* stream); | 2741 virtual void PrintDataTo(StringStream* stream); |
2736 virtual HType CalculateInferredType(); | 2742 virtual HType CalculateInferredType(); |
2737 | 2743 |
2738 #ifdef DEBUG | 2744 #ifdef DEBUG |
2739 virtual void Verify(); | 2745 virtual void Verify(); |
2740 #endif | 2746 #endif |
2741 | 2747 |
| 2748 virtual void FinalizeUniqueId() { |
| 2749 // Raw address may have already been collected. |
| 2750 ASSERT(raw_address_ == NULL || |
| 2751 raw_address_ == reinterpret_cast<Address>(*target_)); |
| 2752 raw_address_ = reinterpret_cast<Address>(*target_); |
| 2753 } |
| 2754 |
2742 Handle<JSFunction> target() const { return target_; } | 2755 Handle<JSFunction> target() const { return target_; } |
2743 bool target_in_new_space() const { return target_in_new_space_; } | 2756 bool target_in_new_space() const { return target_in_new_space_; } |
2744 | 2757 |
2745 DECLARE_CONCRETE_INSTRUCTION(CheckFunction) | 2758 DECLARE_CONCRETE_INSTRUCTION(CheckFunction) |
2746 | 2759 |
2747 protected: | 2760 protected: |
2748 virtual bool DataEquals(HValue* other) { | 2761 virtual bool DataEquals(HValue* other) { |
2749 HCheckFunction* b = HCheckFunction::cast(other); | 2762 HCheckFunction* b = HCheckFunction::cast(other); |
2750 return target_.is_identical_to(b->target()); | 2763 ASSERT_NE(NULL, raw_address_); |
| 2764 return raw_address_ == b->raw_address_; |
2751 } | 2765 } |
2752 | 2766 |
2753 private: | 2767 private: |
2754 Handle<JSFunction> target_; | 2768 Handle<JSFunction> target_; |
| 2769 Address raw_address_; |
2755 bool target_in_new_space_; | 2770 bool target_in_new_space_; |
2756 }; | 2771 }; |
2757 | 2772 |
2758 | 2773 |
2759 class HCheckInstanceType: public HUnaryOperation { | 2774 class HCheckInstanceType: public HUnaryOperation { |
2760 public: | 2775 public: |
2761 static HCheckInstanceType* NewIsSpecObject(HValue* value, Zone* zone) { | 2776 static HCheckInstanceType* NewIsSpecObject(HValue* value, Zone* zone) { |
2762 return new(zone) HCheckInstanceType(value, IS_SPEC_OBJECT); | 2777 return new(zone) HCheckInstanceType(value, IS_SPEC_OBJECT); |
2763 } | 2778 } |
2764 static HCheckInstanceType* NewIsJSArray(HValue* value, Zone* zone) { | 2779 static HCheckInstanceType* NewIsJSArray(HValue* value, Zone* zone) { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2849 | 2864 |
2850 protected: | 2865 protected: |
2851 virtual bool DataEquals(HValue* other) { return true; } | 2866 virtual bool DataEquals(HValue* other) { return true; } |
2852 }; | 2867 }; |
2853 | 2868 |
2854 | 2869 |
2855 class HCheckPrototypeMaps: public HTemplateInstruction<0> { | 2870 class HCheckPrototypeMaps: public HTemplateInstruction<0> { |
2856 public: | 2871 public: |
2857 HCheckPrototypeMaps(Handle<JSObject> prototype, | 2872 HCheckPrototypeMaps(Handle<JSObject> prototype, |
2858 Handle<JSObject> holder, | 2873 Handle<JSObject> holder, |
2859 Zone* zone) : prototypes_(2, zone), maps_(2, zone) { | 2874 Zone* zone) |
| 2875 : prototypes_(2, zone), |
| 2876 maps_(2, zone), |
| 2877 first_prototype_raw_address_(NULL), |
| 2878 last_prototype_raw_address_(NULL) { |
2860 SetFlag(kUseGVN); | 2879 SetFlag(kUseGVN); |
2861 SetGVNFlag(kDependsOnMaps); | 2880 SetGVNFlag(kDependsOnMaps); |
2862 // Keep a list of all objects on the prototype chain up to the holder | 2881 // Keep a list of all objects on the prototype chain up to the holder |
2863 // and the expected maps. | 2882 // and the expected maps. |
2864 while (true) { | 2883 while (true) { |
2865 prototypes_.Add(prototype, zone); | 2884 prototypes_.Add(prototype, zone); |
2866 maps_.Add(Handle<Map>(prototype->map()), zone); | 2885 maps_.Add(Handle<Map>(prototype->map()), zone); |
2867 if (prototype.is_identical_to(holder)) break; | 2886 if (prototype.is_identical_to(holder)) break; |
2868 prototype = Handle<JSObject>(JSObject::cast(prototype->GetPrototype())); | 2887 prototype = Handle<JSObject>(JSObject::cast(prototype->GetPrototype())); |
2869 } | 2888 } |
2870 } | 2889 } |
2871 | 2890 |
2872 ZoneList<Handle<JSObject> >* prototypes() { return &prototypes_; } | 2891 ZoneList<Handle<JSObject> >* prototypes() { return &prototypes_; } |
2873 | 2892 |
2874 ZoneList<Handle<Map> >* maps() { return &maps_; } | 2893 ZoneList<Handle<Map> >* maps() { return &maps_; } |
2875 | 2894 |
2876 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps) | 2895 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps) |
2877 | 2896 |
2878 virtual Representation RequiredInputRepresentation(int index) { | 2897 virtual Representation RequiredInputRepresentation(int index) { |
2879 return Representation::None(); | 2898 return Representation::None(); |
2880 } | 2899 } |
2881 | 2900 |
2882 virtual void PrintDataTo(StringStream* stream); | 2901 virtual void PrintDataTo(StringStream* stream); |
2883 | 2902 |
2884 virtual intptr_t Hashcode() { | 2903 virtual intptr_t Hashcode() { |
2885 ASSERT_ALLOCATION_DISABLED; | 2904 ASSERT_NE(NULL, last_prototype_raw_address_); |
2886 // Dereferencing to use the object's raw address for hashing is safe. | 2905 return reinterpret_cast<intptr_t>(first_prototype_raw_address_) * 17 + |
2887 HandleDereferenceGuard allow_handle_deref(isolate(), | 2906 reinterpret_cast<intptr_t>(last_prototype_raw_address_); |
2888 HandleDereferenceGuard::ALLOW); | 2907 } |
2889 SLOW_ASSERT(Heap::RelocationLock::IsLocked(isolate()->heap()) || | 2908 |
2890 !isolate()->optimizing_compiler_thread()->IsOptimizerThread()); | 2909 virtual void FinalizeUniqueId() { |
2891 intptr_t hash = 0; | 2910 // Raw addresses may have already been collected. |
2892 for (int i = 0; i < prototypes_.length(); i++) { | 2911 ASSERT(first_prototype_raw_address_ == 0 || |
2893 hash = 17 * hash + reinterpret_cast<intptr_t>(*prototypes_[i]); | 2912 first_prototype_raw_address_ == |
2894 hash = 17 * hash + reinterpret_cast<intptr_t>(*maps_[i]); | 2913 reinterpret_cast<Address>(*prototypes_.first())); |
2895 } | 2914 first_prototype_raw_address_ = |
2896 return hash; | 2915 reinterpret_cast<Address>(*prototypes_.first()); |
| 2916 ASSERT(last_prototype_raw_address_ == 0 || |
| 2917 last_prototype_raw_address_ == |
| 2918 reinterpret_cast<Address>(*prototypes_.last())); |
| 2919 last_prototype_raw_address_ = |
| 2920 reinterpret_cast<Address>(*prototypes_.last()); |
2897 } | 2921 } |
2898 | 2922 |
2899 bool CanOmitPrototypeChecks() { | 2923 bool CanOmitPrototypeChecks() { |
2900 for (int i = 0; i < maps()->length(); i++) { | 2924 for (int i = 0; i < maps()->length(); i++) { |
2901 if (!maps()->at(i)->CanOmitPrototypeChecks()) return false; | 2925 if (!maps()->at(i)->CanOmitPrototypeChecks()) return false; |
2902 } | 2926 } |
2903 return true; | 2927 return true; |
2904 } | 2928 } |
2905 | 2929 |
2906 protected: | 2930 protected: |
2907 virtual bool DataEquals(HValue* other) { | 2931 virtual bool DataEquals(HValue* other) { |
2908 HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other); | 2932 HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other); |
2909 #ifdef DEBUG | 2933 ASSERT_NE(NULL, first_prototype_raw_address_); |
2910 if (prototypes_.length() != b->prototypes()->length()) return false; | 2934 return first_prototype_raw_address_ == b->first_prototype_raw_address_ && |
2911 for (int i = 0; i < prototypes_.length(); i++) { | 2935 last_prototype_raw_address_ == b->last_prototype_raw_address_; |
2912 if (!prototypes_[i].is_identical_to(b->prototypes()->at(i))) return false; | |
2913 if (!maps_[i].is_identical_to(b->maps()->at(i))) return false; | |
2914 } | |
2915 return true; | |
2916 #else | |
2917 return prototypes_.first().is_identical_to(b->prototypes()->first()) && | |
2918 prototypes_.last().is_identical_to(b->prototypes()->last()); | |
2919 #endif // DEBUG | |
2920 } | 2936 } |
2921 | 2937 |
2922 private: | 2938 private: |
2923 ZoneList<Handle<JSObject> > prototypes_; | 2939 ZoneList<Handle<JSObject> > prototypes_; |
2924 ZoneList<Handle<Map> > maps_; | 2940 ZoneList<Handle<Map> > maps_; |
| 2941 Address first_prototype_raw_address_; |
| 2942 Address last_prototype_raw_address_; |
2925 }; | 2943 }; |
2926 | 2944 |
2927 | 2945 |
2928 class HCheckSmi: public HUnaryOperation { | 2946 class HCheckSmi: public HUnaryOperation { |
2929 public: | 2947 public: |
2930 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) { | 2948 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) { |
2931 set_representation(Representation::Tagged()); | 2949 set_representation(Representation::Tagged()); |
2932 SetFlag(kUseGVN); | 2950 SetFlag(kUseGVN); |
2933 } | 2951 } |
2934 | 2952 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3169 class HConstant: public HTemplateInstruction<0> { | 3187 class HConstant: public HTemplateInstruction<0> { |
3170 public: | 3188 public: |
3171 HConstant(Handle<Object> handle, Representation r); | 3189 HConstant(Handle<Object> handle, Representation r); |
3172 HConstant(int32_t value, | 3190 HConstant(int32_t value, |
3173 Representation r, | 3191 Representation r, |
3174 Handle<Object> optional_handle = Handle<Object>::null()); | 3192 Handle<Object> optional_handle = Handle<Object>::null()); |
3175 HConstant(double value, | 3193 HConstant(double value, |
3176 Representation r, | 3194 Representation r, |
3177 Handle<Object> optional_handle = Handle<Object>::null()); | 3195 Handle<Object> optional_handle = Handle<Object>::null()); |
3178 HConstant(Handle<Object> handle, | 3196 HConstant(Handle<Object> handle, |
| 3197 Address raw_address, |
3179 Representation r, | 3198 Representation r, |
3180 HType type, | 3199 HType type, |
3181 bool is_internalized_string, | 3200 bool is_internalized_string, |
3182 bool boolean_value); | 3201 bool boolean_value); |
3183 | 3202 |
3184 Handle<Object> handle() { | 3203 Handle<Object> handle() { |
3185 if (handle_.is_null()) { | 3204 if (handle_.is_null()) { |
3186 handle_ = FACTORY->NewNumber(double_value_, TENURED); | 3205 handle_ = FACTORY->NewNumber(double_value_, TENURED); |
3187 } | 3206 } |
3188 ASSERT(has_int32_value_ || !handle_->IsSmi()); | 3207 ASSERT(has_int32_value_ || !handle_->IsSmi()); |
3189 return handle_; | 3208 return handle_; |
3190 } | 3209 } |
3191 | 3210 |
3192 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } | |
3193 | |
3194 bool IsSpecialDouble() const { | 3211 bool IsSpecialDouble() const { |
3195 return has_double_value_ && | 3212 return has_double_value_ && |
3196 (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) || | 3213 (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) || |
3197 FixedDoubleArray::is_the_hole_nan(double_value_) || | 3214 FixedDoubleArray::is_the_hole_nan(double_value_) || |
3198 isnan(double_value_)); | 3215 isnan(double_value_)); |
3199 } | 3216 } |
3200 | 3217 |
3201 bool ImmortalImmovable() const { | 3218 bool ImmortalImmovable() const { |
3202 if (has_int32_value_) { | 3219 if (has_int32_value_) { |
3203 return false; | 3220 return false; |
3204 } | 3221 } |
3205 if (has_double_value_) { | 3222 if (has_double_value_) { |
3206 if (IsSpecialDouble()) { | 3223 if (IsSpecialDouble()) { |
3207 return true; | 3224 return true; |
3208 } | 3225 } |
3209 return false; | 3226 return false; |
3210 } | 3227 } |
3211 | 3228 |
3212 ASSERT(!handle_.is_null()); | 3229 ASSERT(!handle_.is_null()); |
| 3230 HandleDereferenceGuard allow_dereference_for_immovable_check( |
| 3231 isolate(), HandleDereferenceGuard::ALLOW); |
| 3232 ASSERT_NE(NULL, raw_address_); |
| 3233 Object* obj = reinterpret_cast<Object*>(raw_address_); |
3213 Heap* heap = isolate()->heap(); | 3234 Heap* heap = isolate()->heap(); |
3214 // We should have handled minus_zero_value and nan_value in the | 3235 ASSERT(obj != heap->minus_zero_value()); |
3215 // has_double_value_ clause above. | 3236 ASSERT(obj != heap->nan_value()); |
3216 // Dereferencing is safe to compare against immovable singletons. | 3237 return obj == heap->undefined_value() || |
3217 HandleDereferenceGuard allow_handle_deref(isolate(), | 3238 obj == heap->null_value() || |
3218 HandleDereferenceGuard::ALLOW); | 3239 obj == heap->true_value() || |
3219 ASSERT(*handle_ != heap->minus_zero_value()); | 3240 obj == heap->false_value() || |
3220 ASSERT(*handle_ != heap->nan_value()); | 3241 obj == heap->the_hole_value() || |
3221 return *handle_ == heap->undefined_value() || | 3242 obj == heap->empty_string(); |
3222 *handle_ == heap->null_value() || | |
3223 *handle_ == heap->true_value() || | |
3224 *handle_ == heap->false_value() || | |
3225 *handle_ == heap->the_hole_value() || | |
3226 *handle_ == heap->empty_string(); | |
3227 } | 3243 } |
3228 | 3244 |
3229 virtual Representation RequiredInputRepresentation(int index) { | 3245 virtual Representation RequiredInputRepresentation(int index) { |
3230 return Representation::None(); | 3246 return Representation::None(); |
3231 } | 3247 } |
3232 | 3248 |
3233 virtual bool IsConvertibleToInteger() const { | 3249 virtual bool IsConvertibleToInteger() const { |
3234 return has_int32_value_; | 3250 return has_int32_value_; |
3235 } | 3251 } |
3236 | 3252 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3286 return HasStringValue() && is_internalized_string_; | 3302 return HasStringValue() && is_internalized_string_; |
3287 } | 3303 } |
3288 | 3304 |
3289 bool BooleanValue() const { return boolean_value_; } | 3305 bool BooleanValue() const { return boolean_value_; } |
3290 | 3306 |
3291 bool IsUint32() { | 3307 bool IsUint32() { |
3292 return HasInteger32Value() && (Integer32Value() >= 0); | 3308 return HasInteger32Value() && (Integer32Value() >= 0); |
3293 } | 3309 } |
3294 | 3310 |
3295 virtual intptr_t Hashcode() { | 3311 virtual intptr_t Hashcode() { |
3296 ASSERT_ALLOCATION_DISABLED; | |
3297 intptr_t hash; | |
3298 | |
3299 if (has_int32_value_) { | 3312 if (has_int32_value_) { |
3300 hash = static_cast<intptr_t>(int32_value_); | 3313 return static_cast<intptr_t>(int32_value_); |
3301 } else if (has_double_value_) { | 3314 } else if (has_double_value_) { |
3302 hash = static_cast<intptr_t>(BitCast<int64_t>(double_value_)); | 3315 return static_cast<intptr_t>(BitCast<int64_t>(double_value_)); |
3303 } else { | 3316 } else { |
3304 ASSERT(!handle_.is_null()); | 3317 ASSERT(!handle_.is_null()); |
3305 // Dereferencing to use the object's raw address for hashing is safe. | 3318 ASSERT_NE(NULL, raw_address_); |
3306 HandleDereferenceGuard allow_handle_deref(isolate(), | 3319 return reinterpret_cast<intptr_t>(raw_address_); |
3307 HandleDereferenceGuard::ALLOW); | |
3308 SLOW_ASSERT(Heap::RelocationLock::IsLocked(isolate()->heap()) || | |
3309 !isolate()->optimizing_compiler_thread()->IsOptimizerThread()); | |
3310 hash = reinterpret_cast<intptr_t>(*handle_); | |
3311 } | 3320 } |
| 3321 } |
3312 | 3322 |
3313 return hash; | 3323 virtual void FinalizeUniqueId() { |
| 3324 if (!has_double_value_) { |
| 3325 ASSERT(!handle_.is_null()); |
| 3326 // Raw address may have already been collected. |
| 3327 ASSERT(raw_address_ == NULL || |
| 3328 raw_address_ == reinterpret_cast<Address>(*handle_)); |
| 3329 raw_address_ = reinterpret_cast<Address>(*handle_); |
| 3330 } |
3314 } | 3331 } |
3315 | 3332 |
3316 #ifdef DEBUG | 3333 #ifdef DEBUG |
3317 virtual void Verify() { } | 3334 virtual void Verify() { } |
3318 #endif | 3335 #endif |
3319 | 3336 |
3320 DECLARE_CONCRETE_INSTRUCTION(Constant) | 3337 DECLARE_CONCRETE_INSTRUCTION(Constant) |
3321 | 3338 |
3322 protected: | 3339 protected: |
3323 virtual Range* InferRange(Zone* zone); | 3340 virtual Range* InferRange(Zone* zone); |
3324 | 3341 |
3325 virtual bool DataEquals(HValue* other) { | 3342 virtual bool DataEquals(HValue* other) { |
3326 HConstant* other_constant = HConstant::cast(other); | 3343 HConstant* other_constant = HConstant::cast(other); |
3327 if (has_int32_value_) { | 3344 if (has_int32_value_) { |
3328 return other_constant->has_int32_value_ && | 3345 return other_constant->has_int32_value_ && |
3329 int32_value_ == other_constant->int32_value_; | 3346 int32_value_ == other_constant->int32_value_; |
3330 } else if (has_double_value_) { | 3347 } else if (has_double_value_) { |
3331 return other_constant->has_double_value_ && | 3348 return other_constant->has_double_value_ && |
3332 BitCast<int64_t>(double_value_) == | 3349 BitCast<int64_t>(double_value_) == |
3333 BitCast<int64_t>(other_constant->double_value_); | 3350 BitCast<int64_t>(other_constant->double_value_); |
3334 } else { | 3351 } else { |
3335 ASSERT(!handle_.is_null()); | 3352 ASSERT(!handle_.is_null()); |
| 3353 ASSERT_NE(NULL, raw_address_); |
3336 return !other_constant->handle_.is_null() && | 3354 return !other_constant->handle_.is_null() && |
3337 handle_.is_identical_to(other_constant->handle_); | 3355 raw_address_ == other_constant->raw_address_; |
3338 } | 3356 } |
3339 } | 3357 } |
3340 | 3358 |
3341 private: | 3359 private: |
3342 void Initialize(Representation r); | 3360 void Initialize(Representation r); |
3343 | 3361 |
3344 virtual bool IsDeletable() const { return true; } | 3362 virtual bool IsDeletable() const { return true; } |
3345 | 3363 |
3346 // If this is a numerical constant, handle_ either points to to the | 3364 // If this is a numerical constant, handle_ either points to to the |
3347 // HeapObject the constant originated from or is null. If the | 3365 // HeapObject the constant originated from or is null. If the |
3348 // constant is non-numeric, handle_ always points to a valid | 3366 // constant is non-numeric, handle_ always points to a valid |
3349 // constant HeapObject. | 3367 // constant HeapObject. |
3350 Handle<Object> handle_; | 3368 Handle<Object> handle_; |
3351 | 3369 |
3352 // We store the HConstant in the most specific form safely possible. | 3370 // We store the HConstant in the most specific form safely possible. |
3353 // The two flags, has_int32_value_ and has_double_value_ tell us if | 3371 // The two flags, has_int32_value_ and has_double_value_ tell us if |
3354 // int32_value_ and double_value_ hold valid, safe representations | 3372 // int32_value_ and double_value_ hold valid, safe representations |
3355 // of the constant. has_int32_value_ implies has_double_value_ but | 3373 // of the constant. has_int32_value_ implies has_double_value_ but |
3356 // not the converse. | 3374 // not the converse. |
3357 bool has_int32_value_ : 1; | 3375 bool has_int32_value_ : 1; |
3358 bool has_double_value_ : 1; | 3376 bool has_double_value_ : 1; |
3359 bool is_internalized_string_ : 1; // TODO(yangguo): make this part of HType. | 3377 bool is_internalized_string_ : 1; // TODO(yangguo): make this part of HType. |
3360 bool boolean_value_ : 1; | 3378 bool boolean_value_ : 1; |
3361 int32_t int32_value_; | 3379 // An extra hash code is only necessary if the value is not a number. |
| 3380 // So has_double_value_ governs how to interpret the union. |
| 3381 union { |
| 3382 int32_t int32_value_; |
| 3383 Address raw_address_; |
| 3384 }; |
3362 double double_value_; | 3385 double double_value_; |
3363 HType type_from_value_; | 3386 HType type_from_value_; |
3364 }; | 3387 }; |
3365 | 3388 |
3366 | 3389 |
3367 class HBinaryOperation: public HTemplateInstruction<3> { | 3390 class HBinaryOperation: public HTemplateInstruction<3> { |
3368 public: | 3391 public: |
3369 HBinaryOperation(HValue* context, HValue* left, HValue* right) | 3392 HBinaryOperation(HValue* context, HValue* left, HValue* right) |
3370 : observed_output_representation_(Representation::None()) { | 3393 : observed_output_representation_(Representation::None()) { |
3371 ASSERT(left != NULL && right != NULL); | 3394 ASSERT(left != NULL && right != NULL); |
(...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4752 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue) | 4775 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue) |
4753 | 4776 |
4754 private: | 4777 private: |
4755 HPhi* incoming_value_; | 4778 HPhi* incoming_value_; |
4756 }; | 4779 }; |
4757 | 4780 |
4758 | 4781 |
4759 class HLoadGlobalCell: public HTemplateInstruction<0> { | 4782 class HLoadGlobalCell: public HTemplateInstruction<0> { |
4760 public: | 4783 public: |
4761 HLoadGlobalCell(Handle<JSGlobalPropertyCell> cell, PropertyDetails details) | 4784 HLoadGlobalCell(Handle<JSGlobalPropertyCell> cell, PropertyDetails details) |
4762 : cell_(cell), details_(details) { | 4785 : cell_(cell), details_(details), unique_id_(0) { |
4763 set_representation(Representation::Tagged()); | 4786 set_representation(Representation::Tagged()); |
4764 SetFlag(kUseGVN); | 4787 SetFlag(kUseGVN); |
4765 SetGVNFlag(kDependsOnGlobalVars); | 4788 SetGVNFlag(kDependsOnGlobalVars); |
4766 } | 4789 } |
4767 | 4790 |
4768 Handle<JSGlobalPropertyCell> cell() const { return cell_; } | 4791 Handle<JSGlobalPropertyCell> cell() const { return cell_; } |
4769 bool RequiresHoleCheck() const; | 4792 bool RequiresHoleCheck() const; |
4770 | 4793 |
4771 virtual void PrintDataTo(StringStream* stream); | 4794 virtual void PrintDataTo(StringStream* stream); |
4772 | 4795 |
4773 virtual intptr_t Hashcode() { | 4796 virtual intptr_t Hashcode() { |
4774 ASSERT_ALLOCATION_DISABLED; | 4797 ASSERT_NE(0, unique_id_); |
4775 // Dereferencing to use the object's raw address for hashing is safe. | 4798 return unique_id_; |
4776 HandleDereferenceGuard allow_handle_deref(isolate(), | 4799 } |
4777 HandleDereferenceGuard::ALLOW); | 4800 |
4778 SLOW_ASSERT(Heap::RelocationLock::IsLocked(isolate()->heap()) || | 4801 virtual void FinalizeUniqueId() { |
4779 !isolate()->optimizing_compiler_thread()->IsOptimizerThread()); | 4802 // Raw address may have already been collected. |
4780 return reinterpret_cast<intptr_t>(*cell_); | 4803 ASSERT(unique_id_ == 0 || |
| 4804 unique_id_ == reinterpret_cast<intptr_t>(*cell_)); |
| 4805 unique_id_ = reinterpret_cast<intptr_t>(*cell_); |
4781 } | 4806 } |
4782 | 4807 |
4783 virtual Representation RequiredInputRepresentation(int index) { | 4808 virtual Representation RequiredInputRepresentation(int index) { |
4784 return Representation::None(); | 4809 return Representation::None(); |
4785 } | 4810 } |
4786 | 4811 |
4787 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell) | 4812 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalCell) |
4788 | 4813 |
4789 protected: | 4814 protected: |
4790 virtual bool DataEquals(HValue* other) { | 4815 virtual bool DataEquals(HValue* other) { |
4791 HLoadGlobalCell* b = HLoadGlobalCell::cast(other); | 4816 HLoadGlobalCell* b = HLoadGlobalCell::cast(other); |
4792 return cell_.is_identical_to(b->cell()); | 4817 ASSERT_NE(0, unique_id_); |
| 4818 return unique_id_ == b->unique_id_; |
4793 } | 4819 } |
4794 | 4820 |
4795 private: | 4821 private: |
4796 virtual bool IsDeletable() const { return !RequiresHoleCheck(); } | 4822 virtual bool IsDeletable() const { return !RequiresHoleCheck(); } |
4797 | 4823 |
4798 Handle<JSGlobalPropertyCell> cell_; | 4824 Handle<JSGlobalPropertyCell> cell_; |
4799 PropertyDetails details_; | 4825 PropertyDetails details_; |
| 4826 intptr_t unique_id_; |
4800 }; | 4827 }; |
4801 | 4828 |
4802 | 4829 |
4803 class HLoadGlobalGeneric: public HTemplateInstruction<2> { | 4830 class HLoadGlobalGeneric: public HTemplateInstruction<2> { |
4804 public: | 4831 public: |
4805 HLoadGlobalGeneric(HValue* context, | 4832 HLoadGlobalGeneric(HValue* context, |
4806 HValue* global_object, | 4833 HValue* global_object, |
4807 Handle<Object> name, | 4834 Handle<Object> name, |
4808 bool for_typeof) | 4835 bool for_typeof) |
4809 : name_(name), | 4836 : name_(name), |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5249 virtual Representation RequiredInputRepresentation(int index) { | 5276 virtual Representation RequiredInputRepresentation(int index) { |
5250 return Representation::Tagged(); | 5277 return Representation::Tagged(); |
5251 } | 5278 } |
5252 | 5279 |
5253 virtual void PrintDataTo(StringStream* stream); | 5280 virtual void PrintDataTo(StringStream* stream); |
5254 | 5281 |
5255 DECLARE_CONCRETE_INSTRUCTION(LoadNamedFieldPolymorphic) | 5282 DECLARE_CONCRETE_INSTRUCTION(LoadNamedFieldPolymorphic) |
5256 | 5283 |
5257 static const int kMaxLoadPolymorphism = 4; | 5284 static const int kMaxLoadPolymorphism = 4; |
5258 | 5285 |
| 5286 virtual void FinalizeUniqueId(); |
| 5287 |
5259 protected: | 5288 protected: |
5260 virtual bool DataEquals(HValue* value); | 5289 virtual bool DataEquals(HValue* value); |
5261 | 5290 |
5262 private: | 5291 private: |
5263 SmallMapList types_; | 5292 SmallMapList types_; |
5264 Handle<String> name_; | 5293 Handle<String> name_; |
| 5294 ZoneList<Address> types_raw_address_; |
| 5295 Address name_raw_address_; |
5265 bool need_generic_; | 5296 bool need_generic_; |
5266 }; | 5297 }; |
5267 | 5298 |
5268 | 5299 |
5269 | 5300 |
5270 class HLoadNamedGeneric: public HTemplateInstruction<2> { | 5301 class HLoadNamedGeneric: public HTemplateInstruction<2> { |
5271 public: | 5302 public: |
5272 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name) | 5303 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name) |
5273 : name_(name) { | 5304 : name_(name) { |
5274 SetOperandAt(0, context); | 5305 SetOperandAt(0, context); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5518 class HStoreNamedField: public HTemplateInstruction<2> { | 5549 class HStoreNamedField: public HTemplateInstruction<2> { |
5519 public: | 5550 public: |
5520 HStoreNamedField(HValue* obj, | 5551 HStoreNamedField(HValue* obj, |
5521 Handle<String> name, | 5552 Handle<String> name, |
5522 HValue* val, | 5553 HValue* val, |
5523 bool in_object, | 5554 bool in_object, |
5524 int offset) | 5555 int offset) |
5525 : name_(name), | 5556 : name_(name), |
5526 is_in_object_(in_object), | 5557 is_in_object_(in_object), |
5527 offset_(offset), | 5558 offset_(offset), |
| 5559 transition_raw_address_(NULL), |
5528 new_space_dominator_(NULL) { | 5560 new_space_dominator_(NULL) { |
5529 SetOperandAt(0, obj); | 5561 SetOperandAt(0, obj); |
5530 SetOperandAt(1, val); | 5562 SetOperandAt(1, val); |
5531 SetFlag(kTrackSideEffectDominators); | 5563 SetFlag(kTrackSideEffectDominators); |
5532 SetGVNFlag(kDependsOnNewSpacePromotion); | 5564 SetGVNFlag(kDependsOnNewSpacePromotion); |
5533 if (is_in_object_) { | 5565 if (is_in_object_) { |
5534 SetGVNFlag(kChangesInobjectFields); | 5566 SetGVNFlag(kChangesInobjectFields); |
5535 } else { | 5567 } else { |
5536 SetGVNFlag(kChangesBackingStoreFields); | 5568 SetGVNFlag(kChangesBackingStoreFields); |
5537 } | 5569 } |
(...skipping 10 matching lines...) Expand all Loading... |
5548 } | 5580 } |
5549 virtual void PrintDataTo(StringStream* stream); | 5581 virtual void PrintDataTo(StringStream* stream); |
5550 | 5582 |
5551 HValue* object() { return OperandAt(0); } | 5583 HValue* object() { return OperandAt(0); } |
5552 HValue* value() { return OperandAt(1); } | 5584 HValue* value() { return OperandAt(1); } |
5553 | 5585 |
5554 Handle<String> name() const { return name_; } | 5586 Handle<String> name() const { return name_; } |
5555 bool is_in_object() const { return is_in_object_; } | 5587 bool is_in_object() const { return is_in_object_; } |
5556 int offset() const { return offset_; } | 5588 int offset() const { return offset_; } |
5557 Handle<Map> transition() const { return transition_; } | 5589 Handle<Map> transition() const { return transition_; } |
| 5590 Address transition_raw_address() const { return transition_raw_address_; } |
5558 void set_transition(Handle<Map> map) { transition_ = map; } | 5591 void set_transition(Handle<Map> map) { transition_ = map; } |
5559 HValue* new_space_dominator() const { return new_space_dominator_; } | 5592 HValue* new_space_dominator() const { return new_space_dominator_; } |
5560 | 5593 |
5561 bool NeedsWriteBarrier() { | 5594 bool NeedsWriteBarrier() { |
5562 return StoringValueNeedsWriteBarrier(value()) && | 5595 return StoringValueNeedsWriteBarrier(value()) && |
5563 ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); | 5596 ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); |
5564 } | 5597 } |
5565 | 5598 |
5566 bool NeedsWriteBarrierForMap() { | 5599 bool NeedsWriteBarrierForMap() { |
5567 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); | 5600 return ReceiverObjectNeedsWriteBarrier(object(), new_space_dominator()); |
5568 } | 5601 } |
5569 | 5602 |
| 5603 virtual void FinalizeUniqueId() { |
| 5604 if (transition_.is_null()) return; |
| 5605 // Raw address may have already been collected. |
| 5606 ASSERT(transition_raw_address_ == NULL || |
| 5607 transition_raw_address_ == reinterpret_cast<Address>(*transition_)); |
| 5608 transition_raw_address_ = reinterpret_cast<Address>(*transition_); |
| 5609 } |
| 5610 |
5570 private: | 5611 private: |
5571 Handle<String> name_; | 5612 Handle<String> name_; |
5572 bool is_in_object_; | 5613 bool is_in_object_; |
5573 int offset_; | 5614 int offset_; |
5574 Handle<Map> transition_; | 5615 Handle<Map> transition_; |
| 5616 Address transition_raw_address_; |
5575 HValue* new_space_dominator_; | 5617 HValue* new_space_dominator_; |
5576 }; | 5618 }; |
5577 | 5619 |
5578 | 5620 |
5579 class HStoreNamedGeneric: public HTemplateInstruction<3> { | 5621 class HStoreNamedGeneric: public HTemplateInstruction<3> { |
5580 public: | 5622 public: |
5581 HStoreNamedGeneric(HValue* context, | 5623 HStoreNamedGeneric(HValue* context, |
5582 HValue* object, | 5624 HValue* object, |
5583 Handle<String> name, | 5625 Handle<String> name, |
5584 HValue* value, | 5626 HValue* value, |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5765 | 5807 |
5766 | 5808 |
5767 class HTransitionElementsKind: public HTemplateInstruction<2> { | 5809 class HTransitionElementsKind: public HTemplateInstruction<2> { |
5768 public: | 5810 public: |
5769 HTransitionElementsKind(HValue* context, | 5811 HTransitionElementsKind(HValue* context, |
5770 HValue* object, | 5812 HValue* object, |
5771 Handle<Map> original_map, | 5813 Handle<Map> original_map, |
5772 Handle<Map> transitioned_map) | 5814 Handle<Map> transitioned_map) |
5773 : original_map_(original_map), | 5815 : original_map_(original_map), |
5774 transitioned_map_(transitioned_map), | 5816 transitioned_map_(transitioned_map), |
| 5817 original_map_raw_address_(NULL), |
| 5818 transitioned_map_raw_address_(NULL), |
5775 from_kind_(original_map->elements_kind()), | 5819 from_kind_(original_map->elements_kind()), |
5776 to_kind_(transitioned_map->elements_kind()) { | 5820 to_kind_(transitioned_map->elements_kind()) { |
5777 SetOperandAt(0, object); | 5821 SetOperandAt(0, object); |
5778 SetOperandAt(1, context); | 5822 SetOperandAt(1, context); |
5779 SetFlag(kUseGVN); | 5823 SetFlag(kUseGVN); |
5780 SetGVNFlag(kChangesElementsKind); | 5824 SetGVNFlag(kChangesElementsKind); |
5781 if (original_map->has_fast_double_elements()) { | 5825 if (original_map->has_fast_double_elements()) { |
5782 SetGVNFlag(kChangesElementsPointer); | 5826 SetGVNFlag(kChangesElementsPointer); |
5783 SetGVNFlag(kChangesNewSpacePromotion); | 5827 SetGVNFlag(kChangesNewSpacePromotion); |
5784 } | 5828 } |
(...skipping 10 matching lines...) Expand all Loading... |
5795 | 5839 |
5796 HValue* object() { return OperandAt(0); } | 5840 HValue* object() { return OperandAt(0); } |
5797 HValue* context() { return OperandAt(1); } | 5841 HValue* context() { return OperandAt(1); } |
5798 Handle<Map> original_map() { return original_map_; } | 5842 Handle<Map> original_map() { return original_map_; } |
5799 Handle<Map> transitioned_map() { return transitioned_map_; } | 5843 Handle<Map> transitioned_map() { return transitioned_map_; } |
5800 ElementsKind from_kind() { return from_kind_; } | 5844 ElementsKind from_kind() { return from_kind_; } |
5801 ElementsKind to_kind() { return to_kind_; } | 5845 ElementsKind to_kind() { return to_kind_; } |
5802 | 5846 |
5803 virtual void PrintDataTo(StringStream* stream); | 5847 virtual void PrintDataTo(StringStream* stream); |
5804 | 5848 |
| 5849 virtual void FinalizeUniqueId() { |
| 5850 // Raw addresses may have already been collected. |
| 5851 ASSERT(original_map_raw_address_ == NULL || |
| 5852 original_map_raw_address_ == |
| 5853 reinterpret_cast<Address>(*original_map_)); |
| 5854 ASSERT(transitioned_map_raw_address_ == NULL || |
| 5855 transitioned_map_raw_address_ == |
| 5856 reinterpret_cast<Address>(*transitioned_map_)); |
| 5857 original_map_raw_address_ = reinterpret_cast<Address>(*original_map_); |
| 5858 transitioned_map_raw_address_ = |
| 5859 reinterpret_cast<Address>(*transitioned_map_); |
| 5860 } |
| 5861 |
5805 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind) | 5862 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind) |
5806 | 5863 |
5807 protected: | 5864 protected: |
5808 virtual bool DataEquals(HValue* other) { | 5865 virtual bool DataEquals(HValue* other) { |
| 5866 ASSERT_NE(NULL, original_map_raw_address_); |
| 5867 ASSERT_NE(NULL, transitioned_map_raw_address_); |
5809 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other); | 5868 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other); |
5810 return original_map_.is_identical_to(instr->original_map()) && | 5869 return original_map_raw_address_ == instr->original_map_raw_address_ && |
5811 transitioned_map_.is_identical_to(instr->transitioned_map()); | 5870 transitioned_map_raw_address_ == instr->transitioned_map_raw_address_; |
5812 } | 5871 } |
5813 | 5872 |
5814 private: | 5873 private: |
5815 Handle<Map> original_map_; | 5874 Handle<Map> original_map_; |
5816 Handle<Map> transitioned_map_; | 5875 Handle<Map> transitioned_map_; |
| 5876 Address original_map_raw_address_; |
| 5877 Address transitioned_map_raw_address_; |
5817 ElementsKind from_kind_; | 5878 ElementsKind from_kind_; |
5818 ElementsKind to_kind_; | 5879 ElementsKind to_kind_; |
5819 }; | 5880 }; |
5820 | 5881 |
5821 | 5882 |
5822 class HStringAdd: public HBinaryOperation { | 5883 class HStringAdd: public HBinaryOperation { |
5823 public: | 5884 public: |
5824 static HInstruction* New(Zone* zone, | 5885 static HInstruction* New(Zone* zone, |
5825 HValue* context, | 5886 HValue* context, |
5826 HValue* left, | 5887 HValue* left, |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6432 virtual bool IsDeletable() const { return true; } | 6493 virtual bool IsDeletable() const { return true; } |
6433 }; | 6494 }; |
6434 | 6495 |
6435 | 6496 |
6436 #undef DECLARE_INSTRUCTION | 6497 #undef DECLARE_INSTRUCTION |
6437 #undef DECLARE_CONCRETE_INSTRUCTION | 6498 #undef DECLARE_CONCRETE_INSTRUCTION |
6438 | 6499 |
6439 } } // namespace v8::internal | 6500 } } // namespace v8::internal |
6440 | 6501 |
6441 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6502 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |