javascript_(nullptr),
jsgraph_(nullptr),
js_type_feedback_(nullptr),
- typer_(nullptr),
schedule_(nullptr),
instruction_zone_scope_(zone_pool_),
instruction_zone_(instruction_zone_scope_.zone()),
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.
javascript_(nullptr),
jsgraph_(nullptr),
js_type_feedback_(nullptr),
- typer_(nullptr),
schedule_(schedule),
instruction_zone_scope_(zone_pool_),
instruction_zone_(instruction_zone_scope_.zone()),
javascript_(nullptr),
jsgraph_(nullptr),
js_type_feedback_(nullptr),
- typer_(nullptr),
schedule_(nullptr),
instruction_zone_scope_(zone_pool_),
instruction_zone_(sequence->zone()),
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) {
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();
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
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);
+ }
};
// 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");
}
if (FLAG_turbo_stress_loop_peeling) {
Run<StressLoopPeelingPhase>();
- RunPrintAndVerify("Loop peeled", true);
+ RunPrintAndVerify("Loop peeled");
}
if (info()->is_osr()) {
if (info()->is_osr()) {
Run<OsrDeconstructionPhase>();
if (info()->bailout_reason() != kNoReason) return Handle<Code>::null();
- RunPrintAndVerify("OSR deconstruction");
+ RunPrintAndVerify("OSR deconstruction", true);
}
}
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()));
}
};
-void Typer::Run() {
- {
- // TODO(titzer): this is a hack. Reset types for interior nodes first.
- NodeDeque deque(zone());
- NodeMarker<bool> marked(graph(), 2);
- deque.push_front(graph()->end());
- marked.Set(graph()->end(), true);
- while (!deque.empty()) {
- Node* node = deque.front();
- deque.pop_front();
- // TODO(titzer): there shouldn't be a need to retype constants.
- if (node->op()->ValueOutputCount() > 0)
- NodeProperties::RemoveBounds(node);
- for (Node* input : node->inputs()) {
- if (!marked.Get(input)) {
- marked.Set(input, true);
- deque.push_back(input);
- }
- }
- }
- }
+void Typer::Run() { Run(NodeVector(zone())); }
+
+void Typer::Run(const NodeVector& roots) {
Visitor visitor(this);
GraphReducer graph_reducer(zone(), graph());
graph_reducer.AddReducer(&visitor);
+ for (Node* const root : roots) graph_reducer.ReduceNode(root);
graph_reducer.ReduceGraph();
}