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 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 virtual int operand_position(int index) const V8_OVERRIDE { | 1226 virtual int operand_position(int index) const V8_OVERRIDE { |
1227 const int pos = position_.operand_position(index); | 1227 const int pos = position_.operand_position(index); |
1228 return (pos != RelocInfo::kNoPosition) ? pos : position(); | 1228 return (pos != RelocInfo::kNoPosition) ? pos : position(); |
1229 } | 1229 } |
1230 void set_operand_position(Zone* zone, int index, int pos) { | 1230 void set_operand_position(Zone* zone, int index, int pos) { |
1231 ASSERT(0 <= index && index < OperandCount()); | 1231 ASSERT(0 <= index && index < OperandCount()); |
1232 position_.ensure_storage_for_operand_positions(zone, OperandCount()); | 1232 position_.ensure_storage_for_operand_positions(zone, OperandCount()); |
1233 position_.set_operand_position(index, pos); | 1233 position_.set_operand_position(index, pos); |
1234 } | 1234 } |
1235 | 1235 |
| 1236 bool Dominates(HInstruction* other); |
| 1237 |
1236 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } | 1238 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } |
1237 | 1239 |
1238 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; | 1240 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; |
1239 | 1241 |
1240 #ifdef DEBUG | 1242 #ifdef DEBUG |
1241 virtual void Verify() V8_OVERRIDE; | 1243 virtual void Verify() V8_OVERRIDE; |
1242 #endif | 1244 #endif |
1243 | 1245 |
1244 virtual bool HasStackCheck() { return false; } | 1246 virtual bool HasStackCheck() { return false; } |
1245 | 1247 |
(...skipping 4201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5447 return new(zone) HAllocate(context, size, type, pretenure_flag, | 5449 return new(zone) HAllocate(context, size, type, pretenure_flag, |
5448 instance_type, allocation_site); | 5450 instance_type, allocation_site); |
5449 } | 5451 } |
5450 | 5452 |
5451 // Maximum instance size for which allocations will be inlined. | 5453 // Maximum instance size for which allocations will be inlined. |
5452 static const int kMaxInlineSize = 64 * kPointerSize; | 5454 static const int kMaxInlineSize = 64 * kPointerSize; |
5453 | 5455 |
5454 HValue* context() { return OperandAt(0); } | 5456 HValue* context() { return OperandAt(0); } |
5455 HValue* size() { return OperandAt(1); } | 5457 HValue* size() { return OperandAt(1); } |
5456 | 5458 |
| 5459 bool has_size_upper_bound() { return size_upper_bound_ != NULL; } |
| 5460 HConstant* size_upper_bound() { return size_upper_bound_; } |
| 5461 void set_size_upper_bound(HConstant* value) { |
| 5462 ASSERT(size_upper_bound_ == NULL); |
| 5463 size_upper_bound_ = value; |
| 5464 } |
| 5465 |
5457 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5466 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
5458 if (index == 0) { | 5467 if (index == 0) { |
5459 return Representation::Tagged(); | 5468 return Representation::Tagged(); |
5460 } else { | 5469 } else { |
5461 return Representation::Integer32(); | 5470 return Representation::Integer32(); |
5462 } | 5471 } |
5463 } | 5472 } |
5464 | 5473 |
5465 virtual Handle<Map> GetMonomorphicJSObjectMap() { | 5474 virtual Handle<Map> GetMonomorphicJSObjectMap() { |
5466 return known_initial_map_; | 5475 return known_initial_map_; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5522 HAllocate(HValue* context, | 5531 HAllocate(HValue* context, |
5523 HValue* size, | 5532 HValue* size, |
5524 HType type, | 5533 HType type, |
5525 PretenureFlag pretenure_flag, | 5534 PretenureFlag pretenure_flag, |
5526 InstanceType instance_type, | 5535 InstanceType instance_type, |
5527 Handle<AllocationSite> allocation_site = | 5536 Handle<AllocationSite> allocation_site = |
5528 Handle<AllocationSite>::null()) | 5537 Handle<AllocationSite>::null()) |
5529 : HTemplateInstruction<2>(type), | 5538 : HTemplateInstruction<2>(type), |
5530 flags_(ComputeFlags(pretenure_flag, instance_type)), | 5539 flags_(ComputeFlags(pretenure_flag, instance_type)), |
5531 dominating_allocate_(NULL), | 5540 dominating_allocate_(NULL), |
5532 filler_free_space_size_(NULL) { | 5541 filler_free_space_size_(NULL), |
| 5542 size_upper_bound_(NULL) { |
5533 SetOperandAt(0, context); | 5543 SetOperandAt(0, context); |
5534 SetOperandAt(1, size); | 5544 UpdateSize(size); |
5535 set_representation(Representation::Tagged()); | 5545 set_representation(Representation::Tagged()); |
5536 SetFlag(kTrackSideEffectDominators); | 5546 SetFlag(kTrackSideEffectDominators); |
5537 SetGVNFlag(kChangesNewSpacePromotion); | 5547 SetGVNFlag(kChangesNewSpacePromotion); |
5538 SetGVNFlag(kDependsOnNewSpacePromotion); | 5548 SetGVNFlag(kDependsOnNewSpacePromotion); |
5539 | 5549 |
5540 if (FLAG_trace_pretenuring) { | 5550 if (FLAG_trace_pretenuring) { |
5541 PrintF("HAllocate with AllocationSite %p %s\n", | 5551 PrintF("HAllocate with AllocationSite %p %s\n", |
5542 allocation_site.is_null() | 5552 allocation_site.is_null() |
5543 ? static_cast<void*>(NULL) | 5553 ? static_cast<void*>(NULL) |
5544 : static_cast<void*>(*allocation_site), | 5554 : static_cast<void*>(*allocation_site), |
(...skipping 26 matching lines...) Expand all Loading... |
5571 } | 5581 } |
5572 | 5582 |
5573 void UpdateClearNextMapWord(bool clear_next_map_word) { | 5583 void UpdateClearNextMapWord(bool clear_next_map_word) { |
5574 flags_ = static_cast<Flags>(clear_next_map_word | 5584 flags_ = static_cast<Flags>(clear_next_map_word |
5575 ? flags_ | CLEAR_NEXT_MAP_WORD | 5585 ? flags_ | CLEAR_NEXT_MAP_WORD |
5576 : flags_ & ~CLEAR_NEXT_MAP_WORD); | 5586 : flags_ & ~CLEAR_NEXT_MAP_WORD); |
5577 } | 5587 } |
5578 | 5588 |
5579 void UpdateSize(HValue* size) { | 5589 void UpdateSize(HValue* size) { |
5580 SetOperandAt(1, size); | 5590 SetOperandAt(1, size); |
| 5591 if (size->IsInteger32Constant()) { |
| 5592 size_upper_bound_ = HConstant::cast(size); |
| 5593 } else { |
| 5594 size_upper_bound_ = NULL; |
| 5595 } |
5581 } | 5596 } |
5582 | 5597 |
5583 HAllocate* GetFoldableDominator(HAllocate* dominator); | 5598 HAllocate* GetFoldableDominator(HAllocate* dominator); |
5584 | 5599 |
5585 void UpdateFreeSpaceFiller(int32_t filler_size); | 5600 void UpdateFreeSpaceFiller(int32_t filler_size); |
5586 | 5601 |
5587 void CreateFreeSpaceFiller(int32_t filler_size); | 5602 void CreateFreeSpaceFiller(int32_t filler_size); |
5588 | 5603 |
5589 bool IsFoldable(HAllocate* allocate) { | 5604 bool IsFoldable(HAllocate* allocate) { |
5590 return (IsNewSpaceAllocation() && allocate->IsNewSpaceAllocation()) || | 5605 return (IsNewSpaceAllocation() && allocate->IsNewSpaceAllocation()) || |
5591 (IsOldDataSpaceAllocation() && allocate->IsOldDataSpaceAllocation()) || | 5606 (IsOldDataSpaceAllocation() && allocate->IsOldDataSpaceAllocation()) || |
5592 (IsOldPointerSpaceAllocation() && | 5607 (IsOldPointerSpaceAllocation() && |
5593 allocate->IsOldPointerSpaceAllocation()); | 5608 allocate->IsOldPointerSpaceAllocation()); |
5594 } | 5609 } |
5595 | 5610 |
5596 void ClearNextMapWord(int offset); | 5611 void ClearNextMapWord(int offset); |
5597 | 5612 |
5598 Flags flags_; | 5613 Flags flags_; |
5599 Handle<Map> known_initial_map_; | 5614 Handle<Map> known_initial_map_; |
5600 HAllocate* dominating_allocate_; | 5615 HAllocate* dominating_allocate_; |
5601 HStoreNamedField* filler_free_space_size_; | 5616 HStoreNamedField* filler_free_space_size_; |
| 5617 HConstant* size_upper_bound_; |
5602 }; | 5618 }; |
5603 | 5619 |
5604 | 5620 |
5605 class HStoreCodeEntry V8_FINAL: public HTemplateInstruction<2> { | 5621 class HStoreCodeEntry V8_FINAL: public HTemplateInstruction<2> { |
5606 public: | 5622 public: |
5607 static HStoreCodeEntry* New(Zone* zone, | 5623 static HStoreCodeEntry* New(Zone* zone, |
5608 HValue* context, | 5624 HValue* context, |
5609 HValue* function, | 5625 HValue* function, |
5610 HValue* code) { | 5626 HValue* code) { |
5611 return new(zone) HStoreCodeEntry(function, code); | 5627 return new(zone) HStoreCodeEntry(function, code); |
(...skipping 1964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7576 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7592 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7577 }; | 7593 }; |
7578 | 7594 |
7579 | 7595 |
7580 #undef DECLARE_INSTRUCTION | 7596 #undef DECLARE_INSTRUCTION |
7581 #undef DECLARE_CONCRETE_INSTRUCTION | 7597 #undef DECLARE_CONCRETE_INSTRUCTION |
7582 | 7598 |
7583 } } // namespace v8::internal | 7599 } } // namespace v8::internal |
7584 | 7600 |
7585 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7601 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |