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 5421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5432 }; | 5432 }; |
5433 | 5433 |
5434 | 5434 |
5435 class HAllocate V8_FINAL : public HTemplateInstruction<2> { | 5435 class HAllocate V8_FINAL : public HTemplateInstruction<2> { |
5436 public: | 5436 public: |
5437 static HAllocate* New(Zone* zone, | 5437 static HAllocate* New(Zone* zone, |
5438 HValue* context, | 5438 HValue* context, |
5439 HValue* size, | 5439 HValue* size, |
5440 HType type, | 5440 HType type, |
5441 PretenureFlag pretenure_flag, | 5441 PretenureFlag pretenure_flag, |
5442 InstanceType instance_type) { | 5442 InstanceType instance_type, |
| 5443 Handle<AllocationSite> allocation_site = |
| 5444 Handle<AllocationSite>::null()) { |
5443 return new(zone) HAllocate(context, size, type, pretenure_flag, | 5445 return new(zone) HAllocate(context, size, type, pretenure_flag, |
5444 instance_type); | 5446 instance_type, allocation_site); |
5445 } | 5447 } |
5446 | 5448 |
5447 // Maximum instance size for which allocations will be inlined. | 5449 // Maximum instance size for which allocations will be inlined. |
5448 static const int kMaxInlineSize = 64 * kPointerSize; | 5450 static const int kMaxInlineSize = 64 * kPointerSize; |
5449 | 5451 |
5450 HValue* context() { return OperandAt(0); } | 5452 HValue* context() { return OperandAt(0); } |
5451 HValue* size() { return OperandAt(1); } | 5453 HValue* size() { return OperandAt(1); } |
5452 | 5454 |
5453 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5455 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
5454 if (index == 0) { | 5456 if (index == 0) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5507 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, | 5509 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, |
5508 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, | 5510 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, |
5509 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, | 5511 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, |
5510 PREFILL_WITH_FILLER = 1 << 4 | 5512 PREFILL_WITH_FILLER = 1 << 4 |
5511 }; | 5513 }; |
5512 | 5514 |
5513 HAllocate(HValue* context, | 5515 HAllocate(HValue* context, |
5514 HValue* size, | 5516 HValue* size, |
5515 HType type, | 5517 HType type, |
5516 PretenureFlag pretenure_flag, | 5518 PretenureFlag pretenure_flag, |
5517 InstanceType instance_type) | 5519 InstanceType instance_type, |
| 5520 Handle<AllocationSite> allocation_site = |
| 5521 Handle<AllocationSite>::null()) |
5518 : HTemplateInstruction<2>(type), | 5522 : HTemplateInstruction<2>(type), |
5519 dominating_allocate_(NULL), | 5523 dominating_allocate_(NULL), |
5520 filler_free_space_size_(NULL), | 5524 filler_free_space_size_(NULL), |
5521 clear_next_map_word_(false) { | 5525 clear_next_map_word_(false) { |
5522 SetOperandAt(0, context); | 5526 SetOperandAt(0, context); |
5523 SetOperandAt(1, size); | 5527 SetOperandAt(1, size); |
5524 set_representation(Representation::Tagged()); | 5528 set_representation(Representation::Tagged()); |
5525 SetFlag(kTrackSideEffectDominators); | 5529 SetFlag(kTrackSideEffectDominators); |
5526 SetGVNFlag(kChangesNewSpacePromotion); | 5530 SetGVNFlag(kChangesNewSpacePromotion); |
5527 SetGVNFlag(kDependsOnNewSpacePromotion); | 5531 SetGVNFlag(kDependsOnNewSpacePromotion); |
5528 flags_ = pretenure_flag == TENURED | 5532 flags_ = pretenure_flag == TENURED |
5529 ? (Heap::TargetSpaceId(instance_type) == OLD_POINTER_SPACE | 5533 ? (Heap::TargetSpaceId(instance_type) == OLD_POINTER_SPACE |
5530 ? ALLOCATE_IN_OLD_POINTER_SPACE : ALLOCATE_IN_OLD_DATA_SPACE) | 5534 ? ALLOCATE_IN_OLD_POINTER_SPACE : ALLOCATE_IN_OLD_DATA_SPACE) |
5531 : ALLOCATE_IN_NEW_SPACE; | 5535 : ALLOCATE_IN_NEW_SPACE; |
5532 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { | 5536 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { |
5533 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); | 5537 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); |
5534 } | 5538 } |
5535 // We have to fill the allocated object with one word fillers if we do | 5539 // We have to fill the allocated object with one word fillers if we do |
5536 // not use allocation folding since some allocations may depend on each | 5540 // not use allocation folding since some allocations may depend on each |
5537 // other, i.e., have a pointer to each other. A GC in between these | 5541 // other, i.e., have a pointer to each other. A GC in between these |
5538 // allocations may leave such objects behind in a not completely initialized | 5542 // allocations may leave such objects behind in a not completely initialized |
5539 // state. | 5543 // state. |
5540 if (!FLAG_use_gvn || !FLAG_use_allocation_folding) { | 5544 if (!FLAG_use_gvn || !FLAG_use_allocation_folding) { |
5541 flags_ = static_cast<HAllocate::Flags>(flags_ | PREFILL_WITH_FILLER); | 5545 flags_ = static_cast<HAllocate::Flags>(flags_ | PREFILL_WITH_FILLER); |
5542 } | 5546 } |
5543 clear_next_map_word_ = pretenure_flag == NOT_TENURED && | 5547 clear_next_map_word_ = pretenure_flag == NOT_TENURED && |
5544 AllocationSite::CanTrack(instance_type); | 5548 AllocationSite::CanTrack(instance_type); |
| 5549 |
| 5550 if (FLAG_trace_pretenuring) { |
| 5551 PrintF("HAllocate with AllocationSite %p %s\n", |
| 5552 allocation_site.is_null() |
| 5553 ? static_cast<void*>(NULL) |
| 5554 : static_cast<void*>(*allocation_site), |
| 5555 pretenure_flag == TENURED ? "tenured" : "not tenured"); |
| 5556 } |
5545 } | 5557 } |
5546 | 5558 |
5547 void UpdateSize(HValue* size) { | 5559 void UpdateSize(HValue* size) { |
5548 SetOperandAt(1, size); | 5560 SetOperandAt(1, size); |
5549 } | 5561 } |
5550 | 5562 |
5551 HAllocate* GetFoldableDominator(HAllocate* dominator); | 5563 HAllocate* GetFoldableDominator(HAllocate* dominator); |
5552 | 5564 |
5553 void UpdateFreeSpaceFiller(int32_t filler_size); | 5565 void UpdateFreeSpaceFiller(int32_t filler_size); |
5554 | 5566 |
(...skipping 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7473 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7485 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7474 }; | 7486 }; |
7475 | 7487 |
7476 | 7488 |
7477 #undef DECLARE_INSTRUCTION | 7489 #undef DECLARE_INSTRUCTION |
7478 #undef DECLARE_CONCRETE_INSTRUCTION | 7490 #undef DECLARE_CONCRETE_INSTRUCTION |
7479 | 7491 |
7480 } } // namespace v8::internal | 7492 } } // namespace v8::internal |
7481 | 7493 |
7482 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7494 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |