Index: src/hydrogen-instructions.h |
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
index 4dd24fd871552456a10bb77ab8f6a0e4b4b25138..0e9cf42382754fb5a7f24e9d7bc4a72169fff96c 100644 |
--- a/src/hydrogen-instructions.h |
+++ b/src/hydrogen-instructions.h |
@@ -5428,6 +5428,49 @@ class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> { |
class HAllocate V8_FINAL : public HTemplateInstruction<2> { |
public: |
+ enum Flags { |
+ ALLOCATE_IN_NEW_SPACE = 1 << 0, |
+ ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, |
+ ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, |
+ ALLOCATE_DOUBLE_ALIGNED = 1 << 3, |
+ PREFILL_WITH_FILLER = 1 << 4, |
+ CLEAR_NEXT_MAP_WORD = 1 << 5 |
+ }; |
+ |
+ static Flags ComputeFlags(PretenureFlag pretenure_flag, |
+ InstanceType instance_type) { |
+ Flags flags = pretenure_flag == TENURED |
+ ? (Heap::TargetSpaceId(instance_type) == OLD_POINTER_SPACE |
+ ? ALLOCATE_IN_OLD_POINTER_SPACE : ALLOCATE_IN_OLD_DATA_SPACE) |
+ : ALLOCATE_IN_NEW_SPACE; |
+ if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { |
+ flags = static_cast<Flags>(flags | ALLOCATE_DOUBLE_ALIGNED); |
+ } |
+ // We have to fill the allocated object with one word fillers if we do |
+ // not use allocation folding since some allocations may depend on each |
+ // other, i.e., have a pointer to each other. A GC in between these |
+ // allocations may leave such objects behind in a not completely initialized |
+ // state. |
+ if (!FLAG_use_gvn || !FLAG_use_allocation_folding) { |
+ flags = static_cast<Flags>(flags | PREFILL_WITH_FILLER); |
+ } |
+ if (pretenure_flag == NOT_TENURED && |
+ AllocationSite::CanTrack(instance_type)) { |
+ flags = static_cast<Flags>(flags | CLEAR_NEXT_MAP_WORD); |
+ } |
+ return flags; |
+ } |
+ |
+ static HAllocate* New(Zone* zone, |
+ HValue* context, |
+ HValue* size, |
+ HType type, |
+ Flags flags, |
+ Handle<AllocationSite> allocation_site = |
+ Handle<AllocationSite>::null()) { |
+ return new(zone) HAllocate(context, size, type, flags, allocation_site); |
+ } |
+ |
static HAllocate* New(Zone* zone, |
HValue* context, |
HValue* size, |
@@ -5436,8 +5479,8 @@ class HAllocate V8_FINAL : public HTemplateInstruction<2> { |
InstanceType instance_type, |
Handle<AllocationSite> allocation_site = |
Handle<AllocationSite>::null()) { |
- return new(zone) HAllocate(context, size, type, pretenure_flag, |
- instance_type, allocation_site); |
+ Flags flags = ComputeFlags(pretenure_flag, instance_type); |
+ return New(zone, context, size, type, flags, allocation_site); |
} |
// Maximum instance size for which allocations will be inlined. |
@@ -5486,6 +5529,10 @@ class HAllocate V8_FINAL : public HTemplateInstruction<2> { |
flags_ = static_cast<HAllocate::Flags>(flags_ | PREFILL_WITH_FILLER); |
} |
+ bool MustClearNextMapWord() const { |
+ return (flags_ & CLEAR_NEXT_MAP_WORD) != 0; |
+ } |
+ |
void MakeDoubleAligned() { |
flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); |
} |
@@ -5498,55 +5545,28 @@ class HAllocate V8_FINAL : public HTemplateInstruction<2> { |
DECLARE_CONCRETE_INSTRUCTION(Allocate) |
private: |
- enum Flags { |
- ALLOCATE_IN_NEW_SPACE = 1 << 0, |
- ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, |
- ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, |
- ALLOCATE_DOUBLE_ALIGNED = 1 << 3, |
- PREFILL_WITH_FILLER = 1 << 4 |
- }; |
- |
HAllocate(HValue* context, |
HValue* size, |
HType type, |
- PretenureFlag pretenure_flag, |
- InstanceType instance_type, |
- Handle<AllocationSite> allocation_site = |
- Handle<AllocationSite>::null()) |
+ Flags flags, |
+ Handle<AllocationSite> allocation_site) |
: HTemplateInstruction<2>(type), |
+ flags_(flags), |
dominating_allocate_(NULL), |
- filler_free_space_size_(NULL), |
- clear_next_map_word_(false) { |
+ filler_free_space_size_(NULL) { |
SetOperandAt(0, context); |
SetOperandAt(1, size); |
set_representation(Representation::Tagged()); |
SetFlag(kTrackSideEffectDominators); |
SetGVNFlag(kChangesNewSpacePromotion); |
SetGVNFlag(kDependsOnNewSpacePromotion); |
- flags_ = pretenure_flag == TENURED |
- ? (Heap::TargetSpaceId(instance_type) == OLD_POINTER_SPACE |
- ? ALLOCATE_IN_OLD_POINTER_SPACE : ALLOCATE_IN_OLD_DATA_SPACE) |
- : ALLOCATE_IN_NEW_SPACE; |
- if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { |
- flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); |
- } |
- // We have to fill the allocated object with one word fillers if we do |
- // not use allocation folding since some allocations may depend on each |
- // other, i.e., have a pointer to each other. A GC in between these |
- // allocations may leave such objects behind in a not completely initialized |
- // state. |
- if (!FLAG_use_gvn || !FLAG_use_allocation_folding) { |
- flags_ = static_cast<HAllocate::Flags>(flags_ | PREFILL_WITH_FILLER); |
- } |
- clear_next_map_word_ = pretenure_flag == NOT_TENURED && |
- AllocationSite::CanTrack(instance_type); |
if (FLAG_trace_pretenuring) { |
PrintF("HAllocate with AllocationSite %p %s\n", |
allocation_site.is_null() |
? static_cast<void*>(NULL) |
: static_cast<void*>(*allocation_site), |
- pretenure_flag == TENURED ? "tenured" : "not tenured"); |
+ IsNewSpaceAllocation() ? "not tenured" : "tenured"); |
} |
} |
@@ -5573,7 +5593,6 @@ class HAllocate V8_FINAL : public HTemplateInstruction<2> { |
Handle<Map> known_initial_map_; |
HAllocate* dominating_allocate_; |
HStoreNamedField* filler_free_space_size_; |
- bool clear_next_map_word_; |
}; |