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 3250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3261 if (new_dominator_size > Page::kMaxNonCodeHeapObjectSize) { | 3261 if (new_dominator_size > Page::kMaxNonCodeHeapObjectSize) { |
3262 if (FLAG_trace_allocation_folding) { | 3262 if (FLAG_trace_allocation_folding) { |
3263 PrintF("#%d (%s) cannot fold into #%d (%s) due to size: %d\n", | 3263 PrintF("#%d (%s) cannot fold into #%d (%s) due to size: %d\n", |
3264 id(), Mnemonic(), dominator_allocate->id(), | 3264 id(), Mnemonic(), dominator_allocate->id(), |
3265 dominator_allocate->Mnemonic(), new_dominator_size); | 3265 dominator_allocate->Mnemonic(), new_dominator_size); |
3266 } | 3266 } |
3267 return; | 3267 return; |
3268 } | 3268 } |
3269 | 3269 |
3270 HInstruction* new_dominator_size_constant = HConstant::CreateAndInsertBefore( | 3270 HInstruction* new_dominator_size_constant = HConstant::CreateAndInsertBefore( |
3271 zone, context(), new_dominator_size, dominator_allocate); | 3271 zone, |
| 3272 context(), |
| 3273 new_dominator_size, |
| 3274 Representation::None(), |
| 3275 dominator_allocate); |
3272 dominator_allocate->UpdateSize(new_dominator_size_constant); | 3276 dominator_allocate->UpdateSize(new_dominator_size_constant); |
3273 | 3277 |
3274 #ifdef VERIFY_HEAP | 3278 #ifdef VERIFY_HEAP |
3275 if (FLAG_verify_heap && dominator_allocate->IsNewSpaceAllocation()) { | 3279 if (FLAG_verify_heap && dominator_allocate->IsNewSpaceAllocation()) { |
3276 dominator_allocate->MakePrefillWithFiller(); | 3280 dominator_allocate->MakePrefillWithFiller(); |
3277 } else { | 3281 } else { |
3278 // TODO(hpayer): This is a short-term hack to make allocation mementos | 3282 // TODO(hpayer): This is a short-term hack to make allocation mementos |
3279 // work again in new space. | 3283 // work again in new space. |
3280 dominator_allocate->ClearNextMapWord(original_object_size); | 3284 dominator_allocate->ClearNextMapWord(original_object_size); |
3281 } | 3285 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3364 // We can hoist the old space allocation over the actual dominator. | 3368 // We can hoist the old space allocation over the actual dominator. |
3365 return dominator_dominator; | 3369 return dominator_dominator; |
3366 } | 3370 } |
3367 return dominator; | 3371 return dominator; |
3368 } | 3372 } |
3369 | 3373 |
3370 | 3374 |
3371 void HAllocate::UpdateFreeSpaceFiller(int32_t free_space_size) { | 3375 void HAllocate::UpdateFreeSpaceFiller(int32_t free_space_size) { |
3372 ASSERT(filler_free_space_size_ != NULL); | 3376 ASSERT(filler_free_space_size_ != NULL); |
3373 Zone* zone = block()->zone(); | 3377 Zone* zone = block()->zone(); |
| 3378 // We must explicitly force Smi representation here because on x64 we |
| 3379 // would otherwise automatically choose int32, but the actual store |
| 3380 // requires a Smi-tagged value. |
3374 HConstant* new_free_space_size = HConstant::CreateAndInsertBefore( | 3381 HConstant* new_free_space_size = HConstant::CreateAndInsertBefore( |
3375 zone, | 3382 zone, |
3376 context(), | 3383 context(), |
3377 filler_free_space_size_->value()->GetInteger32Constant() + | 3384 filler_free_space_size_->value()->GetInteger32Constant() + |
3378 free_space_size, | 3385 free_space_size, |
| 3386 Representation::Smi(), |
3379 filler_free_space_size_); | 3387 filler_free_space_size_); |
3380 filler_free_space_size_->UpdateValue(new_free_space_size); | 3388 filler_free_space_size_->UpdateValue(new_free_space_size); |
3381 } | 3389 } |
3382 | 3390 |
3383 | 3391 |
3384 void HAllocate::CreateFreeSpaceFiller(int32_t free_space_size) { | 3392 void HAllocate::CreateFreeSpaceFiller(int32_t free_space_size) { |
3385 ASSERT(filler_free_space_size_ == NULL); | 3393 ASSERT(filler_free_space_size_ == NULL); |
3386 Zone* zone = block()->zone(); | 3394 Zone* zone = block()->zone(); |
3387 int32_t dominator_size = | 3395 int32_t dominator_size = |
3388 HConstant::cast(dominating_allocate_->size())->GetInteger32Constant(); | 3396 HConstant::cast(dominating_allocate_->size())->GetInteger32Constant(); |
3389 HInstruction* free_space_instr = | 3397 HInstruction* free_space_instr = |
3390 HInnerAllocatedObject::New(zone, context(), dominating_allocate_, | 3398 HInnerAllocatedObject::New(zone, context(), dominating_allocate_, |
3391 dominator_size, type()); | 3399 dominator_size, type()); |
3392 free_space_instr->InsertBefore(this); | 3400 free_space_instr->InsertBefore(this); |
3393 HConstant* filler_map = HConstant::New( | 3401 HConstant* filler_map = HConstant::New( |
3394 zone, | 3402 zone, |
3395 context(), | 3403 context(), |
3396 isolate()->factory()->free_space_map(), | 3404 isolate()->factory()->free_space_map(), |
3397 UniqueValueId(isolate()->heap()->free_space_map())); | 3405 UniqueValueId(isolate()->heap()->free_space_map())); |
3398 filler_map->InsertAfter(free_space_instr); | 3406 filler_map->InsertAfter(free_space_instr); |
3399 HInstruction* store_map = HStoreNamedField::New(zone, context(), | 3407 HInstruction* store_map = HStoreNamedField::New(zone, context(), |
3400 free_space_instr, HObjectAccess::ForMap(), filler_map); | 3408 free_space_instr, HObjectAccess::ForMap(), filler_map); |
3401 store_map->SetFlag(HValue::kHasNoObservableSideEffects); | 3409 store_map->SetFlag(HValue::kHasNoObservableSideEffects); |
3402 store_map->InsertAfter(filler_map); | 3410 store_map->InsertAfter(filler_map); |
3403 | 3411 |
| 3412 // We must explicitly force Smi representation here because on x64 we |
| 3413 // would otherwise automatically choose int32, but the actual store |
| 3414 // requires a Smi-tagged value. |
3404 HConstant* filler_size = HConstant::CreateAndInsertAfter( | 3415 HConstant* filler_size = HConstant::CreateAndInsertAfter( |
3405 zone, context(), free_space_size, store_map); | 3416 zone, context(), free_space_size, Representation::Smi(), store_map); |
| 3417 // Must force Smi representation for x64 (see comment above). |
3406 HObjectAccess access = | 3418 HObjectAccess access = |
3407 HObjectAccess::ForJSObjectOffset(FreeSpace::kSizeOffset); | 3419 HObjectAccess::ForJSObjectOffset(FreeSpace::kSizeOffset, |
| 3420 Representation::Smi()); |
3408 HStoreNamedField* store_size = HStoreNamedField::New(zone, context(), | 3421 HStoreNamedField* store_size = HStoreNamedField::New(zone, context(), |
3409 free_space_instr, access, filler_size); | 3422 free_space_instr, access, filler_size); |
3410 store_size->SetFlag(HValue::kHasNoObservableSideEffects); | 3423 store_size->SetFlag(HValue::kHasNoObservableSideEffects); |
3411 store_size->InsertAfter(filler_size); | 3424 store_size->InsertAfter(filler_size); |
3412 filler_free_space_size_ = store_size; | 3425 filler_free_space_size_ = store_size; |
3413 } | 3426 } |
3414 | 3427 |
3415 | 3428 |
3416 void HAllocate::ClearNextMapWord(int offset) { | 3429 void HAllocate::ClearNextMapWord(int offset) { |
3417 if (clear_next_map_word_) { | 3430 if (clear_next_map_word_) { |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4160 break; | 4173 break; |
4161 case kExternalMemory: | 4174 case kExternalMemory: |
4162 stream->Add("[external-memory]"); | 4175 stream->Add("[external-memory]"); |
4163 break; | 4176 break; |
4164 } | 4177 } |
4165 | 4178 |
4166 stream->Add("@%d", offset()); | 4179 stream->Add("@%d", offset()); |
4167 } | 4180 } |
4168 | 4181 |
4169 } } // namespace v8::internal | 4182 } } // namespace v8::internal |
OLD | NEW |