Implement fixpoint iteration for escape analysis.

R=titzer@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17235 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 1eeebd2b
...@@ -313,6 +313,8 @@ DEFINE_bool(inline_construct, true, "inline constructor calls") ...@@ -313,6 +313,8 @@ DEFINE_bool(inline_construct, true, "inline constructor calls")
DEFINE_bool(inline_arguments, true, "inline functions with arguments object") DEFINE_bool(inline_arguments, true, "inline functions with arguments object")
DEFINE_bool(inline_accessors, true, "inline JavaScript accessors") DEFINE_bool(inline_accessors, true, "inline JavaScript accessors")
DEFINE_int(loop_weight, 1, "loop weight for representation inference") DEFINE_int(loop_weight, 1, "loop weight for representation inference")
DEFINE_int(escape_analysis_iterations, 1,
"maximum number of escape analysis fix-point iterations")
DEFINE_bool(optimize_for_in, true, DEFINE_bool(optimize_for_in, true,
"optimize functions containing for-in loops") "optimize functions containing for-in loops")
......
...@@ -306,7 +306,7 @@ void HEscapeAnalysisPhase::PerformScalarReplacement() { ...@@ -306,7 +306,7 @@ void HEscapeAnalysisPhase::PerformScalarReplacement() {
number_of_objects_++; number_of_objects_++;
block_states_.Clear(); block_states_.Clear();
// Perform actual analysis steps. // Perform actual analysis step.
AnalyzeDataFlow(allocate); AnalyzeDataFlow(allocate);
cumulative_values_ += number_of_values_; cumulative_values_ += number_of_values_;
...@@ -320,8 +320,13 @@ void HEscapeAnalysisPhase::Run() { ...@@ -320,8 +320,13 @@ void HEscapeAnalysisPhase::Run() {
// TODO(mstarzinger): We disable escape analysis with OSR for now, because // TODO(mstarzinger): We disable escape analysis with OSR for now, because
// spill slots might be uninitialized. Needs investigation. // spill slots might be uninitialized. Needs investigation.
if (graph()->has_osr()) return; if (graph()->has_osr()) return;
CollectCapturedValues(); int max_fixpoint_iteration_count = FLAG_escape_analysis_iterations;
PerformScalarReplacement(); for (int i = 0; i < max_fixpoint_iteration_count; i++) {
CollectCapturedValues();
if (captured_.is_empty()) break;
PerformScalarReplacement();
captured_.Clear();
}
} }
......
...@@ -2396,6 +2396,12 @@ void HCapturedObject::ReplayEnvironment(HEnvironment* env) { ...@@ -2396,6 +2396,12 @@ void HCapturedObject::ReplayEnvironment(HEnvironment* env) {
} }
void HCapturedObject::PrintDataTo(StringStream* stream) {
stream->Add("#%d ", capture_id());
HDematerializedObject::PrintDataTo(stream);
}
void HEnterInlined::RegisterReturnTarget(HBasicBlock* return_target, void HEnterInlined::RegisterReturnTarget(HBasicBlock* return_target,
Zone* zone) { Zone* zone) {
ASSERT(return_target->IsInlineReturnTarget()); ASSERT(return_target->IsInlineReturnTarget());
......
...@@ -3317,6 +3317,8 @@ class HCapturedObject V8_FINAL : public HDematerializedObject { ...@@ -3317,6 +3317,8 @@ class HCapturedObject V8_FINAL : public HDematerializedObject {
// Replay effects of this instruction on the given environment. // Replay effects of this instruction on the given environment.
void ReplayEnvironment(HEnvironment* env); void ReplayEnvironment(HEnvironment* env);
virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
DECLARE_CONCRETE_INSTRUCTION(CapturedObject) DECLARE_CONCRETE_INSTRUCTION(CapturedObject)
private: private:
......
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