Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: src/crankshaft/hydrogen-instructions.h

Issue 1899813003: [crankshaft] Fragmentation-free allocation folding. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/crankshaft/hydrogen-instructions.cc » ('j') | src/heap/spaces.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ 5 #ifndef V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_
6 #define V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ 6 #define V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_
7 7
8 #include <cstring> 8 #include <cstring>
9 #include <iosfwd> 9 #include <iosfwd>
10 10
(...skipping 4987 matching lines...) Expand 10 before | Expand all | Expand 10 after
4998 } 4998 }
4999 4999
5000 bool MustPrefillWithFiller() const { 5000 bool MustPrefillWithFiller() const {
5001 return (flags_ & PREFILL_WITH_FILLER) != 0; 5001 return (flags_ & PREFILL_WITH_FILLER) != 0;
5002 } 5002 }
5003 5003
5004 void MakePrefillWithFiller() { 5004 void MakePrefillWithFiller() {
5005 flags_ = static_cast<HAllocate::Flags>(flags_ | PREFILL_WITH_FILLER); 5005 flags_ = static_cast<HAllocate::Flags>(flags_ | PREFILL_WITH_FILLER);
5006 } 5006 }
5007 5007
5008 bool MustClearNextMapWord() const {
5009 return (flags_ & CLEAR_NEXT_MAP_WORD) != 0;
5010 }
5011
5012 void MakeDoubleAligned() { 5008 void MakeDoubleAligned() {
5013 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); 5009 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED);
5014 } 5010 }
5015 5011
5012 void MakeAllocationFoldingDominator() {
5013 flags_ =
5014 static_cast<HAllocate::Flags>(flags_ | ALLOCATION_FOLDING_DOMINATOR);
5015 }
5016
5017 bool IsAllocationFoldingDominator() {
5018 return (flags_ & ALLOCATION_FOLDING_DOMINATOR) != 0;
5019 }
5020
5021 void MakeAllocationFoldingDominated() {
5022 flags_ =
5023 static_cast<HAllocate::Flags>(flags_ | ALLOCATION_FOLDING_DOMINATED);
5024 ClearFlag(kTrackSideEffectDominators);
5025 ClearChangesFlag(kNewSpacePromotion);
5026 }
5027
5028 bool IsAllocationFoldingDominated() {
5029 return (flags_ & ALLOCATION_FOLDING_DOMINATED) != 0;
5030 }
5031
5016 bool HandleSideEffectDominator(GVNFlag side_effect, 5032 bool HandleSideEffectDominator(GVNFlag side_effect,
5017 HValue* dominator) override; 5033 HValue* dominator) override;
5018 5034
5019 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT 5035 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT
5020 5036
5021 DECLARE_CONCRETE_INSTRUCTION(Allocate) 5037 DECLARE_CONCRETE_INSTRUCTION(Allocate)
5022 5038
5023 private: 5039 private:
5024 enum Flags { 5040 enum Flags {
5025 ALLOCATE_IN_NEW_SPACE = 1 << 0, 5041 ALLOCATE_IN_NEW_SPACE = 1 << 0,
5026 ALLOCATE_IN_OLD_SPACE = 1 << 2, 5042 ALLOCATE_IN_OLD_SPACE = 1 << 2,
5027 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, 5043 ALLOCATE_DOUBLE_ALIGNED = 1 << 3,
5028 PREFILL_WITH_FILLER = 1 << 4, 5044 PREFILL_WITH_FILLER = 1 << 4,
5029 CLEAR_NEXT_MAP_WORD = 1 << 5 5045 ALLOCATION_FOLDING_DOMINATOR = 1 << 5,
5046 ALLOCATION_FOLDING_DOMINATED = 1 << 6
Benedikt Meurer 2016/04/19 07:25:38 Is there a better name than "dominated"?
Hannes Payer (out of office) 2016/04/19 11:03:56 Changed to ALLOCATION_FOLDED. Done.
5030 }; 5047 };
5031 5048
5032 HAllocate(HValue* context, 5049 HAllocate(HValue* context,
5033 HValue* size, 5050 HValue* size,
5034 HType type, 5051 HType type,
5035 PretenureFlag pretenure_flag, 5052 PretenureFlag pretenure_flag,
5036 InstanceType instance_type, 5053 InstanceType instance_type,
5037 Handle<AllocationSite> allocation_site = 5054 Handle<AllocationSite> allocation_site =
5038 Handle<AllocationSite>::null()) 5055 Handle<AllocationSite>::null())
5039 : HTemplateInstruction<2>(type), 5056 : HTemplateInstruction<2>(type),
(...skipping 25 matching lines...) Expand all
5065 flags = static_cast<Flags>(flags | ALLOCATE_DOUBLE_ALIGNED); 5082 flags = static_cast<Flags>(flags | ALLOCATE_DOUBLE_ALIGNED);
5066 } 5083 }
5067 // We have to fill the allocated object with one word fillers if we do 5084 // We have to fill the allocated object with one word fillers if we do
5068 // not use allocation folding since some allocations may depend on each 5085 // not use allocation folding since some allocations may depend on each
5069 // other, i.e., have a pointer to each other. A GC in between these 5086 // other, i.e., have a pointer to each other. A GC in between these
5070 // allocations may leave such objects behind in a not completely initialized 5087 // allocations may leave such objects behind in a not completely initialized
5071 // state. 5088 // state.
5072 if (!FLAG_use_gvn || !FLAG_use_allocation_folding) { 5089 if (!FLAG_use_gvn || !FLAG_use_allocation_folding) {
5073 flags = static_cast<Flags>(flags | PREFILL_WITH_FILLER); 5090 flags = static_cast<Flags>(flags | PREFILL_WITH_FILLER);
5074 } 5091 }
5075 if (pretenure_flag == NOT_TENURED &&
5076 AllocationSite::CanTrack(instance_type)) {
5077 flags = static_cast<Flags>(flags | CLEAR_NEXT_MAP_WORD);
5078 }
5079 return flags; 5092 return flags;
5080 } 5093 }
5081 5094
5082 void UpdateClearNextMapWord(bool clear_next_map_word) {
5083 flags_ = static_cast<Flags>(clear_next_map_word
5084 ? flags_ | CLEAR_NEXT_MAP_WORD
5085 : flags_ & ~CLEAR_NEXT_MAP_WORD);
5086 }
5087
5088 void UpdateSize(HValue* size) { 5095 void UpdateSize(HValue* size) {
5089 SetOperandAt(1, size); 5096 SetOperandAt(1, size);
5090 if (size->IsInteger32Constant()) { 5097 if (size->IsInteger32Constant()) {
5091 size_upper_bound_ = HConstant::cast(size); 5098 size_upper_bound_ = HConstant::cast(size);
5092 } else { 5099 } else {
5093 size_upper_bound_ = NULL; 5100 size_upper_bound_ = NULL;
5094 } 5101 }
5095 } 5102 }
5096 5103
5097 HAllocate* GetFoldableDominator(HAllocate* dominator); 5104 HAllocate* GetFoldableDominator(HAllocate* dominator);
5098 5105
5099 void UpdateFreeSpaceFiller(int32_t filler_size);
5100
5101 void CreateFreeSpaceFiller(int32_t filler_size);
5102
5103 bool IsFoldable(HAllocate* allocate) { 5106 bool IsFoldable(HAllocate* allocate) {
5104 return (IsNewSpaceAllocation() && allocate->IsNewSpaceAllocation()) || 5107 return (IsNewSpaceAllocation() && allocate->IsNewSpaceAllocation()) ||
5105 (IsOldSpaceAllocation() && allocate->IsOldSpaceAllocation()); 5108 (IsOldSpaceAllocation() && allocate->IsOldSpaceAllocation());
5106 } 5109 }
5107 5110
5108 void ClearNextMapWord(int offset);
5109
5110 Flags flags_; 5111 Flags flags_;
5111 Handle<Map> known_initial_map_; 5112 Handle<Map> known_initial_map_;
5112 HAllocate* dominating_allocate_; 5113 HAllocate* dominating_allocate_;
5113 HStoreNamedField* filler_free_space_size_; 5114 HStoreNamedField* filler_free_space_size_;
5114 HConstant* size_upper_bound_; 5115 HConstant* size_upper_bound_;
5115 }; 5116 };
5116 5117
5117 5118
5118 class HStoreCodeEntry final : public HTemplateInstruction<2> { 5119 class HStoreCodeEntry final : public HTemplateInstruction<2> {
5119 public: 5120 public:
(...skipping 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after
7242 bool IsDeletable() const override { return true; } 7243 bool IsDeletable() const override { return true; }
7243 }; 7244 };
7244 7245
7245 #undef DECLARE_INSTRUCTION 7246 #undef DECLARE_INSTRUCTION
7246 #undef DECLARE_CONCRETE_INSTRUCTION 7247 #undef DECLARE_CONCRETE_INSTRUCTION
7247 7248
7248 } // namespace internal 7249 } // namespace internal
7249 } // namespace v8 7250 } // namespace v8
7250 7251
7251 #endif // V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_ 7252 #endif // V8_CRANKSHAFT_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « no previous file | src/crankshaft/hydrogen-instructions.cc » ('j') | src/heap/spaces.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698