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 3189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3200 !dominator_allocate_instr->IsNewSpaceAllocation() || | 3200 !dominator_allocate_instr->IsNewSpaceAllocation() || |
3201 !dominator_size->IsInteger32Constant()) { | 3201 !dominator_size->IsInteger32Constant()) { |
3202 if (FLAG_trace_allocation_folding) { | 3202 if (FLAG_trace_allocation_folding) { |
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 // First update the size of the dominator allocate instruction. | 3209 // First update the size of the dominator allocate instruction. |
3210 int32_t dominator_size_constant = | 3210 int32_t original_object_size = |
3211 HConstant::cast(dominator_size)->GetInteger32Constant(); | 3211 HConstant::cast(dominator_size)->GetInteger32Constant(); |
| 3212 int32_t dominator_size_constant = original_object_size; |
3212 int32_t current_size_constant = | 3213 int32_t current_size_constant = |
3213 HConstant::cast(current_size)->GetInteger32Constant(); | 3214 HConstant::cast(current_size)->GetInteger32Constant(); |
3214 int32_t new_dominator_size = dominator_size_constant + current_size_constant; | 3215 int32_t new_dominator_size = dominator_size_constant + current_size_constant; |
3215 | 3216 |
3216 if (MustAllocateDoubleAligned()) { | 3217 if (MustAllocateDoubleAligned()) { |
3217 if (!dominator_allocate_instr->MustAllocateDoubleAligned()) { | 3218 if (!dominator_allocate_instr->MustAllocateDoubleAligned()) { |
3218 dominator_allocate_instr->MakeDoubleAligned(); | 3219 dominator_allocate_instr->MakeDoubleAligned(); |
3219 } | 3220 } |
3220 if ((dominator_size_constant & kDoubleAlignmentMask) != 0) { | 3221 if ((dominator_size_constant & kDoubleAlignmentMask) != 0) { |
3221 dominator_size_constant += kDoubleSize / 2; | 3222 dominator_size_constant += kDoubleSize / 2; |
(...skipping 12 matching lines...) Expand all Loading... |
3234 HBasicBlock* block = dominator->block(); | 3235 HBasicBlock* block = dominator->block(); |
3235 Zone* zone = block->zone(); | 3236 Zone* zone = block->zone(); |
3236 HInstruction* new_dominator_size_constant = | 3237 HInstruction* new_dominator_size_constant = |
3237 HConstant::New(zone, context(), new_dominator_size); | 3238 HConstant::New(zone, context(), new_dominator_size); |
3238 new_dominator_size_constant->InsertBefore(dominator_allocate_instr); | 3239 new_dominator_size_constant->InsertBefore(dominator_allocate_instr); |
3239 dominator_allocate_instr->UpdateSize(new_dominator_size_constant); | 3240 dominator_allocate_instr->UpdateSize(new_dominator_size_constant); |
3240 | 3241 |
3241 #ifdef VERIFY_HEAP | 3242 #ifdef VERIFY_HEAP |
3242 if (FLAG_verify_heap) { | 3243 if (FLAG_verify_heap) { |
3243 dominator_allocate_instr->MakePrefillWithFiller(); | 3244 dominator_allocate_instr->MakePrefillWithFiller(); |
| 3245 } else { |
| 3246 // TODO(hpayer): This is a short-term hack to make allocation mementos |
| 3247 // work again in new space. |
| 3248 ClearNextMapWord(original_object_size); |
3244 } | 3249 } |
| 3250 #else |
| 3251 // TODO(hpayer): This is a short-term hack to make allocation mementos |
| 3252 // work again in new space. |
| 3253 ClearNextMapWord(original_object_size); |
3245 #endif | 3254 #endif |
| 3255 dominator_allocate_instr->clear_next_map_word_ = clear_next_map_word_; |
3246 | 3256 |
3247 // After that replace the dominated allocate instruction. | 3257 // After that replace the dominated allocate instruction. |
3248 HInstruction* dominated_allocate_instr = | 3258 HInstruction* dominated_allocate_instr = |
3249 HInnerAllocatedObject::New(zone, | 3259 HInnerAllocatedObject::New(zone, |
3250 context(), | 3260 context(), |
3251 dominator_allocate_instr, | 3261 dominator_allocate_instr, |
3252 dominator_size_constant, | 3262 dominator_size_constant, |
3253 type()); | 3263 type()); |
3254 dominated_allocate_instr->InsertBefore(this); | 3264 dominated_allocate_instr->InsertBefore(this); |
3255 DeleteAndReplaceWith(dominated_allocate_instr); | 3265 DeleteAndReplaceWith(dominated_allocate_instr); |
3256 if (FLAG_trace_allocation_folding) { | 3266 if (FLAG_trace_allocation_folding) { |
3257 PrintF("#%d (%s) folded into #%d (%s)\n", | 3267 PrintF("#%d (%s) folded into #%d (%s)\n", |
3258 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); | 3268 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); |
3259 } | 3269 } |
3260 } | 3270 } |
3261 | 3271 |
3262 | 3272 |
| 3273 void HAllocate::ClearNextMapWord(int offset) { |
| 3274 if (clear_next_map_word_) { |
| 3275 Zone* zone = block()->zone(); |
| 3276 HObjectAccess access = HObjectAccess::ForJSObjectOffset(offset); |
| 3277 HStoreNamedField* clear_next_map = |
| 3278 HStoreNamedField::New(zone, context(), this, access, |
| 3279 block()->graph()->GetConstantNull()); |
| 3280 clear_next_map->ClearAllSideEffects(); |
| 3281 clear_next_map->InsertAfter(this); |
| 3282 } |
| 3283 } |
| 3284 |
| 3285 |
3263 void HAllocate::PrintDataTo(StringStream* stream) { | 3286 void HAllocate::PrintDataTo(StringStream* stream) { |
3264 size()->PrintNameTo(stream); | 3287 size()->PrintNameTo(stream); |
3265 stream->Add(" ("); | 3288 stream->Add(" ("); |
3266 if (IsNewSpaceAllocation()) stream->Add("N"); | 3289 if (IsNewSpaceAllocation()) stream->Add("N"); |
3267 if (IsOldPointerSpaceAllocation()) stream->Add("P"); | 3290 if (IsOldPointerSpaceAllocation()) stream->Add("P"); |
3268 if (IsOldDataSpaceAllocation()) stream->Add("D"); | 3291 if (IsOldDataSpaceAllocation()) stream->Add("D"); |
3269 if (MustAllocateDoubleAligned()) stream->Add("A"); | 3292 if (MustAllocateDoubleAligned()) stream->Add("A"); |
3270 if (MustPrefillWithFiller()) stream->Add("F"); | 3293 if (MustPrefillWithFiller()) stream->Add("F"); |
3271 stream->Add(")"); | 3294 stream->Add(")"); |
3272 } | 3295 } |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3994 break; | 4017 break; |
3995 case kExternalMemory: | 4018 case kExternalMemory: |
3996 stream->Add("[external-memory]"); | 4019 stream->Add("[external-memory]"); |
3997 break; | 4020 break; |
3998 } | 4021 } |
3999 | 4022 |
4000 stream->Add("@%d", offset()); | 4023 stream->Add("@%d", offset()); |
4001 } | 4024 } |
4002 | 4025 |
4003 } } // namespace v8::internal | 4026 } } // namespace v8::internal |
OLD | NEW |