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 3198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3209 HConstant::cast(dominator_size)->GetInteger32Constant(); | 3209 HConstant::cast(dominator_size)->GetInteger32Constant(); |
3210 int32_t current_size_constant = | 3210 int32_t current_size_constant = |
3211 HConstant::cast(current_size)->GetInteger32Constant(); | 3211 HConstant::cast(current_size)->GetInteger32Constant(); |
3212 HBasicBlock* block = dominator->block(); | 3212 HBasicBlock* block = dominator->block(); |
3213 Zone* zone = block->zone(); | 3213 Zone* zone = block->zone(); |
3214 HInstruction* new_dominator_size = new(zone) HConstant( | 3214 HInstruction* new_dominator_size = new(zone) HConstant( |
3215 dominator_size_constant + current_size_constant); | 3215 dominator_size_constant + current_size_constant); |
3216 new_dominator_size->InsertBefore(dominator_allocate_instr); | 3216 new_dominator_size->InsertBefore(dominator_allocate_instr); |
3217 dominator_allocate_instr->UpdateSize(new_dominator_size); | 3217 dominator_allocate_instr->UpdateSize(new_dominator_size); |
3218 | 3218 |
| 3219 #ifdef VERIFY_HEAP |
| 3220 HInstruction* free_space_instr = |
| 3221 new(zone) HInnerAllocatedObject(dominator_allocate_instr, |
| 3222 dominator_size_constant, |
| 3223 type()); |
| 3224 free_space_instr->InsertAfter(dominator_allocate_instr); |
| 3225 HConstant* filler_map = new(zone) HConstant( |
| 3226 isolate()->factory()->free_space_map(), |
| 3227 UniqueValueId(isolate()->heap()->free_space_map()), |
| 3228 Representation::Tagged(), |
| 3229 HType::Tagged(), |
| 3230 false, |
| 3231 true, |
| 3232 false, |
| 3233 false); |
| 3234 filler_map->InsertAfter(free_space_instr); |
| 3235 |
| 3236 HInstruction* store_map = new(zone) HStoreNamedField( |
| 3237 free_space_instr, HObjectAccess::ForMap(), filler_map); |
| 3238 store_map->SetFlag(HValue::kHasNoObservableSideEffects); |
| 3239 store_map->InsertAfter(filler_map); |
| 3240 |
| 3241 HInstruction* free_space_size = new(zone) HConstant(current_size_constant); |
| 3242 free_space_size->InsertAfter(store_map); |
| 3243 HObjectAccess access = |
| 3244 HObjectAccess::ForJSObjectOffset(FreeSpace::kSizeOffset); |
| 3245 HInstruction* store_size = new(zone) HStoreNamedField( |
| 3246 free_space_instr, access, free_space_size); |
| 3247 store_size->SetFlag(HValue::kHasNoObservableSideEffects); |
| 3248 store_size->InsertAfter(free_space_size); |
| 3249 #endif |
| 3250 |
3219 // After that replace the dominated allocate instruction. | 3251 // After that replace the dominated allocate instruction. |
3220 HInstruction* dominated_allocate_instr = | 3252 HInstruction* dominated_allocate_instr = |
3221 new(zone) HInnerAllocatedObject(dominator_allocate_instr, | 3253 new(zone) HInnerAllocatedObject(dominator_allocate_instr, |
3222 dominator_size_constant, | 3254 dominator_size_constant, |
3223 type()); | 3255 type()); |
3224 dominated_allocate_instr->InsertBefore(this); | 3256 dominated_allocate_instr->InsertBefore(this); |
3225 DeleteAndReplaceWith(dominated_allocate_instr); | 3257 DeleteAndReplaceWith(dominated_allocate_instr); |
3226 if (FLAG_trace_allocation_folding) { | 3258 if (FLAG_trace_allocation_folding) { |
3227 PrintF("#%d (%s) folded into #%d (%s)\n", | 3259 PrintF("#%d (%s) folded into #%d (%s)\n", |
3228 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); | 3260 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3942 case kBackingStore: | 3974 case kBackingStore: |
3943 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 3975 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
3944 stream->Add("[backing-store]"); | 3976 stream->Add("[backing-store]"); |
3945 break; | 3977 break; |
3946 } | 3978 } |
3947 | 3979 |
3948 stream->Add("@%d", offset()); | 3980 stream->Add("@%d", offset()); |
3949 } | 3981 } |
3950 | 3982 |
3951 } } // namespace v8::internal | 3983 } } // namespace v8::internal |
OLD | NEW |