From f9c4085904ec8579549df3ada44b0cc9bfe47acf Mon Sep 17 00:00:00 2001 From: Ross McIlroy Date: Mon, 20 Mar 2017 22:09:16 +0000 Subject: [PATCH] [TurboFan] Use temporary zone for effect linearization schedule. Also move phi NodeVector in TryCloneBranch to temporary zone. BUG=chromium:700364 Change-Id: Id19d51dae63ed5a6f5dccbba77a19b3663fd325e Reviewed-on: https://chromium-review.googlesource.com/456285 Reviewed-by: Ross McIlroy Reviewed-by: Jaroslav Sevcik Commit-Queue: Ross McIlroy Cr-Commit-Position: refs/heads/master@{#43962} --- src/compiler/effect-control-linearizer.cc | 10 +++++----- src/compiler/pipeline.cc | 2 +- src/compiler/scheduler.cc | 6 ++++-- src/compiler/scheduler.h | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/compiler/effect-control-linearizer.cc b/src/compiler/effect-control-linearizer.cc index 27da109b50..245dbd07c7 100644 --- a/src/compiler/effect-control-linearizer.cc +++ b/src/compiler/effect-control-linearizer.cc @@ -148,8 +148,8 @@ void RemoveRegionNode(Node* node) { node->Kill(); } -void TryCloneBranch(Node* node, BasicBlock* block, Graph* graph, - CommonOperatorBuilder* common, +void TryCloneBranch(Node* node, BasicBlock* block, Zone* temp_zone, + Graph* graph, CommonOperatorBuilder* common, BlockEffectControlMap* block_effects, SourcePositionTable* source_positions) { DCHECK_EQ(IrOpcode::kBranch, node->opcode()); @@ -216,7 +216,7 @@ void TryCloneBranch(Node* node, BasicBlock* block, Graph* graph, // Grab the IfTrue/IfFalse projections of the Branch. BranchMatcher matcher(branch); // Check/collect other Phi/EffectPhi nodes hanging off the Merge. - NodeVector phis(graph->zone()); + NodeVector phis(temp_zone); for (Node* const use : merge->uses()) { if (use == branch || use == cond) continue; // We cannot currently deal with non-Phi/EffectPhi nodes hanging off the @@ -456,8 +456,8 @@ void EffectControlLinearizer::Run() { case BasicBlock::kBranch: ProcessNode(block->control_input(), &frame_state, &effect, &control); - TryCloneBranch(block->control_input(), block, graph(), common(), - &block_effects, source_positions_); + TryCloneBranch(block->control_input(), block, temp_zone(), graph(), + common(), &block_effects, source_positions_); break; } diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc index 76c759d83d..54daedcd70 100644 --- a/src/compiler/pipeline.cc +++ b/src/compiler/pipeline.cc @@ -1074,7 +1074,7 @@ struct EffectControlLinearizationPhase { // effects (such as changing representation to tagged or // 'floating' allocation regions.) Schedule* schedule = Scheduler::ComputeSchedule(temp_zone, data->graph(), - Scheduler::kNoFlags); + Scheduler::kTempSchedule); if (FLAG_turbo_verify) ScheduleVerifier::Run(schedule); TraceSchedule(data->info(), schedule); diff --git a/src/compiler/scheduler.cc b/src/compiler/scheduler.cc index b4e74d98fe..0c164ecffd 100644 --- a/src/compiler/scheduler.cc +++ b/src/compiler/scheduler.cc @@ -37,8 +37,10 @@ Scheduler::Scheduler(Zone* zone, Graph* graph, Schedule* schedule, Flags flags) Schedule* Scheduler::ComputeSchedule(Zone* zone, Graph* graph, Flags flags) { - Schedule* schedule = new (graph->zone()) - Schedule(graph->zone(), static_cast(graph->NodeCount())); + Zone* schedule_zone = + (flags & Scheduler::kTempSchedule) ? zone : graph->zone(); + Schedule* schedule = new (schedule_zone) + Schedule(schedule_zone, static_cast(graph->NodeCount())); Scheduler scheduler(zone, graph, schedule, flags); scheduler.BuildCFG(); diff --git a/src/compiler/scheduler.h b/src/compiler/scheduler.h index 1a08e4c019..b405038414 100644 --- a/src/compiler/scheduler.h +++ b/src/compiler/scheduler.h @@ -29,12 +29,12 @@ class SpecialRPONumberer; class V8_EXPORT_PRIVATE Scheduler { public: // Flags that control the mode of operation. - enum Flag { kNoFlags = 0u, kSplitNodes = 1u << 1 }; + enum Flag { kNoFlags = 0u, kSplitNodes = 1u << 1, kTempSchedule = 1u << 2 }; typedef base::Flags Flags; // The complete scheduling algorithm. Creates a new schedule and places all // nodes from the graph into it. - static Schedule* ComputeSchedule(Zone* zone, Graph* graph, Flags flags); + static Schedule* ComputeSchedule(Zone* temp_zone, Graph* graph, Flags flags); // Compute the RPO of blocks in an existing schedule. static BasicBlockVector* ComputeSpecialRPO(Zone* zone, Schedule* schedule);