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 5282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5293 | 5293 |
5294 class HAllocate V8_FINAL : public HTemplateInstruction<2> { | 5294 class HAllocate V8_FINAL : public HTemplateInstruction<2> { |
5295 public: | 5295 public: |
5296 static HAllocate* New(Zone* zone, | 5296 static HAllocate* New(Zone* zone, |
5297 HValue* context, | 5297 HValue* context, |
5298 HValue* size, | 5298 HValue* size, |
5299 HType type, | 5299 HType type, |
5300 PretenureFlag pretenure_flag, | 5300 PretenureFlag pretenure_flag, |
5301 InstanceType instance_type) { | 5301 InstanceType instance_type) { |
5302 return new(zone) HAllocate(context, size, type, pretenure_flag, | 5302 return new(zone) HAllocate(context, size, type, pretenure_flag, |
5303 instance_type, zone); | 5303 instance_type); |
5304 } | 5304 } |
5305 | 5305 |
5306 // Maximum instance size for which allocations will be inlined. | 5306 // Maximum instance size for which allocations will be inlined. |
5307 static const int kMaxInlineSize = 64 * kPointerSize; | 5307 static const int kMaxInlineSize = 64 * kPointerSize; |
5308 | 5308 |
5309 HValue* context() { return OperandAt(0); } | 5309 HValue* context() { return OperandAt(0); } |
5310 HValue* size() { return OperandAt(1); } | 5310 HValue* size() { return OperandAt(1); } |
5311 | 5311 |
5312 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5312 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
5313 if (index == 0) { | 5313 if (index == 0) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5366 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, | 5366 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, |
5367 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, | 5367 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, |
5368 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, | 5368 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, |
5369 PREFILL_WITH_FILLER = 1 << 4 | 5369 PREFILL_WITH_FILLER = 1 << 4 |
5370 }; | 5370 }; |
5371 | 5371 |
5372 HAllocate(HValue* context, | 5372 HAllocate(HValue* context, |
5373 HValue* size, | 5373 HValue* size, |
5374 HType type, | 5374 HType type, |
5375 PretenureFlag pretenure_flag, | 5375 PretenureFlag pretenure_flag, |
5376 InstanceType instance_type, | 5376 InstanceType instance_type) |
5377 Zone* zone) | |
5378 : HTemplateInstruction<2>(type), | 5377 : HTemplateInstruction<2>(type), |
5379 dominating_allocate_(NULL), | 5378 dominating_allocate_(NULL), |
5380 filler_free_space_size_(NULL), | 5379 filler_free_space_size_(NULL), |
5381 clear_next_map_word_(false) { | 5380 clear_next_map_word_(false) { |
5382 SetOperandAt(0, context); | 5381 SetOperandAt(0, context); |
5383 SetOperandAt(1, size); | 5382 SetOperandAt(1, size); |
5384 set_representation(Representation::Tagged()); | 5383 set_representation(Representation::Tagged()); |
5385 SetFlag(kTrackSideEffectDominators); | 5384 SetFlag(kTrackSideEffectDominators); |
5386 SetGVNFlag(kChangesNewSpacePromotion); | 5385 SetGVNFlag(kChangesNewSpacePromotion); |
5387 SetGVNFlag(kDependsOnNewSpacePromotion); | 5386 SetGVNFlag(kDependsOnNewSpacePromotion); |
5388 flags_ = pretenure_flag == TENURED | 5387 flags_ = pretenure_flag == TENURED |
5389 ? (Heap::TargetSpaceId(instance_type) == OLD_POINTER_SPACE | 5388 ? (Heap::TargetSpaceId(instance_type) == OLD_POINTER_SPACE |
5390 ? ALLOCATE_IN_OLD_POINTER_SPACE : ALLOCATE_IN_OLD_DATA_SPACE) | 5389 ? ALLOCATE_IN_OLD_POINTER_SPACE : ALLOCATE_IN_OLD_DATA_SPACE) |
5391 : ALLOCATE_IN_NEW_SPACE; | 5390 : ALLOCATE_IN_NEW_SPACE; |
5392 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { | 5391 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { |
5393 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); | 5392 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); |
5394 } | 5393 } |
5395 // We have to fill the allocated object with one word fillers if we do | 5394 // We have to fill the allocated object with one word fillers if we do |
5396 // not use allocation folding since some allocations may depend on each | 5395 // not use allocation folding since some allocations may depend on each |
5397 // other, i.e., have a pointer to each other. A GC in between these | 5396 // other, i.e., have a pointer to each other. A GC in between these |
5398 // allocations may leave such objects behind in a not completely initialized | 5397 // allocations may leave such objects behind in a not completely initialized |
5399 // state. | 5398 // state. |
5400 if (!FLAG_use_gvn || !FLAG_use_allocation_folding || | 5399 if (!FLAG_use_gvn || !FLAG_use_allocation_folding) { |
5401 zone->isolate()->heap_profiler()->is_tracking_allocations()) { | |
5402 flags_ = static_cast<HAllocate::Flags>(flags_ | PREFILL_WITH_FILLER); | 5400 flags_ = static_cast<HAllocate::Flags>(flags_ | PREFILL_WITH_FILLER); |
5403 } | 5401 } |
5404 clear_next_map_word_ = pretenure_flag == NOT_TENURED && | 5402 clear_next_map_word_ = pretenure_flag == NOT_TENURED && |
5405 AllocationSite::CanTrack(instance_type); | 5403 AllocationSite::CanTrack(instance_type); |
5406 } | 5404 } |
5407 | 5405 |
5408 void UpdateSize(HValue* size) { | 5406 void UpdateSize(HValue* size) { |
5409 SetOperandAt(1, size); | 5407 SetOperandAt(1, size); |
5410 } | 5408 } |
5411 | 5409 |
(...skipping 1803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7215 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7213 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7216 }; | 7214 }; |
7217 | 7215 |
7218 | 7216 |
7219 #undef DECLARE_INSTRUCTION | 7217 #undef DECLARE_INSTRUCTION |
7220 #undef DECLARE_CONCRETE_INSTRUCTION | 7218 #undef DECLARE_CONCRETE_INSTRUCTION |
7221 | 7219 |
7222 } } // namespace v8::internal | 7220 } } // namespace v8::internal |
7223 | 7221 |
7224 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7222 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |