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

Side by Side Diff: src/compiler/pipeline.cc

Issue 509343002: Better typing and type verification (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/pipeline.h" 5 #include "src/compiler/pipeline.h"
6 6
7 #include "src/base/platform/elapsed-timer.h" 7 #include "src/base/platform/elapsed-timer.h"
8 #include "src/compiler/ast-graph-builder.h" 8 #include "src/compiler/ast-graph-builder.h"
9 #include "src/compiler/code-generator.h" 9 #include "src/compiler/code-generator.h"
10 #include "src/compiler/graph-replay.h" 10 #include "src/compiler/graph-replay.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 os << "---------------------------------------------------\n" 150 os << "---------------------------------------------------\n"
151 << "Begin compiling method " 151 << "Begin compiling method "
152 << info()->function()->debug_name()->ToCString().get() 152 << info()->function()->debug_name()->ToCString().get()
153 << " using Turbofan" << endl; 153 << " using Turbofan" << endl;
154 } 154 }
155 155
156 // Build the graph. 156 // Build the graph.
157 Graph graph(zone()); 157 Graph graph(zone());
158 SourcePositionTable source_positions(&graph); 158 SourcePositionTable source_positions(&graph);
159 source_positions.AddDecorator(); 159 source_positions.AddDecorator();
160 // TODO(turbofan): there is no need to type anything during initial graph
161 // construction. This is currently only needed for the node cache, which the
162 // typer could sweep over later.
163 Typer typer(zone());
164 CommonOperatorBuilder common(zone()); 160 CommonOperatorBuilder common(zone());
165 JSGraph jsgraph(&graph, &common, &typer); 161 JSGraph jsgraph(&graph, &common);
166 Node* context_node; 162 Node* context_node;
167 { 163 {
168 PhaseStats graph_builder_stats(info(), PhaseStats::CREATE_GRAPH, 164 PhaseStats graph_builder_stats(info(), PhaseStats::CREATE_GRAPH,
169 "graph builder"); 165 "graph builder");
170 AstGraphBuilderWithPositions graph_builder(info(), &jsgraph, 166 AstGraphBuilderWithPositions graph_builder(info(), &jsgraph,
171 &source_positions); 167 &source_positions);
172 graph_builder.CreateGraph(); 168 graph_builder.CreateGraph();
173 context_node = graph_builder.GetFunctionContext(); 169 context_node = graph_builder.GetFunctionContext();
174 } 170 }
175 { 171 {
(...skipping 25 matching lines...) Expand all
201 JSInliner inliner(info(), &jsgraph); 197 JSInliner inliner(info(), &jsgraph);
202 inliner.Inline(); 198 inliner.Inline();
203 VerifyAndPrintGraph(&graph, "Inlined"); 199 VerifyAndPrintGraph(&graph, "Inlined");
204 } 200 }
205 201
206 // Print a replay of the initial graph. 202 // Print a replay of the initial graph.
207 if (FLAG_print_turbo_replay) { 203 if (FLAG_print_turbo_replay) {
208 GraphReplayPrinter::PrintReplay(&graph); 204 GraphReplayPrinter::PrintReplay(&graph);
209 } 205 }
210 206
207 Typer typer(&graph, info()->context());
211 if (FLAG_turbo_types) { 208 if (FLAG_turbo_types) {
212 { 209 {
213 // Type the graph. 210 // Type the graph.
214 PhaseStats typer_stats(info(), PhaseStats::CREATE_GRAPH, "typer"); 211 PhaseStats typer_stats(info(), PhaseStats::CREATE_GRAPH, "typer");
215 typer.Run(&graph, info()->context()); 212 typer.Run();
216 } 213 }
217 // All new nodes must be typed.
218 typer.DecorateGraph(&graph);
219 { 214 {
220 // Lower JSOperators where we can determine types. 215 // Lower JSOperators where we can determine types.
221 PhaseStats lowering_stats(info(), PhaseStats::CREATE_GRAPH, 216 PhaseStats lowering_stats(info(), PhaseStats::CREATE_GRAPH,
222 "typed lowering"); 217 "typed lowering");
223 SourcePositionTable::Scope pos(&source_positions, 218 SourcePositionTable::Scope pos(&source_positions,
224 SourcePosition::Unknown()); 219 SourcePosition::Unknown());
225 JSTypedLowering lowering(&jsgraph); 220 JSTypedLowering lowering(&jsgraph);
226 GraphReducer graph_reducer(&graph); 221 GraphReducer graph_reducer(&graph);
227 graph_reducer.AddReducer(&lowering); 222 graph_reducer.AddReducer(&lowering);
228 graph_reducer.ReduceGraph(); 223 graph_reducer.ReduceGraph();
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 } 354 }
360 355
361 356
362 void Pipeline::TearDown() { 357 void Pipeline::TearDown() {
363 InstructionOperand::TearDownCaches(); 358 InstructionOperand::TearDownCaches();
364 } 359 }
365 360
366 } // namespace compiler 361 } // namespace compiler
367 } // namespace internal 362 } // namespace internal
368 } // namespace v8 363 } // namespace v8
OLDNEW
« src/compiler/opcodes.h ('K') | « src/compiler/opcodes.h ('k') | src/compiler/schedule.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698