Chromium Code Reviews| 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 // Try to fold allocations together with their dominating allocations. | 3184 if (!FLAG_use_allocation_folding) { |
| 3185 if (!FLAG_use_allocation_folding || !dominator->IsAllocate()) { | |
| 3186 return; | 3185 return; |
|
Michael Starzinger
2013/07/16 08:44:36
nit: This early return should fit into one line.
Hannes Payer (out of office)
2013/07/16 08:51:52
Done.
| |
| 3187 } | 3186 } |
| 3188 HAllocate* dominator_allocate_instr = HAllocate::cast(dominator); | 3187 HAllocate* dominator_allocate_instr = HAllocate::cast(dominator); |
|
Michael Starzinger
2013/07/16 08:44:36
This cast will fail if "dominator" is not an HAllo
Hannes Payer (out of office)
2013/07/16 08:51:52
Yes, then I guess I have to duplicate the tracing
| |
| 3189 HValue* dominator_size = dominator_allocate_instr->size(); | 3188 HValue* dominator_size = dominator_allocate_instr->size(); |
| 3190 HValue* current_size = size(); | 3189 HValue* current_size = size(); |
| 3190 // Try to fold allocations together with their dominating allocations. | |
| 3191 // We can just fold allocations that are guaranteed in new space. | 3191 // We can just fold allocations that are guaranteed in new space. |
| 3192 // TODO(hpayer): Support double aligned allocations. | 3192 // TODO(hpayer): Support double aligned allocations. |
| 3193 // TODO(hpayer): Add support for non-constant allocation in dominator. | 3193 // TODO(hpayer): Add support for non-constant allocation in dominator. |
| 3194 if (!GuaranteedInNewSpace() || MustAllocateDoubleAligned() || | 3194 if (!GuaranteedInNewSpace() || MustAllocateDoubleAligned() || |
| 3195 !current_size->IsInteger32Constant() || | 3195 !current_size->IsInteger32Constant() || |
| 3196 !dominator->IsAllocate() || | |
| 3196 !dominator_allocate_instr->GuaranteedInNewSpace() || | 3197 !dominator_allocate_instr->GuaranteedInNewSpace() || |
| 3197 dominator_allocate_instr->MustAllocateDoubleAligned() || | 3198 dominator_allocate_instr->MustAllocateDoubleAligned() || |
| 3198 !dominator_size->IsInteger32Constant()) { | 3199 !dominator_size->IsInteger32Constant()) { |
| 3200 if (FLAG_trace_allocation_folding) { | |
| 3201 PrintF("#%d (%s) cannot fold into #%d (%s)\n", | |
| 3202 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); | |
| 3203 } | |
| 3199 return; | 3204 return; |
| 3200 } | 3205 } |
| 3201 | 3206 |
| 3202 // First update the size of the dominator allocate instruction. | 3207 // First update the size of the dominator allocate instruction. |
| 3203 int32_t dominator_size_constant = | 3208 int32_t dominator_size_constant = |
| 3204 HConstant::cast(dominator_size)->GetInteger32Constant(); | 3209 HConstant::cast(dominator_size)->GetInteger32Constant(); |
| 3205 int32_t current_size_constant = | 3210 int32_t current_size_constant = |
| 3206 HConstant::cast(current_size)->GetInteger32Constant(); | 3211 HConstant::cast(current_size)->GetInteger32Constant(); |
| 3207 HBasicBlock* block = dominator->block(); | 3212 HBasicBlock* block = dominator->block(); |
| 3208 Zone* zone = block->zone(); | 3213 Zone* zone = block->zone(); |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3969 case kBackingStore: | 3974 case kBackingStore: |
| 3970 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 3975 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
| 3971 stream->Add("[backing-store]"); | 3976 stream->Add("[backing-store]"); |
| 3972 break; | 3977 break; |
| 3973 } | 3978 } |
| 3974 | 3979 |
| 3975 stream->Add("@%d", offset()); | 3980 stream->Add("@%d", offset()); |
| 3976 } | 3981 } |
| 3977 | 3982 |
| 3978 } } // namespace v8::internal | 3983 } } // namespace v8::internal |
| OLD | NEW |