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 3278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3289 if (new_dominator_size > Page::kMaxNonCodeHeapObjectSize) { | 3289 if (new_dominator_size > Page::kMaxNonCodeHeapObjectSize) { |
3290 if (FLAG_trace_allocation_folding) { | 3290 if (FLAG_trace_allocation_folding) { |
3291 PrintF("#%d (%s) cannot fold into #%d (%s) due to size: %d\n", | 3291 PrintF("#%d (%s) cannot fold into #%d (%s) due to size: %d\n", |
3292 id(), Mnemonic(), dominator_allocate->id(), | 3292 id(), Mnemonic(), dominator_allocate->id(), |
3293 dominator_allocate->Mnemonic(), new_dominator_size); | 3293 dominator_allocate->Mnemonic(), new_dominator_size); |
3294 } | 3294 } |
3295 return; | 3295 return; |
3296 } | 3296 } |
3297 | 3297 |
3298 HInstruction* new_dominator_size_constant = HConstant::CreateAndInsertBefore( | 3298 HInstruction* new_dominator_size_constant = HConstant::CreateAndInsertBefore( |
3299 zone, context(), new_dominator_size, dominator_allocate); | 3299 zone, |
| 3300 context(), |
| 3301 new_dominator_size, |
| 3302 Representation::None(), |
| 3303 dominator_allocate); |
3300 dominator_allocate->UpdateSize(new_dominator_size_constant); | 3304 dominator_allocate->UpdateSize(new_dominator_size_constant); |
3301 | 3305 |
3302 #ifdef VERIFY_HEAP | 3306 #ifdef VERIFY_HEAP |
3303 if (FLAG_verify_heap && dominator_allocate->IsNewSpaceAllocation()) { | 3307 if (FLAG_verify_heap && dominator_allocate->IsNewSpaceAllocation()) { |
3304 dominator_allocate->MakePrefillWithFiller(); | 3308 dominator_allocate->MakePrefillWithFiller(); |
3305 } | 3309 } |
3306 #endif | 3310 #endif |
3307 | 3311 |
3308 // After that replace the dominated allocate instruction. | 3312 // After that replace the dominated allocate instruction. |
3309 HInstruction* dominated_allocate_instr = | 3313 HInstruction* dominated_allocate_instr = |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3382 // We can hoist the old space allocation over the actual dominator. | 3386 // We can hoist the old space allocation over the actual dominator. |
3383 return dominator_dominator; | 3387 return dominator_dominator; |
3384 } | 3388 } |
3385 return dominator; | 3389 return dominator; |
3386 } | 3390 } |
3387 | 3391 |
3388 | 3392 |
3389 void HAllocate::UpdateFreeSpaceFiller(int32_t free_space_size) { | 3393 void HAllocate::UpdateFreeSpaceFiller(int32_t free_space_size) { |
3390 ASSERT(filler_free_space_size_ != NULL); | 3394 ASSERT(filler_free_space_size_ != NULL); |
3391 Zone* zone = block()->zone(); | 3395 Zone* zone = block()->zone(); |
| 3396 // We must explicitly force Smi representation here because on x64 we |
| 3397 // would otherwise automatically choose int32, but the actual store |
| 3398 // requires a Smi-tagged value. |
3392 HConstant* new_free_space_size = HConstant::CreateAndInsertBefore( | 3399 HConstant* new_free_space_size = HConstant::CreateAndInsertBefore( |
3393 zone, | 3400 zone, |
3394 context(), | 3401 context(), |
3395 filler_free_space_size_->value()->GetInteger32Constant() + | 3402 filler_free_space_size_->value()->GetInteger32Constant() + |
3396 free_space_size, | 3403 free_space_size, |
| 3404 Representation::Smi(), |
3397 filler_free_space_size_); | 3405 filler_free_space_size_); |
3398 filler_free_space_size_->UpdateValue(new_free_space_size); | 3406 filler_free_space_size_->UpdateValue(new_free_space_size); |
3399 } | 3407 } |
3400 | 3408 |
3401 | 3409 |
3402 void HAllocate::CreateFreeSpaceFiller(int32_t free_space_size) { | 3410 void HAllocate::CreateFreeSpaceFiller(int32_t free_space_size) { |
3403 ASSERT(filler_free_space_size_ == NULL); | 3411 ASSERT(filler_free_space_size_ == NULL); |
3404 Zone* zone = block()->zone(); | 3412 Zone* zone = block()->zone(); |
3405 int32_t dominator_size = | 3413 int32_t dominator_size = |
3406 HConstant::cast(dominating_allocate_->size())->GetInteger32Constant(); | 3414 HConstant::cast(dominating_allocate_->size())->GetInteger32Constant(); |
3407 HInstruction* free_space_instr = | 3415 HInstruction* free_space_instr = |
3408 HInnerAllocatedObject::New(zone, context(), dominating_allocate_, | 3416 HInnerAllocatedObject::New(zone, context(), dominating_allocate_, |
3409 dominator_size, type()); | 3417 dominator_size, type()); |
3410 free_space_instr->InsertBefore(this); | 3418 free_space_instr->InsertBefore(this); |
3411 HConstant* filler_map = HConstant::New( | 3419 HConstant* filler_map = HConstant::New( |
3412 zone, | 3420 zone, |
3413 context(), | 3421 context(), |
3414 isolate()->factory()->free_space_map(), | 3422 isolate()->factory()->free_space_map(), |
3415 UniqueValueId(isolate()->heap()->free_space_map())); | 3423 UniqueValueId(isolate()->heap()->free_space_map())); |
3416 filler_map->InsertAfter(free_space_instr); | 3424 filler_map->InsertAfter(free_space_instr); |
3417 HInstruction* store_map = HStoreNamedField::New(zone, context(), | 3425 HInstruction* store_map = HStoreNamedField::New(zone, context(), |
3418 free_space_instr, HObjectAccess::ForMap(), filler_map); | 3426 free_space_instr, HObjectAccess::ForMap(), filler_map); |
3419 store_map->SetFlag(HValue::kHasNoObservableSideEffects); | 3427 store_map->SetFlag(HValue::kHasNoObservableSideEffects); |
3420 store_map->InsertAfter(filler_map); | 3428 store_map->InsertAfter(filler_map); |
3421 | 3429 |
| 3430 // We must explicitly force Smi representation here because on x64 we |
| 3431 // would otherwise automatically choose int32, but the actual store |
| 3432 // requires a Smi-tagged value. |
3422 HConstant* filler_size = HConstant::CreateAndInsertAfter( | 3433 HConstant* filler_size = HConstant::CreateAndInsertAfter( |
3423 zone, context(), free_space_size, store_map); | 3434 zone, context(), free_space_size, Representation::Smi(), store_map); |
| 3435 // Must force Smi representation for x64 (see comment above). |
3424 HObjectAccess access = | 3436 HObjectAccess access = |
3425 HObjectAccess::ForJSObjectOffset(FreeSpace::kSizeOffset); | 3437 HObjectAccess::ForJSObjectOffset(FreeSpace::kSizeOffset, |
| 3438 Representation::Smi()); |
3426 HStoreNamedField* store_size = HStoreNamedField::New(zone, context(), | 3439 HStoreNamedField* store_size = HStoreNamedField::New(zone, context(), |
3427 free_space_instr, access, filler_size); | 3440 free_space_instr, access, filler_size); |
3428 store_size->SetFlag(HValue::kHasNoObservableSideEffects); | 3441 store_size->SetFlag(HValue::kHasNoObservableSideEffects); |
3429 store_size->InsertAfter(filler_size); | 3442 store_size->InsertAfter(filler_size); |
3430 filler_free_space_size_ = store_size; | 3443 filler_free_space_size_ = store_size; |
3431 } | 3444 } |
3432 | 3445 |
3433 | 3446 |
3434 void HAllocate::PrintDataTo(StringStream* stream) { | 3447 void HAllocate::PrintDataTo(StringStream* stream) { |
3435 size()->PrintNameTo(stream); | 3448 size()->PrintNameTo(stream); |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4165 break; | 4178 break; |
4166 case kExternalMemory: | 4179 case kExternalMemory: |
4167 stream->Add("[external-memory]"); | 4180 stream->Add("[external-memory]"); |
4168 break; | 4181 break; |
4169 } | 4182 } |
4170 | 4183 |
4171 stream->Add("@%d", offset()); | 4184 stream->Add("@%d", offset()); |
4172 } | 4185 } |
4173 | 4186 |
4174 } } // namespace v8::internal | 4187 } } // namespace v8::internal |
OLD | NEW |