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 5491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5502 } | 5502 } |
5503 | 5503 |
5504 void set_known_initial_map(Handle<Map> known_initial_map) { | 5504 void set_known_initial_map(Handle<Map> known_initial_map) { |
5505 known_initial_map_ = known_initial_map; | 5505 known_initial_map_ = known_initial_map; |
5506 } | 5506 } |
5507 | 5507 |
5508 bool IsNewSpaceAllocation() const { | 5508 bool IsNewSpaceAllocation() const { |
5509 return (flags_ & ALLOCATE_IN_NEW_SPACE) != 0; | 5509 return (flags_ & ALLOCATE_IN_NEW_SPACE) != 0; |
5510 } | 5510 } |
5511 | 5511 |
5512 bool IsOldDataSpaceAllocation() const { | 5512 bool IsOldSpaceAllocation() const { |
5513 return (flags_ & ALLOCATE_IN_OLD_DATA_SPACE) != 0; | 5513 return (flags_ & ALLOCATE_IN_OLD_SPACE) != 0; |
5514 } | |
5515 | |
5516 bool IsOldPointerSpaceAllocation() const { | |
5517 return (flags_ & ALLOCATE_IN_OLD_POINTER_SPACE) != 0; | |
5518 } | 5514 } |
5519 | 5515 |
5520 bool MustAllocateDoubleAligned() const { | 5516 bool MustAllocateDoubleAligned() const { |
5521 return (flags_ & ALLOCATE_DOUBLE_ALIGNED) != 0; | 5517 return (flags_ & ALLOCATE_DOUBLE_ALIGNED) != 0; |
5522 } | 5518 } |
5523 | 5519 |
5524 bool MustPrefillWithFiller() const { | 5520 bool MustPrefillWithFiller() const { |
5525 return (flags_ & PREFILL_WITH_FILLER) != 0; | 5521 return (flags_ & PREFILL_WITH_FILLER) != 0; |
5526 } | 5522 } |
5527 | 5523 |
(...skipping 12 matching lines...) Expand all Loading... |
5540 virtual bool HandleSideEffectDominator(GVNFlag side_effect, | 5536 virtual bool HandleSideEffectDominator(GVNFlag side_effect, |
5541 HValue* dominator) OVERRIDE; | 5537 HValue* dominator) OVERRIDE; |
5542 | 5538 |
5543 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5539 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT |
5544 | 5540 |
5545 DECLARE_CONCRETE_INSTRUCTION(Allocate) | 5541 DECLARE_CONCRETE_INSTRUCTION(Allocate) |
5546 | 5542 |
5547 private: | 5543 private: |
5548 enum Flags { | 5544 enum Flags { |
5549 ALLOCATE_IN_NEW_SPACE = 1 << 0, | 5545 ALLOCATE_IN_NEW_SPACE = 1 << 0, |
5550 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, | 5546 ALLOCATE_IN_OLD_SPACE = 1 << 2, |
5551 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, | |
5552 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, | 5547 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, |
5553 PREFILL_WITH_FILLER = 1 << 4, | 5548 PREFILL_WITH_FILLER = 1 << 4, |
5554 CLEAR_NEXT_MAP_WORD = 1 << 5 | 5549 CLEAR_NEXT_MAP_WORD = 1 << 5 |
5555 }; | 5550 }; |
5556 | 5551 |
5557 HAllocate(HValue* context, | 5552 HAllocate(HValue* context, |
5558 HValue* size, | 5553 HValue* size, |
5559 HType type, | 5554 HType type, |
5560 PretenureFlag pretenure_flag, | 5555 PretenureFlag pretenure_flag, |
5561 InstanceType instance_type, | 5556 InstanceType instance_type, |
(...skipping 15 matching lines...) Expand all Loading... |
5577 PrintF("HAllocate with AllocationSite %p %s\n", | 5572 PrintF("HAllocate with AllocationSite %p %s\n", |
5578 allocation_site.is_null() | 5573 allocation_site.is_null() |
5579 ? static_cast<void*>(NULL) | 5574 ? static_cast<void*>(NULL) |
5580 : static_cast<void*>(*allocation_site), | 5575 : static_cast<void*>(*allocation_site), |
5581 pretenure_flag == TENURED ? "tenured" : "not tenured"); | 5576 pretenure_flag == TENURED ? "tenured" : "not tenured"); |
5582 } | 5577 } |
5583 } | 5578 } |
5584 | 5579 |
5585 static Flags ComputeFlags(PretenureFlag pretenure_flag, | 5580 static Flags ComputeFlags(PretenureFlag pretenure_flag, |
5586 InstanceType instance_type) { | 5581 InstanceType instance_type) { |
5587 Flags flags = pretenure_flag == TENURED | 5582 Flags flags = pretenure_flag == TENURED ? ALLOCATE_IN_OLD_SPACE |
5588 ? (Heap::TargetSpaceId(instance_type) == OLD_POINTER_SPACE | 5583 : ALLOCATE_IN_NEW_SPACE; |
5589 ? ALLOCATE_IN_OLD_POINTER_SPACE | |
5590 : ALLOCATE_IN_OLD_DATA_SPACE) | |
5591 : ALLOCATE_IN_NEW_SPACE; | |
5592 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { | 5584 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { |
5593 flags = static_cast<Flags>(flags | ALLOCATE_DOUBLE_ALIGNED); | 5585 flags = static_cast<Flags>(flags | ALLOCATE_DOUBLE_ALIGNED); |
5594 } | 5586 } |
5595 // We have to fill the allocated object with one word fillers if we do | 5587 // We have to fill the allocated object with one word fillers if we do |
5596 // not use allocation folding since some allocations may depend on each | 5588 // not use allocation folding since some allocations may depend on each |
5597 // other, i.e., have a pointer to each other. A GC in between these | 5589 // other, i.e., have a pointer to each other. A GC in between these |
5598 // allocations may leave such objects behind in a not completely initialized | 5590 // allocations may leave such objects behind in a not completely initialized |
5599 // state. | 5591 // state. |
5600 if (!FLAG_use_gvn || !FLAG_use_allocation_folding) { | 5592 if (!FLAG_use_gvn || !FLAG_use_allocation_folding) { |
5601 flags = static_cast<Flags>(flags | PREFILL_WITH_FILLER); | 5593 flags = static_cast<Flags>(flags | PREFILL_WITH_FILLER); |
(...skipping 21 matching lines...) Expand all Loading... |
5623 } | 5615 } |
5624 | 5616 |
5625 HAllocate* GetFoldableDominator(HAllocate* dominator); | 5617 HAllocate* GetFoldableDominator(HAllocate* dominator); |
5626 | 5618 |
5627 void UpdateFreeSpaceFiller(int32_t filler_size); | 5619 void UpdateFreeSpaceFiller(int32_t filler_size); |
5628 | 5620 |
5629 void CreateFreeSpaceFiller(int32_t filler_size); | 5621 void CreateFreeSpaceFiller(int32_t filler_size); |
5630 | 5622 |
5631 bool IsFoldable(HAllocate* allocate) { | 5623 bool IsFoldable(HAllocate* allocate) { |
5632 return (IsNewSpaceAllocation() && allocate->IsNewSpaceAllocation()) || | 5624 return (IsNewSpaceAllocation() && allocate->IsNewSpaceAllocation()) || |
5633 (IsOldDataSpaceAllocation() && | 5625 (IsOldSpaceAllocation() && allocate->IsOldSpaceAllocation()); |
5634 allocate->IsOldDataSpaceAllocation()) || | |
5635 (IsOldPointerSpaceAllocation() && | |
5636 allocate->IsOldPointerSpaceAllocation()); | |
5637 } | 5626 } |
5638 | 5627 |
5639 void ClearNextMapWord(int offset); | 5628 void ClearNextMapWord(int offset); |
5640 | 5629 |
5641 Flags flags_; | 5630 Flags flags_; |
5642 Handle<Map> known_initial_map_; | 5631 Handle<Map> known_initial_map_; |
5643 HAllocate* dominating_allocate_; | 5632 HAllocate* dominating_allocate_; |
5644 HStoreNamedField* filler_free_space_size_; | 5633 HStoreNamedField* filler_free_space_size_; |
5645 HConstant* size_upper_bound_; | 5634 HConstant* size_upper_bound_; |
5646 }; | 5635 }; |
(...skipping 2240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7887 }; | 7876 }; |
7888 | 7877 |
7889 | 7878 |
7890 | 7879 |
7891 #undef DECLARE_INSTRUCTION | 7880 #undef DECLARE_INSTRUCTION |
7892 #undef DECLARE_CONCRETE_INSTRUCTION | 7881 #undef DECLARE_CONCRETE_INSTRUCTION |
7893 | 7882 |
7894 } } // namespace v8::internal | 7883 } } // namespace v8::internal |
7895 | 7884 |
7896 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7885 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |