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

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

Issue 679793003: [turbofan] reduce allocations outside of pipeline (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/mips/code-generator-mips.cc ('k') | src/compiler/x64/code-generator-x64.cc » ('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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 graph_reducer.AddReducer(&simple_reducer); 390 graph_reducer.AddReducer(&simple_reducer);
391 graph_reducer.ReduceGraph(); 391 graph_reducer.ReduceGraph();
392 392
393 VerifyAndPrintGraph(data.graph(), "Lowered simplified"); 393 VerifyAndPrintGraph(data.graph(), "Lowered simplified");
394 } 394 }
395 { 395 {
396 // Lower changes that have been inserted before. 396 // Lower changes that have been inserted before.
397 PhaseScope phase_scope(pipeline_statistics.get(), "change lowering"); 397 PhaseScope phase_scope(pipeline_statistics.get(), "change lowering");
398 SourcePositionTable::Scope pos(data.source_positions(), 398 SourcePositionTable::Scope pos(data.source_positions(),
399 SourcePosition::Unknown()); 399 SourcePosition::Unknown());
400 Linkage linkage(info()); 400 Linkage linkage(data.graph_zone(), info());
401 ValueNumberingReducer vn_reducer(data.graph_zone()); 401 ValueNumberingReducer vn_reducer(data.graph_zone());
402 SimplifiedOperatorReducer simple_reducer(data.jsgraph()); 402 SimplifiedOperatorReducer simple_reducer(data.jsgraph());
403 ChangeLowering lowering(data.jsgraph(), &linkage); 403 ChangeLowering lowering(data.jsgraph(), &linkage);
404 MachineOperatorReducer mach_reducer(data.jsgraph()); 404 MachineOperatorReducer mach_reducer(data.jsgraph());
405 GraphReducer graph_reducer(data.graph()); 405 GraphReducer graph_reducer(data.graph());
406 // TODO(titzer): Figure out if we should run all reducers at once here. 406 // TODO(titzer): Figure out if we should run all reducers at once here.
407 graph_reducer.AddReducer(&vn_reducer); 407 graph_reducer.AddReducer(&vn_reducer);
408 graph_reducer.AddReducer(&simple_reducer); 408 graph_reducer.AddReducer(&simple_reducer);
409 graph_reducer.AddReducer(&lowering); 409 graph_reducer.AddReducer(&lowering);
410 graph_reducer.AddReducer(&mach_reducer); 410 graph_reducer.AddReducer(&mach_reducer);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 } 445 }
446 446
447 data.source_positions()->RemoveDecorator(); 447 data.source_positions()->RemoveDecorator();
448 448
449 // Compute a schedule. 449 // Compute a schedule.
450 ComputeSchedule(&data); 450 ComputeSchedule(&data);
451 451
452 Handle<Code> code = Handle<Code>::null(); 452 Handle<Code> code = Handle<Code>::null();
453 { 453 {
454 // Generate optimized code. 454 // Generate optimized code.
455 Linkage linkage(info()); 455 Linkage linkage(data.instruction_zone(), info());
456 code = GenerateCode(&linkage, &data); 456 code = GenerateCode(&linkage, &data);
457 info()->SetCode(code); 457 info()->SetCode(code);
458 } 458 }
459 459
460 // Print optimized code. 460 // Print optimized code.
461 v8::internal::CodeGenerator::PrintCode(code, info()); 461 v8::internal::CodeGenerator::PrintCode(code, info());
462 462
463 if (FLAG_trace_turbo) { 463 if (FLAG_trace_turbo) {
464 OFStream os(stdout); 464 OFStream os(stdout);
465 os << "--------------------------------------------------\n" 465 os << "--------------------------------------------------\n"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 545
546 if (data->pipeline_statistics() != NULL) { 546 if (data->pipeline_statistics() != NULL) {
547 data->pipeline_statistics()->BeginPhaseKind("register allocation"); 547 data->pipeline_statistics()->BeginPhaseKind("register allocation");
548 } 548 }
549 549
550 // Allocate registers. 550 // Allocate registers.
551 Frame frame; 551 Frame frame;
552 { 552 {
553 int node_count = sequence.VirtualRegisterCount(); 553 int node_count = sequence.VirtualRegisterCount();
554 if (node_count > UnallocatedOperand::kMaxVirtualRegisters) { 554 if (node_count > UnallocatedOperand::kMaxVirtualRegisters) {
555 linkage->info()->AbortOptimization(kNotEnoughVirtualRegistersForValues); 555 info()->AbortOptimization(kNotEnoughVirtualRegistersForValues);
556 return Handle<Code>::null(); 556 return Handle<Code>::null();
557 } 557 }
558 ZonePool::Scope zone_scope(data->zone_pool()); 558 ZonePool::Scope zone_scope(data->zone_pool());
559 RegisterAllocator allocator(zone_scope.zone(), &frame, linkage->info(), 559 RegisterAllocator allocator(zone_scope.zone(), &frame, info(), &sequence);
560 &sequence);
561 if (!allocator.Allocate(data->pipeline_statistics())) { 560 if (!allocator.Allocate(data->pipeline_statistics())) {
562 linkage->info()->AbortOptimization(kNotEnoughVirtualRegistersRegalloc); 561 info()->AbortOptimization(kNotEnoughVirtualRegistersRegalloc);
563 return Handle<Code>::null(); 562 return Handle<Code>::null();
564 } 563 }
565 if (FLAG_trace_turbo) { 564 if (FLAG_trace_turbo) {
566 TurboCfgFile tcf(isolate()); 565 TurboCfgFile tcf(isolate());
567 tcf << AsC1VAllocator("CodeGen", &allocator); 566 tcf << AsC1VAllocator("CodeGen", &allocator);
568 } 567 }
569 } 568 }
570 569
571 if (FLAG_trace_turbo) { 570 if (FLAG_trace_turbo) {
572 OFStream os(stdout); 571 OFStream os(stdout);
573 os << "----- Instruction sequence after register allocation -----\n" 572 os << "----- Instruction sequence after register allocation -----\n"
574 << sequence; 573 << sequence;
575 } 574 }
576 575
577 if (data->pipeline_statistics() != NULL) { 576 if (data->pipeline_statistics() != NULL) {
578 data->pipeline_statistics()->BeginPhaseKind("code generation"); 577 data->pipeline_statistics()->BeginPhaseKind("code generation");
579 } 578 }
580 579
581 // Generate native sequence. 580 // Generate native sequence.
582 Handle<Code> code; 581 Handle<Code> code;
583 { 582 {
584 PhaseScope phase_scope(data->pipeline_statistics(), "generate code"); 583 PhaseScope phase_scope(data->pipeline_statistics(), "generate code");
585 CodeGenerator generator(&frame, linkage, &sequence); 584 CodeGenerator generator(&frame, linkage, &sequence, info());
586 code = generator.GenerateCode(); 585 code = generator.GenerateCode();
587 } 586 }
588 if (profiler_data != NULL) { 587 if (profiler_data != NULL) {
589 #if ENABLE_DISASSEMBLER 588 #if ENABLE_DISASSEMBLER
590 std::ostringstream os; 589 std::ostringstream os;
591 code->Disassemble(NULL, os); 590 code->Disassemble(NULL, os);
592 profiler_data->SetCode(&os); 591 profiler_data->SetCode(&os);
593 #endif 592 #endif
594 } 593 }
595 return code; 594 return code;
596 } 595 }
597 596
598 597
599 void Pipeline::SetUp() { 598 void Pipeline::SetUp() {
600 InstructionOperand::SetUpCaches(); 599 InstructionOperand::SetUpCaches();
601 } 600 }
602 601
603 602
604 void Pipeline::TearDown() { 603 void Pipeline::TearDown() {
605 InstructionOperand::TearDownCaches(); 604 InstructionOperand::TearDownCaches();
606 } 605 }
607 606
608 } // namespace compiler 607 } // namespace compiler
609 } // namespace internal 608 } // namespace internal
610 } // namespace v8 609 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips/code-generator-mips.cc ('k') | src/compiler/x64/code-generator-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698