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())) {
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()) {
}
-void HEscapeAnalysis::Analyze() {
- HPhase phase("H_Escape analysis", graph_);
- CollectCapturedValues();
-}
-
-
} } // namespace v8::internal
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_;
};
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>();