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 3186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3197 ZoneList<HValue*> values_; | 3197 ZoneList<HValue*> values_; |
3198 }; | 3198 }; |
3199 | 3199 |
3200 | 3200 |
3201 class HConstant: public HTemplateInstruction<0> { | 3201 class HConstant: public HTemplateInstruction<0> { |
3202 public: | 3202 public: |
3203 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); | 3203 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); |
3204 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation); | 3204 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation); |
3205 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double); | 3205 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double); |
3206 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>); | 3206 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>); |
3207 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, Handle<Object>, UniqueValueId); | |
3207 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference); | 3208 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference); |
3208 | 3209 |
3210 static HConstant* CreateAndInsertAfter(Zone* zone, | |
3211 HValue* context, | |
3212 int32_t value, | |
3213 HInstruction* instruction) { | |
3214 HConstant* new_constant = HConstant::New(zone, context, value); | |
3215 new_constant->InsertAfter(instruction); | |
3216 return new_constant; | |
3217 } | |
3218 | |
3219 static HConstant* CreateAndInsertBefore(Zone* zone, | |
3220 HValue* context, | |
3221 int32_t value, | |
3222 HInstruction* instruction) { | |
3223 HConstant* new_constant = HConstant::New(zone, context, value); | |
3224 new_constant->InsertBefore(instruction); | |
3225 return new_constant; | |
3226 } | |
3227 | |
3209 Handle<Object> handle() { | 3228 Handle<Object> handle() { |
3210 if (handle_.is_null()) { | 3229 if (handle_.is_null()) { |
3211 Factory* factory = Isolate::Current()->factory(); | 3230 Factory* factory = Isolate::Current()->factory(); |
3212 // Default arguments to is_not_in_new_space depend on this heap number | 3231 // Default arguments to is_not_in_new_space depend on this heap number |
3213 // to be tenured so that it's guaranteed not be be located in new space. | 3232 // to be tenured so that it's guaranteed not be be located in new space. |
3214 handle_ = factory->NewNumber(double_value_, TENURED); | 3233 handle_ = factory->NewNumber(double_value_, TENURED); |
3215 } | 3234 } |
3216 AllowDeferredHandleDereference smi_check; | 3235 AllowDeferredHandleDereference smi_check; |
3217 ASSERT(has_int32_value_ || !handle_->IsSmi()); | 3236 ASSERT(has_int32_value_ || !handle_->IsSmi()); |
3218 return handle_; | 3237 return handle_; |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3390 HConstant(int32_t value, | 3409 HConstant(int32_t value, |
3391 Representation r = Representation::None(), | 3410 Representation r = Representation::None(), |
3392 bool is_not_in_new_space = true, | 3411 bool is_not_in_new_space = true, |
3393 Handle<Object> optional_handle = Handle<Object>::null()); | 3412 Handle<Object> optional_handle = Handle<Object>::null()); |
3394 HConstant(double value, | 3413 HConstant(double value, |
3395 Representation r = Representation::None(), | 3414 Representation r = Representation::None(), |
3396 bool is_not_in_new_space = true, | 3415 bool is_not_in_new_space = true, |
3397 Handle<Object> optional_handle = Handle<Object>::null()); | 3416 Handle<Object> optional_handle = Handle<Object>::null()); |
3398 HConstant(Handle<Object> handle, | 3417 HConstant(Handle<Object> handle, |
3399 UniqueValueId unique_id, | 3418 UniqueValueId unique_id, |
3400 Representation r, | 3419 Representation r = Representation::Tagged(), |
Michael Starzinger
2013/08/09 09:22:58
As discussed offline: Please don't add default par
Hannes Payer (out of office)
2013/08/09 11:10:43
Done.
| |
3401 HType type, | 3420 HType type = HType::Tagged(), |
3402 bool is_internalized_string, | 3421 bool is_internalized_string = false, |
3403 bool is_not_in_new_space, | 3422 bool is_not_in_new_space = true, |
3404 bool is_cell, | 3423 bool is_cell = false, |
3405 bool boolean_value); | 3424 bool boolean_value = false); |
3406 explicit HConstant(ExternalReference reference); | 3425 explicit HConstant(ExternalReference reference); |
3407 | 3426 |
3408 void Initialize(Representation r); | 3427 void Initialize(Representation r); |
3409 | 3428 |
3410 virtual bool IsDeletable() const { return true; } | 3429 virtual bool IsDeletable() const { return true; } |
3411 | 3430 |
3412 // If this is a numerical constant, handle_ either points to to the | 3431 // If this is a numerical constant, handle_ either points to to the |
3413 // HeapObject the constant originated from or is null. If the | 3432 // HeapObject the constant originated from or is null. If the |
3414 // constant is non-numeric, handle_ always points to a valid | 3433 // constant is non-numeric, handle_ always points to a valid |
3415 // constant HeapObject. | 3434 // constant HeapObject. |
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5029 } | 5048 } |
5030 | 5049 |
5031 void MakePrefillWithFiller() { | 5050 void MakePrefillWithFiller() { |
5032 flags_ = static_cast<HAllocate::Flags>(flags_ | PREFILL_WITH_FILLER); | 5051 flags_ = static_cast<HAllocate::Flags>(flags_ | PREFILL_WITH_FILLER); |
5033 } | 5052 } |
5034 | 5053 |
5035 void MakeDoubleAligned() { | 5054 void MakeDoubleAligned() { |
5036 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); | 5055 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); |
5037 } | 5056 } |
5038 | 5057 |
5039 void UpdateSize(HValue* size) { | |
5040 SetOperandAt(1, size); | |
5041 } | |
5042 | |
5043 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 5058 virtual void HandleSideEffectDominator(GVNFlag side_effect, |
5044 HValue* dominator); | 5059 HValue* dominator); |
5045 | 5060 |
5046 virtual void PrintDataTo(StringStream* stream); | 5061 virtual void PrintDataTo(StringStream* stream); |
5047 | 5062 |
5048 DECLARE_CONCRETE_INSTRUCTION(Allocate) | 5063 DECLARE_CONCRETE_INSTRUCTION(Allocate) |
5049 | 5064 |
5050 private: | 5065 private: |
5051 enum Flags { | 5066 enum Flags { |
5052 ALLOCATE_IN_NEW_SPACE = 1 << 0, | 5067 ALLOCATE_IN_NEW_SPACE = 1 << 0, |
5053 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, | 5068 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, |
5054 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, | 5069 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, |
5055 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, | 5070 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, |
5056 PREFILL_WITH_FILLER = 1 << 4 | 5071 PREFILL_WITH_FILLER = 1 << 4 |
5057 }; | 5072 }; |
5058 | 5073 |
5059 HAllocate(HValue* context, | 5074 HAllocate(HValue* context, |
5060 HValue* size, | 5075 HValue* size, |
5061 HType type, | 5076 HType type, |
5062 PretenureFlag pretenure_flag, | 5077 PretenureFlag pretenure_flag, |
5063 InstanceType instance_type) | 5078 InstanceType instance_type) |
5064 : HTemplateInstruction<2>(type) { | 5079 : HTemplateInstruction<2>(type), |
5080 dominating_allocate_(NULL), | |
5081 filler_free_space_size_(NULL) { | |
5065 SetOperandAt(0, context); | 5082 SetOperandAt(0, context); |
5066 SetOperandAt(1, size); | 5083 SetOperandAt(1, size); |
5067 set_representation(Representation::Tagged()); | 5084 set_representation(Representation::Tagged()); |
5068 SetFlag(kTrackSideEffectDominators); | 5085 SetFlag(kTrackSideEffectDominators); |
5069 SetGVNFlag(kChangesNewSpacePromotion); | 5086 SetGVNFlag(kChangesNewSpacePromotion); |
5070 SetGVNFlag(kDependsOnNewSpacePromotion); | 5087 SetGVNFlag(kDependsOnNewSpacePromotion); |
5071 flags_ = pretenure_flag == TENURED | 5088 flags_ = pretenure_flag == TENURED |
5072 ? (Heap::TargetSpaceId(instance_type) == OLD_POINTER_SPACE | 5089 ? (Heap::TargetSpaceId(instance_type) == OLD_POINTER_SPACE |
5073 ? ALLOCATE_IN_OLD_POINTER_SPACE : ALLOCATE_IN_OLD_DATA_SPACE) | 5090 ? ALLOCATE_IN_OLD_POINTER_SPACE : ALLOCATE_IN_OLD_DATA_SPACE) |
5074 : ALLOCATE_IN_NEW_SPACE; | 5091 : ALLOCATE_IN_NEW_SPACE; |
5075 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { | 5092 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { |
5076 flags_ = static_cast<HAllocate::Flags>(flags_ | | 5093 flags_ = static_cast<HAllocate::Flags>(flags_ | |
5077 ALLOCATE_DOUBLE_ALIGNED); | 5094 ALLOCATE_DOUBLE_ALIGNED); |
5078 } | 5095 } |
5079 } | 5096 } |
5080 | 5097 |
5098 void UpdateSize(HValue* size) { | |
5099 SetOperandAt(1, size); | |
5100 } | |
5101 | |
5102 HAllocate* GetFoldableDominator(HAllocate* dominator); | |
5103 | |
5104 void UpdateFreeSpaceFiller(HConstant* old_filler_size, int32_t filler_size); | |
5105 | |
5106 void CreateFreeSpaceFiller(HAllocate* dominator, | |
5107 int32_t dominator_size, | |
5108 int32_t filler_size); | |
5109 | |
5110 bool IsFoldable(HAllocate* allocate) { | |
5111 return (IsNewSpaceAllocation() && allocate->IsNewSpaceAllocation()) || | |
5112 (IsOldDataSpaceAllocation() && allocate->IsOldDataSpaceAllocation()) || | |
5113 (IsOldPointerSpaceAllocation() && | |
5114 allocate->IsOldPointerSpaceAllocation()); | |
5115 } | |
5116 | |
5081 Flags flags_; | 5117 Flags flags_; |
5082 Handle<Map> known_initial_map_; | 5118 Handle<Map> known_initial_map_; |
5119 HAllocate* dominating_allocate_; | |
5120 HConstant* filler_free_space_size_; | |
5083 }; | 5121 }; |
5084 | 5122 |
5085 | 5123 |
5086 class HInnerAllocatedObject: public HTemplateInstruction<1> { | 5124 class HInnerAllocatedObject: public HTemplateInstruction<1> { |
5087 public: | 5125 public: |
5088 static HInnerAllocatedObject* New(Zone* zone, | 5126 static HInnerAllocatedObject* New(Zone* zone, |
5089 HValue* context, | 5127 HValue* context, |
5090 HValue* value, | 5128 HValue* value, |
5091 int offset, | 5129 int offset, |
5092 HType type = HType::Tagged()) { | 5130 HType type = HType::Tagged()) { |
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6778 virtual bool IsDeletable() const { return true; } | 6816 virtual bool IsDeletable() const { return true; } |
6779 }; | 6817 }; |
6780 | 6818 |
6781 | 6819 |
6782 #undef DECLARE_INSTRUCTION | 6820 #undef DECLARE_INSTRUCTION |
6783 #undef DECLARE_CONCRETE_INSTRUCTION | 6821 #undef DECLARE_CONCRETE_INSTRUCTION |
6784 | 6822 |
6785 } } // namespace v8::internal | 6823 } } // namespace v8::internal |
6786 | 6824 |
6787 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6825 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |