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

Unified Diff: runtime/vm/intermediate_language.h

Issue 10832180: Eliminate phis that do not reach any non-environment uses. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address Kevin's comment Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.h
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index 07491af2ef982fbef7f61269672084cc4676966c..8245b46edf4d2d5b1c37c44e6733f749cccde7cc 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -2216,6 +2216,7 @@ class JoinEntryInstr : public BlockEntryInstr {
virtual void PrepareEntry(FlowGraphCompiler* compiler);
void InsertPhi(intptr_t var_index, intptr_t var_count);
+ void RemoveDeadPhis();
intptr_t phi_count() const { return phi_count_; }
@@ -2362,7 +2363,8 @@ class BindInstr : public Definition {
class PhiInstr : public Definition {
public:
- explicit PhiInstr(intptr_t num_inputs) : inputs_(num_inputs) {
+ explicit PhiInstr(intptr_t num_inputs)
+ : inputs_(num_inputs), is_alive_(false) {
for (intptr_t i = 0; i < num_inputs; ++i) {
inputs_.Add(NULL);
}
@@ -2381,10 +2383,15 @@ class PhiInstr : public Definition {
virtual bool CanDeoptimize() const { return false; }
+ // Phi is alive if it reaches a non-environment use.
+ bool is_alive() const { return is_alive_; }
+ void mark_alive() { is_alive_ = true; }
+
DECLARE_INSTRUCTION(Phi)
private:
GrowableArray<Value*> inputs_;
+ bool is_alive_;
DISALLOW_COPY_AND_ASSIGN(PhiInstr);
};
@@ -2690,6 +2697,10 @@ class Environment : public ZoneAllocated {
return values_;
}
+ GrowableArray<Value*>* values_ptr() {
+ return &values_;
+ }
+
void InitializeLocations() {
location_count_ = values_.length();
if (location_count_ > 0) {
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698