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

Unified Diff: src/hydrogen-instructions.h

Issue 14676011: Improve dead code elimination by transitively marking live code and removing all dead code. Replace… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rename CanBeEliminated -> CannotBeEliminated, implement IsDeletable() for HPhi. Created 7 years, 7 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 | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index 62c98153894c9103b51754b82d67a9a6775067ec..6642f76713315c0355cacc58e2e2851fabf30444 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -794,6 +794,7 @@ class HValue: public ZoneObject {
kDeoptimizeOnUndefined,
kIsArguments,
kTruncatingToInt32,
+ // Set after an instruction is killed.
kIsDead,
// Instructions that are allowed to produce full range unsigned integer
// values are marked with kUint32 flag. If arithmetic shift or a load from
@@ -809,6 +810,8 @@ class HValue: public ZoneObject {
// has processed this instruction.
kIDefsProcessingDone,
kHasNoObservableSideEffects,
+ // Indicates the instruction is live during dead code elimination.
+ kIsLive,
kLastFlag = kIDefsProcessingDone
};
@@ -1071,8 +1074,9 @@ class HValue: public ZoneObject {
UNREACHABLE();
}
- bool IsDead() const {
- return HasNoUses() && !HasObservableSideEffects() && IsDeletable();
+ // Check if this instruction has some reason that prevents elimination.
+ bool CannotBeEliminated() const {
+ return HasObservableSideEffects() || !IsDeletable();
}
#ifdef DEBUG
@@ -2969,7 +2973,6 @@ class HPhi: public HValue {
: inputs_(2, zone),
merged_index_(merged_index),
phi_id_(-1),
- is_live_(false),
is_convertible_to_integer_(true) {
for (int i = 0; i < Representation::kNumRepresentations; i++) {
non_phi_uses_[i] = 0;
@@ -2994,7 +2997,7 @@ class HPhi: public HValue {
void AddInput(HValue* value);
bool HasRealUses();
- bool IsReceiver() { return merged_index_ == 0; }
+ bool IsReceiver() const { return merged_index_ == 0; }
int merged_index() const { return merged_index_; }
@@ -3029,8 +3032,6 @@ class HPhi: public HValue {
return indirect_uses_[Representation::kDouble];
}
int phi_id() { return phi_id_; }
- bool is_live() { return is_live_; }
- void set_is_live(bool b) { is_live_ = b; }
static HPhi* cast(HValue* value) {
ASSERT(value->IsPhi());
@@ -3062,6 +3063,9 @@ class HPhi: public HValue {
void SimplifyConstantInputs();
+ // TODO(titzer): we can't eliminate the receiver for generating backtraces
+ virtual bool IsDeletable() const { return !IsReceiver(); }
+
protected:
virtual void DeleteFromGraph();
virtual void InternalSetOperandAt(int index, HValue* value) {
@@ -3080,7 +3084,6 @@ class HPhi: public HValue {
int non_phi_uses_[Representation::kNumRepresentations];
int indirect_uses_[Representation::kNumRepresentations];
int phi_id_;
- bool is_live_;
bool is_convertible_to_integer_;
};
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698