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 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1647 case IS_INTERNALIZED_STRING: | 1647 case IS_INTERNALIZED_STRING: |
1648 *mask = kIsInternalizedMask; | 1648 *mask = kIsInternalizedMask; |
1649 *tag = kInternalizedTag; | 1649 *tag = kInternalizedTag; |
1650 return; | 1650 return; |
1651 default: | 1651 default: |
1652 UNREACHABLE(); | 1652 UNREACHABLE(); |
1653 } | 1653 } |
1654 } | 1654 } |
1655 | 1655 |
1656 | 1656 |
1657 void HCheckMaps::SetSideEffectDominator(GVNFlag side_effect, | 1657 void HCheckMaps::HandleSideEffectDominator(GVNFlag side_effect, |
1658 HValue* dominator) { | 1658 HValue* dominator) { |
Michael Starzinger
2013/07/08 12:44:06
nit: Indentation if off.
Hannes Payer (out of office)
2013/07/08 13:43:48
Done.
| |
1659 ASSERT(side_effect == kChangesMaps); | 1659 ASSERT(side_effect == kChangesMaps); |
1660 // TODO(mstarzinger): For now we specialize on HStoreNamedField, but once | 1660 // TODO(mstarzinger): For now we specialize on HStoreNamedField, but once |
1661 // type information is rich enough we should generalize this to any HType | 1661 // type information is rich enough we should generalize this to any HType |
1662 // for which the map is known. | 1662 // for which the map is known. |
1663 if (HasNoUses() && dominator->IsStoreNamedField()) { | 1663 if (HasNoUses() && dominator->IsStoreNamedField()) { |
1664 HStoreNamedField* store = HStoreNamedField::cast(dominator); | 1664 HStoreNamedField* store = HStoreNamedField::cast(dominator); |
1665 UniqueValueId map_unique_id = store->transition_unique_id(); | 1665 UniqueValueId map_unique_id = store->transition_unique_id(); |
1666 if (!map_unique_id.IsInitialized() || store->object() != value()) return; | 1666 if (!map_unique_id.IsInitialized() || store->object() != value()) return; |
1667 for (int i = 0; i < map_set()->length(); i++) { | 1667 for (int i = 0; i < map_set()->length(); i++) { |
1668 if (map_unique_id == map_unique_ids_.at(i)) { | 1668 if (map_unique_id == map_unique_ids_.at(i)) { |
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3033 } | 3033 } |
3034 return false; | 3034 return false; |
3035 } | 3035 } |
3036 | 3036 |
3037 | 3037 |
3038 void HLoadGlobalGeneric::PrintDataTo(StringStream* stream) { | 3038 void HLoadGlobalGeneric::PrintDataTo(StringStream* stream) { |
3039 stream->Add("%o ", *name()); | 3039 stream->Add("%o ", *name()); |
3040 } | 3040 } |
3041 | 3041 |
3042 | 3042 |
3043 HType HInnerAllocatedObject::CalculateInferredType() { | |
3044 return type_; | |
3045 } | |
3046 | |
3047 | |
3043 void HInnerAllocatedObject::PrintDataTo(StringStream* stream) { | 3048 void HInnerAllocatedObject::PrintDataTo(StringStream* stream) { |
3044 base_object()->PrintNameTo(stream); | 3049 base_object()->PrintNameTo(stream); |
3045 stream->Add(" offset %d", offset()); | 3050 stream->Add(" offset %d", offset()); |
3046 } | 3051 } |
3047 | 3052 |
3048 | 3053 |
3049 void HStoreGlobalCell::PrintDataTo(StringStream* stream) { | 3054 void HStoreGlobalCell::PrintDataTo(StringStream* stream) { |
3050 stream->Add("[%p] = ", *cell()); | 3055 stream->Add("[%p] = ", *cell()); |
3051 value()->PrintNameTo(stream); | 3056 value()->PrintNameTo(stream); |
3052 if (!details_.IsDontDelete()) stream->Add(" (deleteable)"); | 3057 if (!details_.IsDontDelete()) stream->Add(" (deleteable)"); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3190 HType HAllocateObject::CalculateInferredType() { | 3195 HType HAllocateObject::CalculateInferredType() { |
3191 return HType::JSObject(); | 3196 return HType::JSObject(); |
3192 } | 3197 } |
3193 | 3198 |
3194 | 3199 |
3195 HType HAllocate::CalculateInferredType() { | 3200 HType HAllocate::CalculateInferredType() { |
3196 return type_; | 3201 return type_; |
3197 } | 3202 } |
3198 | 3203 |
3199 | 3204 |
3205 void HAllocate::HandleSideEffectDominator(GVNFlag side_effect, | |
3206 HValue* dominator) { | |
Michael Starzinger
2013/07/08 12:44:06
nit: Indentation is off.
Hannes Payer (out of office)
2013/07/08 13:43:48
Done.
| |
3207 ASSERT(side_effect == kChangesNewSpacePromotion); | |
3208 if (FLAG_use_allocation_folding) { | |
titzer
2013/07/08 12:40:14
if (!FLAG_...) return;
if (!...) return;
Can remo
Michael Starzinger
2013/07/08 12:44:06
Can we do early returns here instead of indenting
Hannes Payer (out of office)
2013/07/08 13:43:48
Done.
| |
3209 if (dominator->IsAllocate()) { | |
3210 HAllocate* dominator_allocate_instr = HAllocate::cast(dominator); | |
3211 // We can just fold allocations that are guaranteed in new space. | |
3212 // TODO(hpayer): Support double aligned allocations. | |
3213 if (GuaranteedInNewSpace() && !MustAllocateDoubleAligned() && | |
3214 dominator_allocate_instr->GuaranteedInNewSpace() && | |
3215 !dominator_allocate_instr->MustAllocateDoubleAligned()) { | |
3216 HValue* dominator_size = dominator_allocate_instr->size(); | |
3217 HValue* current_size = size(); | |
3218 // TODO(hpayer): Add support for non-constant allocation in dominator. | |
3219 if (current_size->IsInteger32Constant() && | |
3220 dominator_size->IsInteger32Constant()) { | |
3221 // First update the size of the dominator allocate instruction. | |
3222 int32_t dominator_size_constant = | |
3223 HConstant::cast(dominator_size)->GetInteger32Constant(); | |
3224 int32_t current_size_constant = | |
3225 HConstant::cast(current_size)->GetInteger32Constant(); | |
3226 HBasicBlock* block = dominator->block(); | |
3227 Zone* zone = block->zone(); | |
3228 HInstruction* new_dominator_size = new(zone) HConstant( | |
3229 dominator_size_constant + current_size_constant); | |
3230 HInstruction* dominator_instr = HInstruction::cast(dominator); | |
titzer
2013/07/08 12:40:14
You already have dominator as dominator_allocate_i
Hannes Payer (out of office)
2013/07/08 13:43:48
Done.
| |
3231 new_dominator_size->InsertBefore(dominator_instr); | |
3232 dominator_allocate_instr->UpdateSize(new_dominator_size); | |
3233 | |
3234 // TODO(hpayer): Remove filler map but make sure new space is valid. | |
3235 HInstruction* free_space_instr = | |
3236 new(zone) HInnerAllocatedObject(dominator_instr, | |
3237 dominator_size_constant, | |
3238 type()); | |
3239 free_space_instr->InsertAfter(dominator_instr); | |
3240 HConstant* filler_map = block->graph()->GetConstantFreeSpaceMap(); | |
titzer
2013/07/08 12:40:14
Don't make this a global constant in the graph. Th
Michael Starzinger
2013/07/08 12:44:06
I don't think this is an issue as the HConstant wi
Hannes Payer (out of office)
2013/07/08 13:43:48
OK.
I am leaving this code since it will disappea
titzer
2013/07/08 13:49:38
Why? If it is not so important, then please do not
Michael Starzinger
2013/07/08 14:02:43
I kind of see Ben's point here. If it is possible
| |
3241 HInstruction* store_map = new(zone) HStoreNamedField( | |
3242 free_space_instr, HObjectAccess::ForMap(), filler_map, | |
3243 Representation::Tagged(), true); | |
3244 store_map->InsertAfter(free_space_instr); | |
3245 | |
3246 HInstruction* free_space_size = | |
3247 new(zone) HConstant(current_size_constant); | |
3248 free_space_size->InsertAfter(store_map); | |
3249 HObjectAccess access = | |
3250 HObjectAccess::ForJSObjectOffset(FreeSpace::kSizeOffset); | |
3251 HInstruction* store_size = new(zone) HStoreNamedField( | |
3252 free_space_instr, access, free_space_size, | |
3253 Representation::Tagged(), true); | |
3254 store_size->InsertAfter(free_space_size); | |
3255 | |
3256 // After that replace the dominated allocate instruction. | |
3257 HInstruction* dominated_allocate_instr = | |
3258 new(zone) HInnerAllocatedObject(dominator_instr, | |
3259 dominator_size_constant, | |
3260 type()); | |
3261 dominated_allocate_instr->InsertBefore(this); | |
3262 DeleteAndReplaceWith(dominated_allocate_instr); | |
3263 if (FLAG_trace_allocation_folding) { | |
3264 PrintF("#%d (%s) folded into #%d (%s)\n", | |
3265 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); | |
3266 } | |
3267 } | |
3268 } | |
3269 } | |
3270 } | |
3271 } | |
3272 | |
3273 | |
3200 void HAllocate::PrintDataTo(StringStream* stream) { | 3274 void HAllocate::PrintDataTo(StringStream* stream) { |
3201 size()->PrintNameTo(stream); | 3275 size()->PrintNameTo(stream); |
3202 if (!GuaranteedInNewSpace()) stream->Add(" (pretenure)"); | 3276 if (!GuaranteedInNewSpace()) stream->Add(" (pretenure)"); |
3203 } | 3277 } |
3204 | 3278 |
3205 | 3279 |
3206 HType HRegExpLiteral::CalculateInferredType() { | 3280 HType HRegExpLiteral::CalculateInferredType() { |
3207 return HType::JSObject(); | 3281 return HType::JSObject(); |
3208 } | 3282 } |
3209 | 3283 |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3916 case kBackingStore: | 3990 case kBackingStore: |
3917 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 3991 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
3918 stream->Add("[backing-store]"); | 3992 stream->Add("[backing-store]"); |
3919 break; | 3993 break; |
3920 } | 3994 } |
3921 | 3995 |
3922 stream->Add("@%d", offset()); | 3996 stream->Add("@%d", offset()); |
3923 } | 3997 } |
3924 | 3998 |
3925 } } // namespace v8::internal | 3999 } } // namespace v8::internal |
OLD | NEW |