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

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

Issue 15533004: Liveness analysis for environment slots in Hydrogen (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fixed bug (again; the same one as patch set 6) Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 #ifndef V8_HYDROGEN_ENVIRONMENT_LIVENESS_H_
29 #define V8_HYDROGEN_ENVIRONMENT_LIVENESS_H_
30
31
32 #include "hydrogen.h"
33
34 namespace v8 {
35 namespace internal {
36
37
titzer 2013/05/29 16:58:05 Documentation. At least a sentence. Perhaps Enviro
Jakob Kummerow 2013/06/03 17:50:38 Done.
38 class EnvironmentSlotLivenessAnalysis {
39 public:
40 explicit EnvironmentSlotLivenessAnalysis(HGraph* graph)
titzer 2013/05/29 16:58:05 Please put this constructor in the .cc file, if C+
Jakob Kummerow 2013/06/03 17:50:38 Done. Good point, dunno why it didn't occur to me
41 : graph_(graph),
42 zone_(graph->isolate()),
43 zone_scope_(&zone_, DELETE_ON_EXIT),
44 block_count_(graph->blocks()->length()),
45 maximum_environment_size_(graph->maximum_environment_size()),
46 collect_markers_(true),
47 last_simulate_(NULL) {
48 if (maximum_environment_size_ == 0) return;
49
50 live_at_block_start_ =
51 new(zone()) ZoneList<BitVector*>(block_count_, zone());
52 first_simulate_ = new(zone()) ZoneList<HSimulate*>(block_count_, zone());
53 first_simulate_invalid_for_index_ =
54 new(zone()) ZoneList<BitVector*>(block_count_, zone());
55 markers_ = new(zone())
56 ZoneList<HEnvironmentMarker*>(maximum_environment_size_, zone());
57 live_ = new(zone()) BitVector(maximum_environment_size_, zone());
58 went_live_since_last_simulate_ =
59 new(zone()) BitVector(maximum_environment_size_, zone());
60
61 for (int i = 0; i < block_count_; ++i) {
62 live_at_block_start_->Add(
63 new(zone()) BitVector(maximum_environment_size_, zone()), zone());
64 first_simulate_->Add(NULL, zone());
65 first_simulate_invalid_for_index_->Add(
66 new(zone()) BitVector(maximum_environment_size_, zone()), zone());
67 }
68 }
69
70 void AnalyzeAndPrune();
71
72 private:
73 void ZapEnvironmentSlot(int index, HSimulate* simulate);
74 void ZapEnvironmentSlotsInSuccessors(HBasicBlock* block);
75 void ZapEnvironmentSlotsForInstruction(HEnvironmentMarker* marker);
76 void UpdateLivenessAtBlockEnd(HBasicBlock* block);
77 void UpdateLivenessAtInstruction(HInstruction* instr);
78
79 Zone* zone() { return &zone_; }
80
81 HGraph* graph_;
82 Zone zone_;
83 ZoneScope zone_scope_;
titzer 2013/05/29 16:58:05 Would like to see some comments on these fields, e
Jakob Kummerow 2013/06/03 17:50:38 Done.
84 int block_count_;
85 int maximum_environment_size_;
86 ZoneList<BitVector*>* live_at_block_start_;
87 ZoneList<HSimulate*>* first_simulate_;
88 ZoneList<BitVector*>* first_simulate_invalid_for_index_;
89 ZoneList<HEnvironmentMarker*>* markers_;
90
91 bool collect_markers_;
92 BitVector* live_;
titzer 2013/05/29 16:58:05 I think it's best to turn this field into a local
Jakob Kummerow 2013/06/03 17:50:38 Done.
93 HSimulate* last_simulate_;
94 BitVector* went_live_since_last_simulate_;
95 };
96
97
98 } } // namespace v8::internal
99
100 #endif /* V8_HYDROGEN_ENVIRONMENT_LIVENESS_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698