| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ | 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ |
| 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ | 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ |
| 7 | 7 |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 #include <iosfwd> | 9 #include <iosfwd> |
| 10 | 10 |
| (...skipping 5529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5540 } | 5540 } |
| 5541 | 5541 |
| 5542 void set_known_initial_map(Handle<Map> known_initial_map) { | 5542 void set_known_initial_map(Handle<Map> known_initial_map) { |
| 5543 known_initial_map_ = known_initial_map; | 5543 known_initial_map_ = known_initial_map; |
| 5544 } | 5544 } |
| 5545 | 5545 |
| 5546 bool IsNewSpaceAllocation() const { | 5546 bool IsNewSpaceAllocation() const { |
| 5547 return (flags_ & ALLOCATE_IN_NEW_SPACE) != 0; | 5547 return (flags_ & ALLOCATE_IN_NEW_SPACE) != 0; |
| 5548 } | 5548 } |
| 5549 | 5549 |
| 5550 bool IsOldDataSpaceAllocation() const { | 5550 bool IsOldSpaceAllocation() const { |
| 5551 return (flags_ & ALLOCATE_IN_OLD_DATA_SPACE) != 0; | 5551 return (flags_ & ALLOCATE_IN_OLD_SPACE) != 0; |
| 5552 } | |
| 5553 | |
| 5554 bool IsOldPointerSpaceAllocation() const { | |
| 5555 return (flags_ & ALLOCATE_IN_OLD_POINTER_SPACE) != 0; | |
| 5556 } | 5552 } |
| 5557 | 5553 |
| 5558 bool MustAllocateDoubleAligned() const { | 5554 bool MustAllocateDoubleAligned() const { |
| 5559 return (flags_ & ALLOCATE_DOUBLE_ALIGNED) != 0; | 5555 return (flags_ & ALLOCATE_DOUBLE_ALIGNED) != 0; |
| 5560 } | 5556 } |
| 5561 | 5557 |
| 5562 bool MustPrefillWithFiller() const { | 5558 bool MustPrefillWithFiller() const { |
| 5563 return (flags_ & PREFILL_WITH_FILLER) != 0; | 5559 return (flags_ & PREFILL_WITH_FILLER) != 0; |
| 5564 } | 5560 } |
| 5565 | 5561 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 5578 virtual bool HandleSideEffectDominator(GVNFlag side_effect, | 5574 virtual bool HandleSideEffectDominator(GVNFlag side_effect, |
| 5579 HValue* dominator) OVERRIDE; | 5575 HValue* dominator) OVERRIDE; |
| 5580 | 5576 |
| 5581 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5577 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
| 5582 | 5578 |
| 5583 DECLARE_CONCRETE_INSTRUCTION(Allocate) | 5579 DECLARE_CONCRETE_INSTRUCTION(Allocate) |
| 5584 | 5580 |
| 5585 private: | 5581 private: |
| 5586 enum Flags { | 5582 enum Flags { |
| 5587 ALLOCATE_IN_NEW_SPACE = 1 << 0, | 5583 ALLOCATE_IN_NEW_SPACE = 1 << 0, |
| 5588 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, | 5584 ALLOCATE_IN_OLD_SPACE = 1 << 2, |
| 5589 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, | |
| 5590 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, | 5585 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, |
| 5591 PREFILL_WITH_FILLER = 1 << 4, | 5586 PREFILL_WITH_FILLER = 1 << 4, |
| 5592 CLEAR_NEXT_MAP_WORD = 1 << 5 | 5587 CLEAR_NEXT_MAP_WORD = 1 << 5 |
| 5593 }; | 5588 }; |
| 5594 | 5589 |
| 5595 HAllocate(HValue* context, | 5590 HAllocate(HValue* context, |
| 5596 HValue* size, | 5591 HValue* size, |
| 5597 HType type, | 5592 HType type, |
| 5598 PretenureFlag pretenure_flag, | 5593 PretenureFlag pretenure_flag, |
| 5599 InstanceType instance_type, | 5594 InstanceType instance_type, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 5615 PrintF("HAllocate with AllocationSite %p %s\n", | 5610 PrintF("HAllocate with AllocationSite %p %s\n", |
| 5616 allocation_site.is_null() | 5611 allocation_site.is_null() |
| 5617 ? static_cast<void*>(NULL) | 5612 ? static_cast<void*>(NULL) |
| 5618 : static_cast<void*>(*allocation_site), | 5613 : static_cast<void*>(*allocation_site), |
| 5619 pretenure_flag == TENURED ? "tenured" : "not tenured"); | 5614 pretenure_flag == TENURED ? "tenured" : "not tenured"); |
| 5620 } | 5615 } |
| 5621 } | 5616 } |
| 5622 | 5617 |
| 5623 static Flags ComputeFlags(PretenureFlag pretenure_flag, | 5618 static Flags ComputeFlags(PretenureFlag pretenure_flag, |
| 5624 InstanceType instance_type) { | 5619 InstanceType instance_type) { |
| 5625 Flags flags = pretenure_flag == TENURED | 5620 Flags flags = pretenure_flag == TENURED ? ALLOCATE_IN_OLD_SPACE |
| 5626 ? (Heap::TargetSpaceId(instance_type) == OLD_POINTER_SPACE | 5621 : ALLOCATE_IN_NEW_SPACE; |
| 5627 ? ALLOCATE_IN_OLD_POINTER_SPACE : ALLOCATE_IN_OLD_DATA_SPACE) | |
| 5628 : ALLOCATE_IN_NEW_SPACE; | |
| 5629 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { | 5622 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { |
| 5630 flags = static_cast<Flags>(flags | ALLOCATE_DOUBLE_ALIGNED); | 5623 flags = static_cast<Flags>(flags | ALLOCATE_DOUBLE_ALIGNED); |
| 5631 } | 5624 } |
| 5632 // We have to fill the allocated object with one word fillers if we do | 5625 // We have to fill the allocated object with one word fillers if we do |
| 5633 // not use allocation folding since some allocations may depend on each | 5626 // not use allocation folding since some allocations may depend on each |
| 5634 // other, i.e., have a pointer to each other. A GC in between these | 5627 // other, i.e., have a pointer to each other. A GC in between these |
| 5635 // allocations may leave such objects behind in a not completely initialized | 5628 // allocations may leave such objects behind in a not completely initialized |
| 5636 // state. | 5629 // state. |
| 5637 if (!FLAG_use_gvn || !FLAG_use_allocation_folding) { | 5630 if (!FLAG_use_gvn || !FLAG_use_allocation_folding) { |
| 5638 flags = static_cast<Flags>(flags | PREFILL_WITH_FILLER); | 5631 flags = static_cast<Flags>(flags | PREFILL_WITH_FILLER); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 5660 } | 5653 } |
| 5661 | 5654 |
| 5662 HAllocate* GetFoldableDominator(HAllocate* dominator); | 5655 HAllocate* GetFoldableDominator(HAllocate* dominator); |
| 5663 | 5656 |
| 5664 void UpdateFreeSpaceFiller(int32_t filler_size); | 5657 void UpdateFreeSpaceFiller(int32_t filler_size); |
| 5665 | 5658 |
| 5666 void CreateFreeSpaceFiller(int32_t filler_size); | 5659 void CreateFreeSpaceFiller(int32_t filler_size); |
| 5667 | 5660 |
| 5668 bool IsFoldable(HAllocate* allocate) { | 5661 bool IsFoldable(HAllocate* allocate) { |
| 5669 return (IsNewSpaceAllocation() && allocate->IsNewSpaceAllocation()) || | 5662 return (IsNewSpaceAllocation() && allocate->IsNewSpaceAllocation()) || |
| 5670 (IsOldDataSpaceAllocation() && allocate->IsOldDataSpaceAllocation()) || | 5663 (IsOldSpaceAllocation() && allocate->IsOldSpaceAllocation()); |
| 5671 (IsOldPointerSpaceAllocation() && | |
| 5672 allocate->IsOldPointerSpaceAllocation()); | |
| 5673 } | 5664 } |
| 5674 | 5665 |
| 5675 void ClearNextMapWord(int offset); | 5666 void ClearNextMapWord(int offset); |
| 5676 | 5667 |
| 5677 Flags flags_; | 5668 Flags flags_; |
| 5678 Handle<Map> known_initial_map_; | 5669 Handle<Map> known_initial_map_; |
| 5679 HAllocate* dominating_allocate_; | 5670 HAllocate* dominating_allocate_; |
| 5680 HStoreNamedField* filler_free_space_size_; | 5671 HStoreNamedField* filler_free_space_size_; |
| 5681 HConstant* size_upper_bound_; | 5672 HConstant* size_upper_bound_; |
| 5682 }; | 5673 }; |
| (...skipping 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7973 }; | 7964 }; |
| 7974 | 7965 |
| 7975 | 7966 |
| 7976 | 7967 |
| 7977 #undef DECLARE_INSTRUCTION | 7968 #undef DECLARE_INSTRUCTION |
| 7978 #undef DECLARE_CONCRETE_INSTRUCTION | 7969 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7979 | 7970 |
| 7980 } } // namespace v8::internal | 7971 } } // namespace v8::internal |
| 7981 | 7972 |
| 7982 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7973 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |