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

Unified Diff: src/compiler/pipeline.cc

Issue 665893006: [turbofan] add ZonePool to correctly track compiler phase memory usage (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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/compiler/pipeline.h ('k') | src/compiler/raw-machine-assembler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index df8673797a0ce7eb888078c91291fb01951d17e6..8c995616fe7e6a9a3ea419a25054ee33c7039d2f 100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -30,6 +30,7 @@
#include "src/compiler/typer.h"
#include "src/compiler/value-numbering-reducer.h"
#include "src/compiler/verifier.h"
+#include "src/compiler/zone-pool.h"
#include "src/hydrogen.h"
#include "src/ostreams.h"
#include "src/utils.h"
@@ -42,20 +43,24 @@ class PhaseStats {
public:
enum PhaseKind { CREATE_GRAPH, OPTIMIZATION, CODEGEN };
- PhaseStats(CompilationInfo* info, PhaseKind kind, const char* name)
+ PhaseStats(CompilationInfo* info, ZonePool* zone_pool, PhaseKind kind,
+ const char* name)
: info_(info),
+ stats_scope_(zone_pool),
kind_(kind),
name_(name),
- size_(info->zone()->allocation_size()) {
+ size_(0) {
if (FLAG_turbo_stats) {
timer_.Start();
+ size_ = info_->zone()->allocation_size();
}
}
~PhaseStats() {
if (FLAG_turbo_stats) {
base::TimeDelta delta = timer_.Elapsed();
- size_t bytes = info_->zone()->allocation_size() - size_;
+ size_t bytes = info_->zone()->allocation_size() +
+ stats_scope_.GetMaxAllocatedBytes() - size_;
HStatistics* stats = info_->isolate()->GetTStatistics();
stats->SaveTiming(name_, delta, static_cast<int>(bytes));
@@ -75,6 +80,7 @@ class PhaseStats {
private:
CompilationInfo* info_;
+ ZonePool::StatsScope stats_scope_;
PhaseKind kind_;
const char* name_;
size_t size_;
@@ -229,6 +235,8 @@ Handle<Code> Pipeline::GenerateCode() {
PrintCompilationStart();
}
+ ZonePool zone_pool(isolate());
+
// Build the graph.
Graph graph(zone());
SourcePositionTable source_positions(&graph);
@@ -243,7 +251,7 @@ Handle<Code> Pipeline::GenerateCode() {
JSGraph jsgraph(&graph, &common, &javascript, &machine);
Node* context_node;
{
- PhaseStats graph_builder_stats(info(), PhaseStats::CREATE_GRAPH,
+ PhaseStats graph_builder_stats(info(), &zone_pool, PhaseStats::CREATE_GRAPH,
"graph builder");
AstGraphBuilderWithPositions graph_builder(info(), &jsgraph,
&source_positions);
@@ -251,7 +259,7 @@ Handle<Code> Pipeline::GenerateCode() {
context_node = graph_builder.GetFunctionContext();
}
{
- PhaseStats phi_reducer_stats(info(), PhaseStats::CREATE_GRAPH,
+ PhaseStats phi_reducer_stats(info(), &zone_pool, PhaseStats::CREATE_GRAPH,
"phi reduction");
PhiReducer phi_reducer;
GraphReducer graph_reducer(&graph);
@@ -292,13 +300,14 @@ Handle<Code> Pipeline::GenerateCode() {
if (info()->is_typing_enabled()) {
{
// Type the graph.
- PhaseStats typer_stats(info(), PhaseStats::CREATE_GRAPH, "typer");
+ PhaseStats typer_stats(info(), &zone_pool, PhaseStats::CREATE_GRAPH,
+ "typer");
typer.Run();
VerifyAndPrintGraph(&graph, "Typed");
}
{
// Lower JSOperators where we can determine types.
- PhaseStats lowering_stats(info(), PhaseStats::CREATE_GRAPH,
+ PhaseStats lowering_stats(info(), &zone_pool, PhaseStats::CREATE_GRAPH,
"typed lowering");
SourcePositionTable::Scope pos(&source_positions,
SourcePosition::Unknown());
@@ -315,7 +324,7 @@ Handle<Code> Pipeline::GenerateCode() {
}
{
// Lower simplified operators and insert changes.
- PhaseStats lowering_stats(info(), PhaseStats::CREATE_GRAPH,
+ PhaseStats lowering_stats(info(), &zone_pool, PhaseStats::CREATE_GRAPH,
"simplified lowering");
SourcePositionTable::Scope pos(&source_positions,
SourcePosition::Unknown());
@@ -332,7 +341,7 @@ Handle<Code> Pipeline::GenerateCode() {
}
{
// Lower changes that have been inserted before.
- PhaseStats lowering_stats(info(), PhaseStats::OPTIMIZATION,
+ PhaseStats lowering_stats(info(), &zone_pool, PhaseStats::OPTIMIZATION,
"change lowering");
SourcePositionTable::Scope pos(&source_positions,
SourcePosition::Unknown());
@@ -356,8 +365,8 @@ Handle<Code> Pipeline::GenerateCode() {
{
SourcePositionTable::Scope pos(&source_positions,
SourcePosition::Unknown());
- PhaseStats control_reducer_stats(info(), PhaseStats::CREATE_GRAPH,
- "control reduction");
+ PhaseStats control_reducer_stats(
+ info(), &zone_pool, PhaseStats::CREATE_GRAPH, "control reduction");
ControlReducer::ReduceGraph(&jsgraph, &common);
VerifyAndPrintGraph(&graph, "Control reduced");
@@ -366,7 +375,7 @@ Handle<Code> Pipeline::GenerateCode() {
{
// Lower any remaining generic JSOperators.
- PhaseStats lowering_stats(info(), PhaseStats::CREATE_GRAPH,
+ PhaseStats lowering_stats(info(), &zone_pool, PhaseStats::CREATE_GRAPH,
"generic lowering");
SourcePositionTable::Scope pos(&source_positions,
SourcePosition::Unknown());
@@ -384,9 +393,10 @@ Handle<Code> Pipeline::GenerateCode() {
Handle<Code> code = Handle<Code>::null();
{
// Compute a schedule.
- Schedule* schedule = ComputeSchedule(&graph);
+ Schedule* schedule = ComputeSchedule(&zone_pool, &graph);
// Generate optimized code.
- PhaseStats codegen_stats(info(), PhaseStats::CODEGEN, "codegen");
+ PhaseStats codegen_stats(info(), &zone_pool, PhaseStats::CODEGEN,
+ "codegen");
Linkage linkage(info());
code = GenerateCode(&linkage, &graph, schedule, &source_positions);
info()->SetCode(code);
@@ -407,9 +417,10 @@ Handle<Code> Pipeline::GenerateCode() {
}
-Schedule* Pipeline::ComputeSchedule(Graph* graph) {
- PhaseStats schedule_stats(info(), PhaseStats::CODEGEN, "scheduling");
- Schedule* schedule = Scheduler::ComputeSchedule(graph);
+Schedule* Pipeline::ComputeSchedule(ZonePool* zone_pool, Graph* graph) {
+ PhaseStats schedule_stats(info(), zone_pool, PhaseStats::CODEGEN,
+ "scheduling");
+ Schedule* schedule = Scheduler::ComputeSchedule(zone_pool, graph);
TraceSchedule(schedule);
if (VerifyGraphs()) ScheduleVerifier::Run(schedule);
return schedule;
@@ -423,7 +434,8 @@ Handle<Code> Pipeline::GenerateCodeForMachineGraph(Linkage* linkage,
if (schedule == NULL) {
// TODO(rossberg): Should this really be untyped?
VerifyAndPrintGraph(graph, "Machine", true);
- schedule = ComputeSchedule(graph);
+ ZonePool zone_pool(isolate());
+ schedule = ComputeSchedule(&zone_pool, graph);
}
TraceSchedule(schedule);
« no previous file with comments | « src/compiler/pipeline.h ('k') | src/compiler/raw-machine-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698