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 3163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3174 | 3174 |
3175 | 3175 |
3176 HType HAllocate::CalculateInferredType() { | 3176 HType HAllocate::CalculateInferredType() { |
3177 return type_; | 3177 return type_; |
3178 } | 3178 } |
3179 | 3179 |
3180 | 3180 |
3181 void HAllocate::HandleSideEffectDominator(GVNFlag side_effect, | 3181 void HAllocate::HandleSideEffectDominator(GVNFlag side_effect, |
3182 HValue* dominator) { | 3182 HValue* dominator) { |
3183 ASSERT(side_effect == kChangesNewSpacePromotion); | 3183 ASSERT(side_effect == kChangesNewSpacePromotion); |
| 3184 if (!FLAG_use_allocation_folding) return; |
| 3185 |
3184 // Try to fold allocations together with their dominating allocations. | 3186 // Try to fold allocations together with their dominating allocations. |
3185 if (!FLAG_use_allocation_folding || !dominator->IsAllocate()) { | 3187 if (!dominator->IsAllocate()) { |
| 3188 if (FLAG_trace_allocation_folding) { |
| 3189 PrintF("#%d (%s) cannot fold into #%d (%s)\n", |
| 3190 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); |
| 3191 } |
3186 return; | 3192 return; |
3187 } | 3193 } |
| 3194 |
3188 HAllocate* dominator_allocate_instr = HAllocate::cast(dominator); | 3195 HAllocate* dominator_allocate_instr = HAllocate::cast(dominator); |
3189 HValue* dominator_size = dominator_allocate_instr->size(); | 3196 HValue* dominator_size = dominator_allocate_instr->size(); |
3190 HValue* current_size = size(); | 3197 HValue* current_size = size(); |
3191 // We can just fold allocations that are guaranteed in new space. | 3198 // We can just fold allocations that are guaranteed in new space. |
3192 // TODO(hpayer): Support double aligned allocations. | 3199 // TODO(hpayer): Support double aligned allocations. |
3193 // TODO(hpayer): Add support for non-constant allocation in dominator. | 3200 // TODO(hpayer): Add support for non-constant allocation in dominator. |
3194 if (!GuaranteedInNewSpace() || MustAllocateDoubleAligned() || | 3201 if (!GuaranteedInNewSpace() || MustAllocateDoubleAligned() || |
3195 !current_size->IsInteger32Constant() || | 3202 !current_size->IsInteger32Constant() || |
3196 !dominator_allocate_instr->GuaranteedInNewSpace() || | 3203 !dominator_allocate_instr->GuaranteedInNewSpace() || |
3197 dominator_allocate_instr->MustAllocateDoubleAligned() || | 3204 dominator_allocate_instr->MustAllocateDoubleAligned() || |
3198 !dominator_size->IsInteger32Constant()) { | 3205 !dominator_size->IsInteger32Constant()) { |
| 3206 if (FLAG_trace_allocation_folding) { |
| 3207 PrintF("#%d (%s) cannot fold into #%d (%s)\n", |
| 3208 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); |
| 3209 } |
3199 return; | 3210 return; |
3200 } | 3211 } |
3201 | 3212 |
3202 // First update the size of the dominator allocate instruction. | 3213 // First update the size of the dominator allocate instruction. |
3203 int32_t dominator_size_constant = | 3214 int32_t dominator_size_constant = |
3204 HConstant::cast(dominator_size)->GetInteger32Constant(); | 3215 HConstant::cast(dominator_size)->GetInteger32Constant(); |
3205 int32_t current_size_constant = | 3216 int32_t current_size_constant = |
3206 HConstant::cast(current_size)->GetInteger32Constant(); | 3217 HConstant::cast(current_size)->GetInteger32Constant(); |
3207 HBasicBlock* block = dominator->block(); | 3218 HBasicBlock* block = dominator->block(); |
3208 Zone* zone = block->zone(); | 3219 Zone* zone = block->zone(); |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3969 case kBackingStore: | 3980 case kBackingStore: |
3970 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 3981 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
3971 stream->Add("[backing-store]"); | 3982 stream->Add("[backing-store]"); |
3972 break; | 3983 break; |
3973 } | 3984 } |
3974 | 3985 |
3975 stream->Add("@%d", offset()); | 3986 stream->Add("@%d", offset()); |
3976 } | 3987 } |
3977 | 3988 |
3978 } } // namespace v8::internal | 3989 } } // namespace v8::internal |
OLD | NEW |