| Index: src/compiler/pipeline.cc
|
| diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
|
| index 3325d9b0641994504652622d3a45526c13f9ce71..9256e5882d41f9dda1a12c16784a24013d62e0b4 100644
|
| --- a/src/compiler/pipeline.cc
|
| +++ b/src/compiler/pipeline.cc
|
| @@ -55,6 +55,7 @@
|
| #include "src/compiler/simplified-operator.h"
|
| #include "src/compiler/simplified-operator-reducer.h"
|
| #include "src/compiler/tail-call-optimization.h"
|
| +#include "src/compiler/type-hint-analyzer.h"
|
| #include "src/compiler/typer.h"
|
| #include "src/compiler/value-numbering-reducer.h"
|
| #include "src/compiler/verifier.h"
|
| @@ -210,6 +211,12 @@ class PipelineData {
|
| loop_assignment_ = loop_assignment;
|
| }
|
|
|
| + TypeHintAnalysis* type_hint_analysis() const { return type_hint_analysis_; }
|
| + void set_type_hint_analysis(TypeHintAnalysis* type_hint_analysis) {
|
| + DCHECK_NULL(type_hint_analysis_);
|
| + type_hint_analysis_ = type_hint_analysis;
|
| + }
|
| +
|
| Schedule* schedule() const { return schedule_; }
|
| void set_schedule(Schedule* schedule) {
|
| DCHECK(!schedule_);
|
| @@ -234,6 +241,7 @@ class PipelineData {
|
| graph_zone_ = nullptr;
|
| graph_ = nullptr;
|
| loop_assignment_ = nullptr;
|
| + type_hint_analysis_ = nullptr;
|
| simplified_ = nullptr;
|
| machine_ = nullptr;
|
| common_ = nullptr;
|
| @@ -301,6 +309,7 @@ class PipelineData {
|
| // TODO(dcarney): make this into a ZoneObject.
|
| base::SmartPointer<SourcePositionTable> source_positions_;
|
| LoopAssignmentAnalysis* loop_assignment_;
|
| + TypeHintAnalysis* type_hint_analysis_ = nullptr;
|
| SimplifiedOperatorBuilder* simplified_;
|
| MachineOperatorBuilder* machine_;
|
| CommonOperatorBuilder* common_;
|
| @@ -363,8 +372,10 @@ class AstGraphBuilderWithPositions final : public AstGraphBuilder {
|
| AstGraphBuilderWithPositions(Zone* local_zone, CompilationInfo* info,
|
| JSGraph* jsgraph,
|
| LoopAssignmentAnalysis* loop_assignment,
|
| + TypeHintAnalysis* type_hint_analysis,
|
| SourcePositionTable* source_positions)
|
| - : AstGraphBuilder(local_zone, info, jsgraph, loop_assignment),
|
| + : AstGraphBuilder(local_zone, info, jsgraph, loop_assignment,
|
| + type_hint_analysis),
|
| source_positions_(source_positions),
|
| start_position_(info->shared_info()->start_position()) {}
|
|
|
| @@ -476,6 +487,18 @@ struct LoopAssignmentAnalysisPhase {
|
| };
|
|
|
|
|
| +struct TypeHintAnalysisPhase {
|
| + static const char* phase_name() { return "type hint analysis"; }
|
| +
|
| + void Run(PipelineData* data, Zone* temp_zone) {
|
| + TypeHintAnalyzer analyzer(data->graph_zone());
|
| + Handle<Code> code(data->info()->shared_info()->code(), data->isolate());
|
| + TypeHintAnalysis* type_hint_analysis = analyzer.Analyze(code);
|
| + data->set_type_hint_analysis(type_hint_analysis);
|
| + }
|
| +};
|
| +
|
| +
|
| struct GraphBuilderPhase {
|
| static const char* phase_name() { return "graph builder"; }
|
|
|
| @@ -490,7 +513,7 @@ struct GraphBuilderPhase {
|
| } else {
|
| AstGraphBuilderWithPositions graph_builder(
|
| temp_zone, data->info(), data->jsgraph(), data->loop_assignment(),
|
| - data->source_positions());
|
| + data->type_hint_analysis(), data->source_positions());
|
| succeeded = graph_builder.CreateGraph(stack_check);
|
| }
|
|
|
| @@ -1074,6 +1097,10 @@ Handle<Code> Pipeline::GenerateCode() {
|
| Run<LoopAssignmentAnalysisPhase>();
|
| }
|
|
|
| + if (info()->is_typing_enabled()) {
|
| + Run<TypeHintAnalysisPhase>();
|
| + }
|
| +
|
| Run<GraphBuilderPhase>();
|
| if (data.compilation_failed()) return Handle<Code>::null();
|
| RunPrintAndVerify("Initial untyped", true);
|
|
|