Commit aadcf381 authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

Turn escape analysis into a proper HPhase.

R=danno@chromium.org, mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/18476004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15438 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 7a820bec
......@@ -31,7 +31,7 @@ namespace v8 {
namespace internal {
void HEscapeAnalysis::CollectIfNoEscapingUses(HInstruction* instr) {
void HEscapeAnalysisPhase::CollectIfNoEscapingUses(HInstruction* instr) {
for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
HValue* use = it.value();
if (use->HasEscapingOperandAt(it.index())) {
......@@ -45,14 +45,14 @@ void HEscapeAnalysis::CollectIfNoEscapingUses(HInstruction* instr) {
if (FLAG_trace_escape_analysis) {
PrintF("#%d (%s) is being captured\n", instr->id(), instr->Mnemonic());
}
captured_.Add(instr, zone_);
captured_.Add(instr, zone());
}
void HEscapeAnalysis::CollectCapturedValues() {
int block_count = graph_->blocks()->length();
void HEscapeAnalysisPhase::CollectCapturedValues() {
int block_count = graph()->blocks()->length();
for (int i = 0; i < block_count; ++i) {
HBasicBlock* block = graph_->blocks()->at(i);
HBasicBlock* block = graph()->blocks()->at(i);
for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
HInstruction* instr = it.Current();
if (instr->IsAllocate() || instr->IsAllocateObject()) {
......@@ -63,10 +63,4 @@ void HEscapeAnalysis::CollectCapturedValues() {
}
void HEscapeAnalysis::Analyze() {
HPhase phase("H_Escape analysis", graph_);
CollectCapturedValues();
}
} } // namespace v8::internal
......@@ -35,19 +35,19 @@ namespace v8 {
namespace internal {
class HEscapeAnalysis BASE_EMBEDDED {
class HEscapeAnalysisPhase : public HPhase {
public:
explicit HEscapeAnalysis(HGraph* graph)
: graph_(graph), zone_(graph->zone()), captured_(0, zone_) { }
explicit HEscapeAnalysisPhase(HGraph* graph)
: HPhase("H_Escape analysis", graph), captured_(0, zone()) { }
void Analyze();
void Run() {
CollectCapturedValues();
}
private:
void CollectCapturedValues();
void CollectIfNoEscapingUses(HInstruction* instr);
HGraph* graph_;
Zone* zone_;
ZoneList<HValue*> captured_;
};
......
......@@ -3815,10 +3815,7 @@ bool HGraph::Optimize(SmartArrayPointer<char>* bailout_reason) {
if (FLAG_use_canonicalizing) Canonicalize();
if (FLAG_use_escape_analysis) {
HEscapeAnalysis escape_analysis(this);
escape_analysis.Analyze();
}
if (FLAG_use_escape_analysis) Run<HEscapeAnalysisPhase>();
if (FLAG_use_gvn) Run<HGlobalValueNumberingPhase>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment