| 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 3265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3276 | 3276 |
| 3277 ASSERT((IsNewSpaceAllocation() && | 3277 ASSERT((IsNewSpaceAllocation() && |
| 3278 dominator_allocate->IsNewSpaceAllocation()) || | 3278 dominator_allocate->IsNewSpaceAllocation()) || |
| 3279 (IsOldDataSpaceAllocation() && | 3279 (IsOldDataSpaceAllocation() && |
| 3280 dominator_allocate->IsOldDataSpaceAllocation()) || | 3280 dominator_allocate->IsOldDataSpaceAllocation()) || |
| 3281 (IsOldPointerSpaceAllocation() && | 3281 (IsOldPointerSpaceAllocation() && |
| 3282 dominator_allocate->IsOldPointerSpaceAllocation())); | 3282 dominator_allocate->IsOldPointerSpaceAllocation())); |
| 3283 | 3283 |
| 3284 // First update the size of the dominator allocate instruction. | 3284 // First update the size of the dominator allocate instruction. |
| 3285 dominator_size = dominator_allocate->size(); | 3285 dominator_size = dominator_allocate->size(); |
| 3286 int32_t dominator_size_constant = | 3286 int32_t original_object_size = |
| 3287 HConstant::cast(dominator_size)->GetInteger32Constant(); | 3287 HConstant::cast(dominator_size)->GetInteger32Constant(); |
| 3288 int32_t dominator_size_constant = original_object_size; |
| 3288 int32_t current_size_constant = | 3289 int32_t current_size_constant = |
| 3289 HConstant::cast(current_size)->GetInteger32Constant(); | 3290 HConstant::cast(current_size)->GetInteger32Constant(); |
| 3290 int32_t new_dominator_size = dominator_size_constant + current_size_constant; | 3291 int32_t new_dominator_size = dominator_size_constant + current_size_constant; |
| 3291 | 3292 |
| 3292 if (MustAllocateDoubleAligned()) { | 3293 if (MustAllocateDoubleAligned()) { |
| 3293 if (!dominator_allocate->MustAllocateDoubleAligned()) { | 3294 if (!dominator_allocate->MustAllocateDoubleAligned()) { |
| 3294 dominator_allocate->MakeDoubleAligned(); | 3295 dominator_allocate->MakeDoubleAligned(); |
| 3295 } | 3296 } |
| 3296 if ((dominator_size_constant & kDoubleAlignmentMask) != 0) { | 3297 if ((dominator_size_constant & kDoubleAlignmentMask) != 0) { |
| 3297 dominator_size_constant += kDoubleSize / 2; | 3298 dominator_size_constant += kDoubleSize / 2; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 3312 zone, | 3313 zone, |
| 3313 context(), | 3314 context(), |
| 3314 new_dominator_size, | 3315 new_dominator_size, |
| 3315 Representation::None(), | 3316 Representation::None(), |
| 3316 dominator_allocate); | 3317 dominator_allocate); |
| 3317 dominator_allocate->UpdateSize(new_dominator_size_constant); | 3318 dominator_allocate->UpdateSize(new_dominator_size_constant); |
| 3318 | 3319 |
| 3319 #ifdef VERIFY_HEAP | 3320 #ifdef VERIFY_HEAP |
| 3320 if (FLAG_verify_heap && dominator_allocate->IsNewSpaceAllocation()) { | 3321 if (FLAG_verify_heap && dominator_allocate->IsNewSpaceAllocation()) { |
| 3321 dominator_allocate->MakePrefillWithFiller(); | 3322 dominator_allocate->MakePrefillWithFiller(); |
| 3323 } else { |
| 3324 // TODO(hpayer): This is a short-term hack to make allocation mementos |
| 3325 // work again in new space. |
| 3326 ClearNextMapWord(original_object_size); |
| 3322 } | 3327 } |
| 3328 #else |
| 3329 // TODO(hpayer): This is a short-term hack to make allocation mementos |
| 3330 // work again in new space. |
| 3331 ClearNextMapWord(original_object_size); |
| 3323 #endif | 3332 #endif |
| 3324 | 3333 |
| 3334 dominator_allocate->clear_next_map_word_ = clear_next_map_word_; |
| 3335 |
| 3325 // After that replace the dominated allocate instruction. | 3336 // After that replace the dominated allocate instruction. |
| 3326 HInstruction* dominated_allocate_instr = | 3337 HInstruction* dominated_allocate_instr = |
| 3327 HInnerAllocatedObject::New(zone, | 3338 HInnerAllocatedObject::New(zone, |
| 3328 context(), | 3339 context(), |
| 3329 dominator_allocate, | 3340 dominator_allocate, |
| 3330 dominator_size_constant, | 3341 dominator_size_constant, |
| 3331 type()); | 3342 type()); |
| 3332 dominated_allocate_instr->InsertBefore(this); | 3343 dominated_allocate_instr->InsertBefore(this); |
| 3333 DeleteAndReplaceWith(dominated_allocate_instr); | 3344 DeleteAndReplaceWith(dominated_allocate_instr); |
| 3334 if (FLAG_trace_allocation_folding) { | 3345 if (FLAG_trace_allocation_folding) { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3450 HObjectAccess::ForJSObjectOffset(FreeSpace::kSizeOffset, | 3461 HObjectAccess::ForJSObjectOffset(FreeSpace::kSizeOffset, |
| 3451 Representation::Smi()); | 3462 Representation::Smi()); |
| 3452 HStoreNamedField* store_size = HStoreNamedField::New(zone, context(), | 3463 HStoreNamedField* store_size = HStoreNamedField::New(zone, context(), |
| 3453 free_space_instr, access, filler_size); | 3464 free_space_instr, access, filler_size); |
| 3454 store_size->SetFlag(HValue::kHasNoObservableSideEffects); | 3465 store_size->SetFlag(HValue::kHasNoObservableSideEffects); |
| 3455 store_size->InsertAfter(filler_size); | 3466 store_size->InsertAfter(filler_size); |
| 3456 filler_free_space_size_ = store_size; | 3467 filler_free_space_size_ = store_size; |
| 3457 } | 3468 } |
| 3458 | 3469 |
| 3459 | 3470 |
| 3471 void HAllocate::ClearNextMapWord(int offset) { |
| 3472 if (clear_next_map_word_) { |
| 3473 Zone* zone = block()->zone(); |
| 3474 HObjectAccess access = HObjectAccess::ForJSObjectOffset(offset); |
| 3475 HStoreNamedField* clear_next_map = |
| 3476 HStoreNamedField::New(zone, context(), this, access, |
| 3477 block()->graph()->GetConstantNull()); |
| 3478 clear_next_map->ClearAllSideEffects(); |
| 3479 clear_next_map->InsertAfter(this); |
| 3480 } |
| 3481 } |
| 3482 |
| 3483 |
| 3460 void HAllocate::PrintDataTo(StringStream* stream) { | 3484 void HAllocate::PrintDataTo(StringStream* stream) { |
| 3461 size()->PrintNameTo(stream); | 3485 size()->PrintNameTo(stream); |
| 3462 stream->Add(" ("); | 3486 stream->Add(" ("); |
| 3463 if (IsNewSpaceAllocation()) stream->Add("N"); | 3487 if (IsNewSpaceAllocation()) stream->Add("N"); |
| 3464 if (IsOldPointerSpaceAllocation()) stream->Add("P"); | 3488 if (IsOldPointerSpaceAllocation()) stream->Add("P"); |
| 3465 if (IsOldDataSpaceAllocation()) stream->Add("D"); | 3489 if (IsOldDataSpaceAllocation()) stream->Add("D"); |
| 3466 if (MustAllocateDoubleAligned()) stream->Add("A"); | 3490 if (MustAllocateDoubleAligned()) stream->Add("A"); |
| 3467 if (MustPrefillWithFiller()) stream->Add("F"); | 3491 if (MustPrefillWithFiller()) stream->Add("F"); |
| 3468 stream->Add(")"); | 3492 stream->Add(")"); |
| 3469 } | 3493 } |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4200 break; | 4224 break; |
| 4201 case kExternalMemory: | 4225 case kExternalMemory: |
| 4202 stream->Add("[external-memory]"); | 4226 stream->Add("[external-memory]"); |
| 4203 break; | 4227 break; |
| 4204 } | 4228 } |
| 4205 | 4229 |
| 4206 stream->Add("@%d", offset()); | 4230 stream->Add("@%d", offset()); |
| 4207 } | 4231 } |
| 4208 | 4232 |
| 4209 } } // namespace v8::internal | 4233 } } // namespace v8::internal |
| OLD | NEW |