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

Unified Diff: src/hydrogen.cc

Issue 17657004: Refactor Hydrogen GVN into an HPhase and use the phase zone. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index fdb5665ca16ec2604c54f44bb39f194eeeedfbee..4ae8d8195c41ab76171bd6c1c2c94da36e34c403 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -3946,21 +3946,6 @@ bool HOptimizedGraphBuilder::BuildGraph() {
}
-// Perform common subexpression elimination and loop-invariant code motion.
-void HGraph::GlobalValueNumbering() {
- HPhase phase("H_Global value numbering", this);
- HGlobalValueNumberer gvn(this, info());
- bool removed_side_effects = gvn.Analyze();
- // Trigger a second analysis pass to further eliminate duplicate values that
- // could only be discovered by removing side-effect-generating instructions
- // during the first pass.
- if (FLAG_smi_only_arrays && removed_side_effects) {
- removed_side_effects = gvn.Analyze();
- ASSERT(!removed_side_effects);
- }
-}
-
-
bool HGraph::Optimize(SmartArrayPointer<char>* bailout_reason) {
*bailout_reason = SmartArrayPointer<char>();
OrderBlocks();
@@ -4029,7 +4014,7 @@ bool HGraph::Optimize(SmartArrayPointer<char>* bailout_reason) {
if (FLAG_use_canonicalizing) Canonicalize();
- if (FLAG_use_gvn) GlobalValueNumbering();
+ if (FLAG_use_gvn) Run<HGlobalValueNumberingPhase>();
if (FLAG_use_range) {
HRangeAnalysis rangeAnalysis(this);
@@ -11554,7 +11539,22 @@ void HStatistics::SaveTiming(const char* name, int64_t ticks, unsigned size) {
}
+HPhase::HPhase(const char* name, HGraph* graph, Zone* zone)
+ : CompilationPhase(name, graph->isolate(), zone), graph_(graph) {
+ if (FLAG_hydrogen_stats) {
+ graph_zone_start_allocation_size_ = graph->zone()->allocation_size();
+ }
+}
+
+
HPhase::~HPhase() {
+ // Also count allocations in the graph's zone if it's not the phase zone
+ if (FLAG_hydrogen_stats && graph_->zone() != zone()) {
+ unsigned size =
+ graph_->zone()->allocation_size() - graph_zone_start_allocation_size_;
+ isolate()->GetHStatistics()->SaveTiming(name(), 0, size);
+ }
+
if (ShouldProduceTraceOutput()) {
isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
}

Powered by Google App Engine
This is Rietveld 408576698