| 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 3192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3203 PrintF("#%d (%s) cannot fold into #%d (%s)\n", | 3203 PrintF("#%d (%s) cannot fold into #%d (%s)\n", |
| 3204 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); | 3204 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); |
| 3205 } | 3205 } |
| 3206 return; | 3206 return; |
| 3207 } | 3207 } |
| 3208 | 3208 |
| 3209 HAllocate* dominator_allocate_instr = HAllocate::cast(dominator); | 3209 HAllocate* dominator_allocate_instr = HAllocate::cast(dominator); |
| 3210 HValue* dominator_size = dominator_allocate_instr->size(); | 3210 HValue* dominator_size = dominator_allocate_instr->size(); |
| 3211 HValue* current_size = size(); | 3211 HValue* current_size = size(); |
| 3212 // We can just fold allocations that are guaranteed in new space. | 3212 // We can just fold allocations that are guaranteed in new space. |
| 3213 // TODO(hpayer): Support double aligned allocations. | |
| 3214 // TODO(hpayer): Add support for non-constant allocation in dominator. | 3213 // TODO(hpayer): Add support for non-constant allocation in dominator. |
| 3215 if (!GuaranteedInNewSpace() || MustAllocateDoubleAligned() || | 3214 if (!GuaranteedInNewSpace() || !current_size->IsInteger32Constant() || |
| 3216 !current_size->IsInteger32Constant() || | |
| 3217 !dominator_allocate_instr->GuaranteedInNewSpace() || | 3215 !dominator_allocate_instr->GuaranteedInNewSpace() || |
| 3218 dominator_allocate_instr->MustAllocateDoubleAligned() || | |
| 3219 !dominator_size->IsInteger32Constant()) { | 3216 !dominator_size->IsInteger32Constant()) { |
| 3220 if (FLAG_trace_allocation_folding) { | 3217 if (FLAG_trace_allocation_folding) { |
| 3221 PrintF("#%d (%s) cannot fold into #%d (%s)\n", | 3218 PrintF("#%d (%s) cannot fold into #%d (%s)\n", |
| 3222 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); | 3219 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); |
| 3223 } | 3220 } |
| 3224 return; | 3221 return; |
| 3225 } | 3222 } |
| 3226 | 3223 |
| 3227 // First update the size of the dominator allocate instruction. | 3224 // First update the size of the dominator allocate instruction. |
| 3228 int32_t dominator_size_constant = | 3225 int32_t dominator_size_constant = |
| 3229 HConstant::cast(dominator_size)->GetInteger32Constant(); | 3226 HConstant::cast(dominator_size)->GetInteger32Constant(); |
| 3230 int32_t current_size_constant = | 3227 int32_t current_size_constant = |
| 3231 HConstant::cast(current_size)->GetInteger32Constant(); | 3228 HConstant::cast(current_size)->GetInteger32Constant(); |
| 3232 int32_t new_dominator_size = dominator_size_constant + current_size_constant; | 3229 int32_t new_dominator_size = dominator_size_constant + current_size_constant; |
| 3230 |
| 3231 if (MustAllocateDoubleAligned()) { |
| 3232 if (!dominator_allocate_instr->MustAllocateDoubleAligned()) { |
| 3233 dominator_allocate_instr->SetFlags(HAllocate::ALLOCATE_DOUBLE_ALIGNED); |
| 3234 } |
| 3235 if ((dominator_size_constant & kDoubleAlignmentMask) != 0) { |
| 3236 dominator_size_constant += kDoubleSize / 2; |
| 3237 new_dominator_size += kDoubleSize / 2; |
| 3238 } |
| 3239 } |
| 3240 |
| 3233 if (new_dominator_size > Page::kMaxNonCodeHeapObjectSize) { | 3241 if (new_dominator_size > Page::kMaxNonCodeHeapObjectSize) { |
| 3234 if (FLAG_trace_allocation_folding) { | 3242 if (FLAG_trace_allocation_folding) { |
| 3235 PrintF("#%d (%s) cannot fold into #%d (%s) due to size: %d\n", | 3243 PrintF("#%d (%s) cannot fold into #%d (%s) due to size: %d\n", |
| 3236 id(), Mnemonic(), dominator->id(), dominator->Mnemonic(), | 3244 id(), Mnemonic(), dominator->id(), dominator->Mnemonic(), |
| 3237 new_dominator_size); | 3245 new_dominator_size); |
| 3238 } | 3246 } |
| 3239 return; | 3247 return; |
| 3240 } | 3248 } |
| 3241 HBasicBlock* block = dominator->block(); | 3249 HBasicBlock* block = dominator->block(); |
| 3242 Zone* zone = block->zone(); | 3250 Zone* zone = block->zone(); |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3980 case kBackingStore: | 3988 case kBackingStore: |
| 3981 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 3989 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
| 3982 stream->Add("[backing-store]"); | 3990 stream->Add("[backing-store]"); |
| 3983 break; | 3991 break; |
| 3984 } | 3992 } |
| 3985 | 3993 |
| 3986 stream->Add("@%d", offset()); | 3994 stream->Add("@%d", offset()); |
| 3987 } | 3995 } |
| 3988 | 3996 |
| 3989 } } // namespace v8::internal | 3997 } } // namespace v8::internal |
| OLD | NEW |