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

Side by Side Diff: src/hydrogen-environment-liveness.h

Issue 17587008: Refactor Hydrogen environment liveness analysis into an HPhase. (Closed) Base URL: git@github.com:v8/v8.git@master
Patch Set: No need to allocate worklist and live bit vectors in zone Created 7 years, 5 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 | « src/hydrogen.cc ('k') | src/hydrogen-environment-liveness.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 25 matching lines...) Expand all
36 36
37 37
38 // Trims live ranges of environment slots by doing explicit liveness analysis. 38 // Trims live ranges of environment slots by doing explicit liveness analysis.
39 // Values in the environment are kept alive by every subsequent LInstruction 39 // Values in the environment are kept alive by every subsequent LInstruction
40 // that is assigned an LEnvironment, which creates register pressure and 40 // that is assigned an LEnvironment, which creates register pressure and
41 // unnecessary spill slot moves. Therefore it is beneficial to trim the 41 // unnecessary spill slot moves. Therefore it is beneficial to trim the
42 // live ranges of environment slots by zapping them with a constant after 42 // live ranges of environment slots by zapping them with a constant after
43 // the last lookup that refers to them. 43 // the last lookup that refers to them.
44 // Slots are identified by their index and only affected if whitelisted in 44 // Slots are identified by their index and only affected if whitelisted in
45 // HOptimizedGraphBuilder::IsEligibleForEnvironmentLivenessAnalysis(). 45 // HOptimizedGraphBuilder::IsEligibleForEnvironmentLivenessAnalysis().
46 class EnvironmentSlotLivenessAnalyzer { 46 class HEnvironmentLivenessAnalysisPhase : public HPhase {
47 public: 47 public:
48 explicit EnvironmentSlotLivenessAnalyzer(HGraph* graph); 48 explicit HEnvironmentLivenessAnalysisPhase(HGraph* graph);
49 49
50 void AnalyzeAndTrim(); 50 void Run();
51 51
52 private: 52 private:
53 void ZapEnvironmentSlot(int index, HSimulate* simulate); 53 void ZapEnvironmentSlot(int index, HSimulate* simulate);
54 void ZapEnvironmentSlotsInSuccessors(HBasicBlock* block, BitVector* live); 54 void ZapEnvironmentSlotsInSuccessors(HBasicBlock* block, BitVector* live);
55 void ZapEnvironmentSlotsForInstruction(HEnvironmentMarker* marker); 55 void ZapEnvironmentSlotsForInstruction(HEnvironmentMarker* marker);
56 void UpdateLivenessAtBlockEnd(HBasicBlock* block, BitVector* live); 56 void UpdateLivenessAtBlockEnd(HBasicBlock* block, BitVector* live);
57 void UpdateLivenessAtInstruction(HInstruction* instr, BitVector* live); 57 void UpdateLivenessAtInstruction(HInstruction* instr, BitVector* live);
58 58
59 Zone* zone() { return &zone_; }
60
61 HGraph* graph_;
62 // Use a dedicated Zone for this phase, with a ZoneScope to ensure it
63 // gets freed.
64 Zone zone_;
65
66 int block_count_; 59 int block_count_;
67 60
68 // Largest number of local variables in any environment in the graph 61 // Largest number of local variables in any environment in the graph
69 // (including inlined environments). 62 // (including inlined environments).
70 int maximum_environment_size_; 63 int maximum_environment_size_;
71 64
72 // Per-block data. All these lists are indexed by block_id. 65 // Per-block data. All these lists are indexed by block_id.
73 ZoneList<BitVector*>* live_at_block_start_; 66 ZoneList<BitVector*> live_at_block_start_;
74 ZoneList<HSimulate*>* first_simulate_; 67 ZoneList<HSimulate*> first_simulate_;
75 ZoneList<BitVector*>* first_simulate_invalid_for_index_; 68 ZoneList<BitVector*> first_simulate_invalid_for_index_;
76 69
77 // List of all HEnvironmentMarker instructions for quick iteration/deletion. 70 // List of all HEnvironmentMarker instructions for quick iteration/deletion.
78 // It is populated during the first pass over the graph, controlled by 71 // It is populated during the first pass over the graph, controlled by
79 // |collect_markers_|. 72 // |collect_markers_|.
80 ZoneList<HEnvironmentMarker*>* markers_; 73 ZoneList<HEnvironmentMarker*> markers_;
81 bool collect_markers_; 74 bool collect_markers_;
82 75
83 // Keeps track of the last simulate seen, as well as the environment slots 76 // Keeps track of the last simulate seen, as well as the environment slots
84 // for which a new live range has started since (so they must not be zapped 77 // for which a new live range has started since (so they must not be zapped
85 // in that simulate when the end of another live range of theirs is found). 78 // in that simulate when the end of another live range of theirs is found).
86 HSimulate* last_simulate_; 79 HSimulate* last_simulate_;
87 BitVector* went_live_since_last_simulate_; 80 BitVector went_live_since_last_simulate_;
81
82 DISALLOW_COPY_AND_ASSIGN(HEnvironmentLivenessAnalysisPhase);
88 }; 83 };
89 84
90 85
91 } } // namespace v8::internal 86 } } // namespace v8::internal
92 87
93 #endif /* V8_HYDROGEN_ENVIRONMENT_LIVENESS_H_ */ 88 #endif /* V8_HYDROGEN_ENVIRONMENT_LIVENESS_H_ */
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-environment-liveness.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698