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

Unified Diff: src/compiler/pipeline.cc

Issue 1192553002: [turbofan] Fix life time and use of the Typer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address Michis comments. Created 5 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
« no previous file with comments | « no previous file | src/compiler/typer.h » ('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 7b74592cdca6d48188aface5e091dd48a2b963d3..84995be5970643168447e8af529c49bbe6aeadf8 100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -79,7 +79,6 @@ class PipelineData {
javascript_(nullptr),
jsgraph_(nullptr),
js_type_feedback_(nullptr),
- typer_(nullptr),
schedule_(nullptr),
instruction_zone_scope_(zone_pool_),
instruction_zone_(instruction_zone_scope_.zone()),
@@ -98,7 +97,6 @@ class PipelineData {
javascript_ = new (graph_zone_) JSOperatorBuilder(graph_zone_);
jsgraph_ = new (graph_zone_)
JSGraph(isolate_, graph_, common_, javascript_, machine_);
- typer_.Reset(new Typer(isolate_, graph_, info_->context()));
}
// For machine graph testing entry point.
@@ -121,7 +119,6 @@ class PipelineData {
javascript_(nullptr),
jsgraph_(nullptr),
js_type_feedback_(nullptr),
- typer_(nullptr),
schedule_(schedule),
instruction_zone_scope_(zone_pool_),
instruction_zone_(instruction_zone_scope_.zone()),
@@ -150,7 +147,6 @@ class PipelineData {
javascript_(nullptr),
jsgraph_(nullptr),
js_type_feedback_(nullptr),
- typer_(nullptr),
schedule_(nullptr),
instruction_zone_scope_(zone_pool_),
instruction_zone_(sequence->zone()),
@@ -194,7 +190,6 @@ class PipelineData {
void set_js_type_feedback(JSTypeFeedbackTable* js_type_feedback) {
js_type_feedback_ = js_type_feedback;
}
- Typer* typer() const { return typer_.get(); }
LoopAssignmentAnalysis* loop_assignment() const { return loop_assignment_; }
void set_loop_assignment(LoopAssignmentAnalysis* loop_assignment) {
@@ -220,7 +215,6 @@ class PipelineData {
void DeleteGraphZone() {
// Destroy objects with destructors first.
source_positions_.Reset(nullptr);
- typer_.Reset(nullptr);
if (graph_zone_ == nullptr) return;
// Destroy zone and clear pointers.
graph_zone_scope_.Destroy();
@@ -291,8 +285,6 @@ class PipelineData {
JSOperatorBuilder* javascript_;
JSGraph* jsgraph_;
JSTypeFeedbackTable* js_type_feedback_;
- // TODO(dcarney): make this into a ZoneObject.
- SmartPointer<Typer> typer_;
Schedule* schedule_;
// All objects in the following group of fields are allocated in
@@ -524,7 +516,11 @@ struct InliningPhase {
struct TyperPhase {
static const char* phase_name() { return "typer"; }
- void Run(PipelineData* data, Zone* temp_zone) { data->typer()->Run(); }
+ void Run(PipelineData* data, Zone* temp_zone, Typer* typer) {
+ NodeVector roots(temp_zone);
+ data->jsgraph()->GetCachedNodes(&roots);
+ typer->Run(roots);
+ }
};
@@ -1058,9 +1054,11 @@ Handle<Code> Pipeline::GenerateCode() {
// Bailout here in case target architecture is not supported.
if (!SupportedTarget()) return Handle<Code>::null();
+ SmartPointer<Typer> typer;
if (info()->is_typing_enabled()) {
// Type the graph.
- Run<TyperPhase>();
+ typer.Reset(new Typer(isolate(), data.graph(), info()->context()));
+ Run<TyperPhase>(typer.get());
RunPrintAndVerify("Typed");
}
@@ -1073,7 +1071,7 @@ Handle<Code> Pipeline::GenerateCode() {
if (FLAG_turbo_stress_loop_peeling) {
Run<StressLoopPeelingPhase>();
- RunPrintAndVerify("Loop peeled", true);
+ RunPrintAndVerify("Loop peeled");
}
if (info()->is_osr()) {
@@ -1107,7 +1105,7 @@ Handle<Code> Pipeline::GenerateCode() {
if (info()->is_osr()) {
Run<OsrDeconstructionPhase>();
if (info()->bailout_reason() != kNoReason) return Handle<Code>::null();
- RunPrintAndVerify("OSR deconstruction");
+ RunPrintAndVerify("OSR deconstruction", true);
}
}
@@ -1124,6 +1122,9 @@ Handle<Code> Pipeline::GenerateCode() {
data.source_positions()->RemoveDecorator();
+ // Kill the Typer and thereby uninstall the decorator (if any).
+ typer.Reset(nullptr);
+
return ScheduleAndGenerateCode(
Linkage::ComputeIncoming(data.instruction_zone(), info()));
}
« no previous file with comments | « no previous file | src/compiler/typer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698