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

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

Issue 726513002: [turbofan] Smartify the GraphReducer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE Created 6 years, 1 month 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
« no previous file with comments | « src/compiler/graph-reducer.cc ('k') | src/zone-containers.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <fstream> // NOLINT(readability/streams) 7 #include <fstream> // NOLINT(readability/streams)
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/base/platform/elapsed-timer.h" 10 #include "src/base/platform/elapsed-timer.h"
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 } 377 }
378 378
379 if (!pipeline_statistics.is_empty()) { 379 if (!pipeline_statistics.is_empty()) {
380 pipeline_statistics->BeginPhaseKind("lowering"); 380 pipeline_statistics->BeginPhaseKind("lowering");
381 } 381 }
382 382
383 if (info()->is_typing_enabled()) { 383 if (info()->is_typing_enabled()) {
384 { 384 {
385 // Lower JSOperators where we can determine types. 385 // Lower JSOperators where we can determine types.
386 PhaseScope phase_scope(pipeline_statistics.get(), "typed lowering"); 386 PhaseScope phase_scope(pipeline_statistics.get(), "typed lowering");
387 ZonePool::Scope zone_scope(data.zone_pool());
387 SourcePositionTable::Scope pos(data.source_positions(), 388 SourcePositionTable::Scope pos(data.source_positions(),
388 SourcePosition::Unknown()); 389 SourcePosition::Unknown());
389 ValueNumberingReducer vn_reducer(data.graph_zone()); 390 ValueNumberingReducer vn_reducer(data.graph_zone());
390 JSTypedLowering lowering(data.jsgraph()); 391 JSTypedLowering lowering(data.jsgraph());
391 SimplifiedOperatorReducer simple_reducer(data.jsgraph()); 392 SimplifiedOperatorReducer simple_reducer(data.jsgraph());
392 GraphReducer graph_reducer(data.graph()); 393 GraphReducer graph_reducer(data.graph(), zone_scope.zone());
393 graph_reducer.AddReducer(&vn_reducer); 394 graph_reducer.AddReducer(&vn_reducer);
394 graph_reducer.AddReducer(&lowering); 395 graph_reducer.AddReducer(&lowering);
395 graph_reducer.AddReducer(&simple_reducer); 396 graph_reducer.AddReducer(&simple_reducer);
396 graph_reducer.ReduceGraph(); 397 graph_reducer.ReduceGraph();
397 398
398 VerifyAndPrintGraph(data.graph(), "Lowered typed"); 399 VerifyAndPrintGraph(data.graph(), "Lowered typed");
399 } 400 }
400 { 401 {
401 // Lower simplified operators and insert changes. 402 // Lower simplified operators and insert changes.
402 PhaseScope phase_scope(pipeline_statistics.get(), "simplified lowering"); 403 PhaseScope phase_scope(pipeline_statistics.get(), "simplified lowering");
404 ZonePool::Scope zone_scope(data.zone_pool());
403 SourcePositionTable::Scope pos(data.source_positions(), 405 SourcePositionTable::Scope pos(data.source_positions(),
404 SourcePosition::Unknown()); 406 SourcePosition::Unknown());
405 SimplifiedLowering lowering(data.jsgraph()); 407 SimplifiedLowering lowering(data.jsgraph());
406 lowering.LowerAllNodes(); 408 lowering.LowerAllNodes();
407 ValueNumberingReducer vn_reducer(data.graph_zone()); 409 ValueNumberingReducer vn_reducer(data.graph_zone());
408 SimplifiedOperatorReducer simple_reducer(data.jsgraph()); 410 SimplifiedOperatorReducer simple_reducer(data.jsgraph());
409 GraphReducer graph_reducer(data.graph()); 411 GraphReducer graph_reducer(data.graph(), zone_scope.zone());
410 graph_reducer.AddReducer(&vn_reducer); 412 graph_reducer.AddReducer(&vn_reducer);
411 graph_reducer.AddReducer(&simple_reducer); 413 graph_reducer.AddReducer(&simple_reducer);
412 graph_reducer.ReduceGraph(); 414 graph_reducer.ReduceGraph();
413 415
414 VerifyAndPrintGraph(data.graph(), "Lowered simplified"); 416 VerifyAndPrintGraph(data.graph(), "Lowered simplified");
415 } 417 }
416 { 418 {
417 // Lower changes that have been inserted before. 419 // Lower changes that have been inserted before.
418 PhaseScope phase_scope(pipeline_statistics.get(), "change lowering"); 420 PhaseScope phase_scope(pipeline_statistics.get(), "change lowering");
421 ZonePool::Scope zone_scope(data.zone_pool());
419 SourcePositionTable::Scope pos(data.source_positions(), 422 SourcePositionTable::Scope pos(data.source_positions(),
420 SourcePosition::Unknown()); 423 SourcePosition::Unknown());
421 Linkage linkage(data.graph_zone(), info()); 424 Linkage linkage(data.graph_zone(), info());
422 ValueNumberingReducer vn_reducer(data.graph_zone()); 425 ValueNumberingReducer vn_reducer(data.graph_zone());
423 SimplifiedOperatorReducer simple_reducer(data.jsgraph()); 426 SimplifiedOperatorReducer simple_reducer(data.jsgraph());
424 ChangeLowering lowering(data.jsgraph(), &linkage); 427 ChangeLowering lowering(data.jsgraph(), &linkage);
425 MachineOperatorReducer mach_reducer(data.jsgraph()); 428 MachineOperatorReducer mach_reducer(data.jsgraph());
426 GraphReducer graph_reducer(data.graph()); 429 GraphReducer graph_reducer(data.graph(), zone_scope.zone());
427 // TODO(titzer): Figure out if we should run all reducers at once here. 430 // TODO(titzer): Figure out if we should run all reducers at once here.
428 graph_reducer.AddReducer(&vn_reducer); 431 graph_reducer.AddReducer(&vn_reducer);
429 graph_reducer.AddReducer(&simple_reducer); 432 graph_reducer.AddReducer(&simple_reducer);
430 graph_reducer.AddReducer(&lowering); 433 graph_reducer.AddReducer(&lowering);
431 graph_reducer.AddReducer(&mach_reducer); 434 graph_reducer.AddReducer(&mach_reducer);
432 graph_reducer.ReduceGraph(); 435 graph_reducer.ReduceGraph();
433 436
434 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. 437 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works.
435 VerifyAndPrintGraph(data.graph(), "Lowered changes", true); 438 VerifyAndPrintGraph(data.graph(), "Lowered changes", true);
436 } 439 }
437 440
438 { 441 {
439 PhaseScope phase_scope(pipeline_statistics.get(), 442 PhaseScope phase_scope(pipeline_statistics.get(),
440 "late control reduction"); 443 "late control reduction");
441 SourcePositionTable::Scope pos(data.source_positions(), 444 SourcePositionTable::Scope pos(data.source_positions(),
442 SourcePosition::Unknown()); 445 SourcePosition::Unknown());
443 ZonePool::Scope zone_scope(data.zone_pool()); 446 ZonePool::Scope zone_scope(data.zone_pool());
444 ControlReducer::ReduceGraph(zone_scope.zone(), data.jsgraph(), 447 ControlReducer::ReduceGraph(zone_scope.zone(), data.jsgraph(),
445 data.common()); 448 data.common());
446 449
447 VerifyAndPrintGraph(data.graph(), "Late Control reduced"); 450 VerifyAndPrintGraph(data.graph(), "Late Control reduced");
448 } 451 }
449 } 452 }
450 453
451 { 454 {
452 // Lower any remaining generic JSOperators. 455 // Lower any remaining generic JSOperators.
453 PhaseScope phase_scope(pipeline_statistics.get(), "generic lowering"); 456 PhaseScope phase_scope(pipeline_statistics.get(), "generic lowering");
457 ZonePool::Scope zone_scope(data.zone_pool());
454 SourcePositionTable::Scope pos(data.source_positions(), 458 SourcePositionTable::Scope pos(data.source_positions(),
455 SourcePosition::Unknown()); 459 SourcePosition::Unknown());
456 JSGenericLowering generic(info(), data.jsgraph()); 460 JSGenericLowering generic(info(), data.jsgraph());
457 SelectLowering select(data.jsgraph()->graph(), data.jsgraph()->common()); 461 SelectLowering select(data.jsgraph()->graph(), data.jsgraph()->common());
458 GraphReducer graph_reducer(data.graph()); 462 GraphReducer graph_reducer(data.graph(), zone_scope.zone());
459 graph_reducer.AddReducer(&generic); 463 graph_reducer.AddReducer(&generic);
460 graph_reducer.AddReducer(&select); 464 graph_reducer.AddReducer(&select);
461 graph_reducer.ReduceGraph(); 465 graph_reducer.ReduceGraph();
462 466
463 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works. 467 // TODO(jarin, rossberg): Remove UNTYPED once machine typing works.
464 VerifyAndPrintGraph(data.graph(), "Lowered generic", true); 468 VerifyAndPrintGraph(data.graph(), "Lowered generic", true);
465 } 469 }
466 470
467 if (!pipeline_statistics.is_empty()) { 471 if (!pipeline_statistics.is_empty()) {
468 pipeline_statistics->BeginPhaseKind("block building"); 472 pipeline_statistics->BeginPhaseKind("block building");
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 } 655 }
652 656
653 657
654 void Pipeline::TearDown() { 658 void Pipeline::TearDown() {
655 InstructionOperand::TearDownCaches(); 659 InstructionOperand::TearDownCaches();
656 } 660 }
657 661
658 } // namespace compiler 662 } // namespace compiler
659 } // namespace internal 663 } // namespace internal
660 } // namespace v8 664 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/graph-reducer.cc ('k') | src/zone-containers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698