| 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 2714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2725 virtual bool DataEquals(HValue* other) { return true; } | 2725 virtual bool DataEquals(HValue* other) { return true; } |
| 2726 | 2726 |
| 2727 private: | 2727 private: |
| 2728 virtual bool IsDeletable() const { return true; } | 2728 virtual bool IsDeletable() const { return true; } |
| 2729 }; | 2729 }; |
| 2730 | 2730 |
| 2731 | 2731 |
| 2732 class HCheckMaps: public HTemplateInstruction<2> { | 2732 class HCheckMaps: public HTemplateInstruction<2> { |
| 2733 public: | 2733 public: |
| 2734 static HCheckMaps* New(HValue* value, Handle<Map> map, Zone* zone, | 2734 static HCheckMaps* New(HValue* value, Handle<Map> map, Zone* zone, |
| 2735 HValue *typecheck = NULL) { | 2735 CompilationInfo* info, HValue *typecheck = NULL); |
| 2736 HCheckMaps* check_map = new(zone) HCheckMaps(value, zone, typecheck); | |
| 2737 check_map->map_set_.Add(map, zone); | |
| 2738 return check_map; | |
| 2739 } | |
| 2740 | |
| 2741 static HCheckMaps* New(HValue* value, SmallMapList* maps, Zone* zone, | 2736 static HCheckMaps* New(HValue* value, SmallMapList* maps, Zone* zone, |
| 2742 HValue *typecheck = NULL) { | 2737 HValue *typecheck = NULL) { |
| 2743 HCheckMaps* check_map = new(zone) HCheckMaps(value, zone, typecheck); | 2738 HCheckMaps* check_map = new(zone) HCheckMaps(value, zone, typecheck); |
| 2744 for (int i = 0; i < maps->length(); i++) { | 2739 for (int i = 0; i < maps->length(); i++) { |
| 2745 check_map->map_set_.Add(maps->at(i), zone); | 2740 check_map->map_set_.Add(maps->at(i), zone); |
| 2746 } | 2741 } |
| 2747 check_map->map_set_.Sort(); | 2742 check_map->map_set_.Sort(); |
| 2748 return check_map; | 2743 return check_map; |
| 2749 } | 2744 } |
| 2750 | 2745 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2764 Map* transitioned_map = | 2759 Map* transitioned_map = |
| 2765 map->LookupElementsTransitionMap(kind); | 2760 map->LookupElementsTransitionMap(kind); |
| 2766 if (transitioned_map) { | 2761 if (transitioned_map) { |
| 2767 check_map->map_set_.Add(Handle<Map>(transitioned_map), zone); | 2762 check_map->map_set_.Add(Handle<Map>(transitioned_map), zone); |
| 2768 } | 2763 } |
| 2769 }; | 2764 }; |
| 2770 check_map->map_set_.Sort(); | 2765 check_map->map_set_.Sort(); |
| 2771 return check_map; | 2766 return check_map; |
| 2772 } | 2767 } |
| 2773 | 2768 |
| 2769 bool CanOmitMapChecks() { return omit_; } |
| 2770 |
| 2774 virtual bool HasEscapingOperandAt(int index) { return false; } | 2771 virtual bool HasEscapingOperandAt(int index) { return false; } |
| 2775 virtual Representation RequiredInputRepresentation(int index) { | 2772 virtual Representation RequiredInputRepresentation(int index) { |
| 2776 return Representation::Tagged(); | 2773 return Representation::Tagged(); |
| 2777 } | 2774 } |
| 2778 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 2775 virtual void HandleSideEffectDominator(GVNFlag side_effect, |
| 2779 HValue* dominator); | 2776 HValue* dominator); |
| 2780 virtual void PrintDataTo(StringStream* stream); | 2777 virtual void PrintDataTo(StringStream* stream); |
| 2781 virtual HType CalculateInferredType(); | 2778 virtual HType CalculateInferredType(); |
| 2782 | 2779 |
| 2783 HValue* value() { return OperandAt(0); } | 2780 HValue* value() { return OperandAt(0); } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2799 if (map_unique_ids_.at(i) != b->map_unique_ids_.at(i)) { | 2796 if (map_unique_ids_.at(i) != b->map_unique_ids_.at(i)) { |
| 2800 return false; | 2797 return false; |
| 2801 } | 2798 } |
| 2802 } | 2799 } |
| 2803 return true; | 2800 return true; |
| 2804 } | 2801 } |
| 2805 | 2802 |
| 2806 private: | 2803 private: |
| 2807 // Clients should use one of the static New* methods above. | 2804 // Clients should use one of the static New* methods above. |
| 2808 HCheckMaps(HValue* value, Zone *zone, HValue* typecheck) | 2805 HCheckMaps(HValue* value, Zone *zone, HValue* typecheck) |
| 2809 : map_unique_ids_(0, zone) { | 2806 : omit_(false), map_unique_ids_(0, zone) { |
| 2810 SetOperandAt(0, value); | 2807 SetOperandAt(0, value); |
| 2811 // Use the object value for the dependency if NULL is passed. | 2808 // Use the object value for the dependency if NULL is passed. |
| 2812 // TODO(titzer): do GVN flags already express this dependency? | 2809 // TODO(titzer): do GVN flags already express this dependency? |
| 2813 SetOperandAt(1, typecheck != NULL ? typecheck : value); | 2810 SetOperandAt(1, typecheck != NULL ? typecheck : value); |
| 2814 set_representation(Representation::Tagged()); | 2811 set_representation(Representation::Tagged()); |
| 2815 SetFlag(kUseGVN); | 2812 SetFlag(kUseGVN); |
| 2816 SetFlag(kTrackSideEffectDominators); | 2813 SetFlag(kTrackSideEffectDominators); |
| 2817 SetGVNFlag(kDependsOnMaps); | 2814 SetGVNFlag(kDependsOnMaps); |
| 2818 SetGVNFlag(kDependsOnElementsKind); | 2815 SetGVNFlag(kDependsOnElementsKind); |
| 2819 } | 2816 } |
| 2820 | 2817 |
| 2818 void omit(CompilationInfo* info) { |
| 2819 omit_ = true; |
| 2820 for (int i = 0; i < map_set_.length(); i++) { |
| 2821 Handle<Map> map = map_set_.at(i); |
| 2822 map->AddDependentCompilationInfo(DependentCode::kPrototypeCheckGroup, |
| 2823 info); |
| 2824 } |
| 2825 } |
| 2826 |
| 2827 bool omit_; |
| 2821 SmallMapList map_set_; | 2828 SmallMapList map_set_; |
| 2822 ZoneList<UniqueValueId> map_unique_ids_; | 2829 ZoneList<UniqueValueId> map_unique_ids_; |
| 2823 }; | 2830 }; |
| 2824 | 2831 |
| 2825 | 2832 |
| 2826 class HCheckFunction: public HUnaryOperation { | 2833 class HCheckFunction: public HUnaryOperation { |
| 2827 public: | 2834 public: |
| 2828 HCheckFunction(HValue* value, Handle<JSFunction> function) | 2835 HCheckFunction(HValue* value, Handle<JSFunction> function) |
| 2829 : HUnaryOperation(value), target_(function), target_unique_id_() { | 2836 : HUnaryOperation(value), target_(function), target_unique_id_() { |
| 2830 set_representation(Representation::Tagged()); | 2837 set_representation(Representation::Tagged()); |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3289 Factory* factory = Isolate::Current()->factory(); | 3296 Factory* factory = Isolate::Current()->factory(); |
| 3290 // Default arguments to is_not_in_new_space depend on this heap number | 3297 // Default arguments to is_not_in_new_space depend on this heap number |
| 3291 // to be tenured so that it's guaranteed not be be located in new space. | 3298 // to be tenured so that it's guaranteed not be be located in new space. |
| 3292 handle_ = factory->NewNumber(double_value_, TENURED); | 3299 handle_ = factory->NewNumber(double_value_, TENURED); |
| 3293 } | 3300 } |
| 3294 AllowDeferredHandleDereference smi_check; | 3301 AllowDeferredHandleDereference smi_check; |
| 3295 ASSERT(has_int32_value_ || !handle_->IsSmi()); | 3302 ASSERT(has_int32_value_ || !handle_->IsSmi()); |
| 3296 return handle_; | 3303 return handle_; |
| 3297 } | 3304 } |
| 3298 | 3305 |
| 3306 bool InstanceOf(Handle<Map> map) { |
| 3307 return handle_->IsJSObject() && |
| 3308 Handle<JSObject>::cast(handle_)->map() == *map; |
| 3309 } |
| 3310 |
| 3299 bool IsSpecialDouble() const { | 3311 bool IsSpecialDouble() const { |
| 3300 return has_double_value_ && | 3312 return has_double_value_ && |
| 3301 (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) || | 3313 (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) || |
| 3302 FixedDoubleArray::is_the_hole_nan(double_value_) || | 3314 FixedDoubleArray::is_the_hole_nan(double_value_) || |
| 3303 std::isnan(double_value_)); | 3315 std::isnan(double_value_)); |
| 3304 } | 3316 } |
| 3305 | 3317 |
| 3306 bool NotInNewSpace() const { | 3318 bool NotInNewSpace() const { |
| 3307 return is_not_in_new_space_; | 3319 return is_not_in_new_space_; |
| 3308 } | 3320 } |
| (...skipping 3385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6694 virtual bool IsDeletable() const { return true; } | 6706 virtual bool IsDeletable() const { return true; } |
| 6695 }; | 6707 }; |
| 6696 | 6708 |
| 6697 | 6709 |
| 6698 #undef DECLARE_INSTRUCTION | 6710 #undef DECLARE_INSTRUCTION |
| 6699 #undef DECLARE_CONCRETE_INSTRUCTION | 6711 #undef DECLARE_CONCRETE_INSTRUCTION |
| 6700 | 6712 |
| 6701 } } // namespace v8::internal | 6713 } } // namespace v8::internal |
| 6702 | 6714 |
| 6703 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6715 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |