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 4951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4962 public: | 4962 public: |
4963 enum Flags { | 4963 enum Flags { |
4964 CAN_ALLOCATE_IN_NEW_SPACE = 1 << 0, | 4964 CAN_ALLOCATE_IN_NEW_SPACE = 1 << 0, |
4965 CAN_ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, | 4965 CAN_ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, |
4966 CAN_ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, | 4966 CAN_ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, |
4967 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, | 4967 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, |
4968 PREFILL_WITH_FILLER = 1 << 4 | 4968 PREFILL_WITH_FILLER = 1 << 4 |
4969 }; | 4969 }; |
4970 | 4970 |
4971 HAllocate(HValue* context, HValue* size, HType type, Flags flags) | 4971 HAllocate(HValue* context, HValue* size, HType type, Flags flags) |
4972 : type_(type), | 4972 : flags_(flags) { |
4973 flags_(flags) { | |
4974 SetOperandAt(0, context); | 4973 SetOperandAt(0, context); |
4975 SetOperandAt(1, size); | 4974 SetOperandAt(1, size); |
| 4975 set_type(type); |
4976 set_representation(Representation::Tagged()); | 4976 set_representation(Representation::Tagged()); |
4977 SetFlag(kTrackSideEffectDominators); | 4977 SetFlag(kTrackSideEffectDominators); |
4978 SetGVNFlag(kChangesNewSpacePromotion); | 4978 SetGVNFlag(kChangesNewSpacePromotion); |
4979 SetGVNFlag(kDependsOnNewSpacePromotion); | 4979 SetGVNFlag(kDependsOnNewSpacePromotion); |
4980 } | 4980 } |
4981 | 4981 |
4982 // Maximum instance size for which allocations will be inlined. | 4982 // Maximum instance size for which allocations will be inlined. |
4983 static const int kMaxInlineSize = 64 * kPointerSize; | 4983 static const int kMaxInlineSize = 64 * kPointerSize; |
4984 | 4984 |
4985 static Flags DefaultFlags() { | 4985 static Flags DefaultFlags() { |
4986 return CAN_ALLOCATE_IN_NEW_SPACE; | 4986 return CAN_ALLOCATE_IN_NEW_SPACE; |
4987 } | 4987 } |
4988 | 4988 |
4989 static Flags DefaultFlags(ElementsKind kind) { | 4989 static Flags DefaultFlags(ElementsKind kind) { |
4990 Flags flags = CAN_ALLOCATE_IN_NEW_SPACE; | 4990 Flags flags = CAN_ALLOCATE_IN_NEW_SPACE; |
4991 if (IsFastDoubleElementsKind(kind)) { | 4991 if (IsFastDoubleElementsKind(kind)) { |
4992 flags = static_cast<HAllocate::Flags>( | 4992 flags = static_cast<HAllocate::Flags>( |
4993 flags | HAllocate::ALLOCATE_DOUBLE_ALIGNED); | 4993 flags | HAllocate::ALLOCATE_DOUBLE_ALIGNED); |
4994 } | 4994 } |
4995 return flags; | 4995 return flags; |
4996 } | 4996 } |
4997 | 4997 |
4998 HValue* context() { return OperandAt(0); } | 4998 HValue* context() { return OperandAt(0); } |
4999 HValue* size() { return OperandAt(1); } | 4999 HValue* size() { return OperandAt(1); } |
5000 HType type() { return type_; } | |
5001 | 5000 |
5002 virtual Representation RequiredInputRepresentation(int index) { | 5001 virtual Representation RequiredInputRepresentation(int index) { |
5003 if (index == 0) { | 5002 if (index == 0) { |
5004 return Representation::Tagged(); | 5003 return Representation::Tagged(); |
5005 } else { | 5004 } else { |
5006 return Representation::Integer32(); | 5005 return Representation::Integer32(); |
5007 } | 5006 } |
5008 } | 5007 } |
5009 | 5008 |
5010 virtual Handle<Map> GetMonomorphicJSObjectMap() { | 5009 virtual Handle<Map> GetMonomorphicJSObjectMap() { |
5011 return known_initial_map_; | 5010 return known_initial_map_; |
5012 } | 5011 } |
5013 | 5012 |
5014 void set_known_initial_map(Handle<Map> known_initial_map) { | 5013 void set_known_initial_map(Handle<Map> known_initial_map) { |
5015 known_initial_map_ = known_initial_map; | 5014 known_initial_map_ = known_initial_map; |
5016 } | 5015 } |
5017 | 5016 |
5018 virtual HType CalculateInferredType(); | |
5019 | |
5020 bool CanAllocateInNewSpace() const { | 5017 bool CanAllocateInNewSpace() const { |
5021 return (flags_ & CAN_ALLOCATE_IN_NEW_SPACE) != 0; | 5018 return (flags_ & CAN_ALLOCATE_IN_NEW_SPACE) != 0; |
5022 } | 5019 } |
5023 | 5020 |
5024 bool CanAllocateInOldDataSpace() const { | 5021 bool CanAllocateInOldDataSpace() const { |
5025 return (flags_ & CAN_ALLOCATE_IN_OLD_DATA_SPACE) != 0; | 5022 return (flags_ & CAN_ALLOCATE_IN_OLD_DATA_SPACE) != 0; |
5026 } | 5023 } |
5027 | 5024 |
5028 bool CanAllocateInOldPointerSpace() const { | 5025 bool CanAllocateInOldPointerSpace() const { |
5029 return (flags_ & CAN_ALLOCATE_IN_OLD_POINTER_SPACE) != 0; | 5026 return (flags_ & CAN_ALLOCATE_IN_OLD_POINTER_SPACE) != 0; |
(...skipping 25 matching lines...) Expand all Loading... |
5055 } | 5052 } |
5056 | 5053 |
5057 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 5054 virtual void HandleSideEffectDominator(GVNFlag side_effect, |
5058 HValue* dominator); | 5055 HValue* dominator); |
5059 | 5056 |
5060 virtual void PrintDataTo(StringStream* stream); | 5057 virtual void PrintDataTo(StringStream* stream); |
5061 | 5058 |
5062 DECLARE_CONCRETE_INSTRUCTION(Allocate) | 5059 DECLARE_CONCRETE_INSTRUCTION(Allocate) |
5063 | 5060 |
5064 private: | 5061 private: |
5065 HType type_; | |
5066 Flags flags_; | 5062 Flags flags_; |
5067 Handle<Map> known_initial_map_; | 5063 Handle<Map> known_initial_map_; |
5068 }; | 5064 }; |
5069 | 5065 |
5070 | 5066 |
5071 class HInnerAllocatedObject: public HTemplateInstruction<1> { | 5067 class HInnerAllocatedObject: public HTemplateInstruction<1> { |
5072 public: | 5068 public: |
5073 HInnerAllocatedObject(HValue* value, int offset, HType type = HType::Tagged()) | 5069 HInnerAllocatedObject(HValue* value, int offset, HType type = HType::Tagged()) |
5074 : offset_(offset), | 5070 : offset_(offset) { |
5075 type_(type) { | |
5076 ASSERT(value->IsAllocate()); | 5071 ASSERT(value->IsAllocate()); |
5077 SetOperandAt(0, value); | 5072 SetOperandAt(0, value); |
| 5073 set_type(type); |
5078 set_representation(Representation::Tagged()); | 5074 set_representation(Representation::Tagged()); |
5079 } | 5075 } |
5080 | 5076 |
5081 HValue* base_object() { return OperandAt(0); } | 5077 HValue* base_object() { return OperandAt(0); } |
5082 int offset() { return offset_; } | 5078 int offset() { return offset_; } |
5083 | 5079 |
5084 virtual Representation RequiredInputRepresentation(int index) { | 5080 virtual Representation RequiredInputRepresentation(int index) { |
5085 return Representation::Tagged(); | 5081 return Representation::Tagged(); |
5086 } | 5082 } |
5087 | 5083 |
5088 virtual HType CalculateInferredType() { return type_; } | |
5089 | |
5090 virtual void PrintDataTo(StringStream* stream); | 5084 virtual void PrintDataTo(StringStream* stream); |
5091 | 5085 |
5092 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject) | 5086 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject) |
5093 | 5087 |
5094 private: | 5088 private: |
5095 int offset_; | 5089 int offset_; |
5096 HType type_; | |
5097 }; | 5090 }; |
5098 | 5091 |
5099 | 5092 |
5100 inline bool StoringValueNeedsWriteBarrier(HValue* value) { | 5093 inline bool StoringValueNeedsWriteBarrier(HValue* value) { |
5101 return !value->type().IsBoolean() | 5094 return !value->type().IsBoolean() |
5102 && !value->type().IsSmi() | 5095 && !value->type().IsSmi() |
5103 && !(value->IsConstant() && HConstant::cast(value)->ImmortalImmovable()); | 5096 && !(value->IsConstant() && HConstant::cast(value)->ImmortalImmovable()); |
5104 } | 5097 } |
5105 | 5098 |
5106 | 5099 |
(...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6694 virtual bool IsDeletable() const { return true; } | 6687 virtual bool IsDeletable() const { return true; } |
6695 }; | 6688 }; |
6696 | 6689 |
6697 | 6690 |
6698 #undef DECLARE_INSTRUCTION | 6691 #undef DECLARE_INSTRUCTION |
6699 #undef DECLARE_CONCRETE_INSTRUCTION | 6692 #undef DECLARE_CONCRETE_INSTRUCTION |
6700 | 6693 |
6701 } } // namespace v8::internal | 6694 } } // namespace v8::internal |
6702 | 6695 |
6703 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6696 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |