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

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

Issue 593563005: [turbofan] basic block profiler (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: another test Created 6 years, 2 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/basic-block-instrumentor.h"
9 #include "src/compiler/change-lowering.h" 10 #include "src/compiler/change-lowering.h"
10 #include "src/compiler/code-generator.h" 11 #include "src/compiler/code-generator.h"
11 #include "src/compiler/graph-replay.h" 12 #include "src/compiler/graph-replay.h"
12 #include "src/compiler/graph-visualizer.h" 13 #include "src/compiler/graph-visualizer.h"
13 #include "src/compiler/instruction.h" 14 #include "src/compiler/instruction.h"
14 #include "src/compiler/instruction-selector.h" 15 #include "src/compiler/instruction-selector.h"
15 #include "src/compiler/js-context-specialization.h" 16 #include "src/compiler/js-context-specialization.h"
16 #include "src/compiler/js-generic-lowering.h" 17 #include "src/compiler/js-generic-lowering.h"
17 #include "src/compiler/js-inlining.h" 18 #include "src/compiler/js-inlining.h"
18 #include "src/compiler/js-typed-lowering.h" 19 #include "src/compiler/js-typed-lowering.h"
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 SourcePositionTable::Scope pos(&source_positions, 296 SourcePositionTable::Scope pos(&source_positions,
296 SourcePosition::Unknown()); 297 SourcePosition::Unknown());
297 JSGenericLowering lowering(info(), &jsgraph); 298 JSGenericLowering lowering(info(), &jsgraph);
298 GraphReducer graph_reducer(&graph); 299 GraphReducer graph_reducer(&graph);
299 graph_reducer.AddReducer(&lowering); 300 graph_reducer.AddReducer(&lowering);
300 graph_reducer.ReduceGraph(); 301 graph_reducer.ReduceGraph();
301 302
302 VerifyAndPrintGraph(&graph, "Lowered generic"); 303 VerifyAndPrintGraph(&graph, "Lowered generic");
303 } 304 }
304 305
306 source_positions.RemoveDecorator();
307
305 { 308 {
306 // Compute a schedule. 309 // Compute a schedule.
307 Schedule* schedule = ComputeSchedule(&graph); 310 Schedule* schedule = ComputeSchedule(&graph);
308 // Generate optimized code. 311 // Generate optimized code.
309 PhaseStats codegen_stats(info(), PhaseStats::CODEGEN, "codegen"); 312 PhaseStats codegen_stats(info(), PhaseStats::CODEGEN, "codegen");
310 Linkage linkage(info()); 313 Linkage linkage(info());
311 code = GenerateCode(&linkage, &graph, schedule, &source_positions); 314 code = GenerateCode(&linkage, &graph, schedule, &source_positions);
312 info()->SetCode(code); 315 info()->SetCode(code);
313 } 316 }
314 317
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 364
362 365
363 Handle<Code> Pipeline::GenerateCode(Linkage* linkage, Graph* graph, 366 Handle<Code> Pipeline::GenerateCode(Linkage* linkage, Graph* graph,
364 Schedule* schedule, 367 Schedule* schedule,
365 SourcePositionTable* source_positions) { 368 SourcePositionTable* source_positions) {
366 DCHECK_NOT_NULL(graph); 369 DCHECK_NOT_NULL(graph);
367 DCHECK_NOT_NULL(linkage); 370 DCHECK_NOT_NULL(linkage);
368 DCHECK_NOT_NULL(schedule); 371 DCHECK_NOT_NULL(schedule);
369 CHECK(SupportedBackend()); 372 CHECK(SupportedBackend());
370 373
374 BasicBlockProfiler::Data* profiler_data = NULL;
375 if (FLAG_turbo_profiling) {
376 profiler_data = BasicBlockInstrumentor::Instrument(info_, graph, schedule);
377 }
378
371 InstructionSequence sequence(linkage, graph, schedule); 379 InstructionSequence sequence(linkage, graph, schedule);
372 380
373 // Select and schedule instructions covering the scheduled graph. 381 // Select and schedule instructions covering the scheduled graph.
374 { 382 {
375 InstructionSelector selector(&sequence, source_positions); 383 InstructionSelector selector(&sequence, source_positions);
376 selector.SelectInstructions(); 384 selector.SelectInstructions();
377 } 385 }
378 386
379 if (FLAG_trace_turbo) { 387 if (FLAG_trace_turbo) {
380 OFStream os(stdout); 388 OFStream os(stdout);
(...skipping 16 matching lines...) Expand all
397 } 405 }
398 406
399 if (FLAG_trace_turbo) { 407 if (FLAG_trace_turbo) {
400 OFStream os(stdout); 408 OFStream os(stdout);
401 os << "----- Instruction sequence after register allocation -----\n" 409 os << "----- Instruction sequence after register allocation -----\n"
402 << sequence; 410 << sequence;
403 } 411 }
404 412
405 // Generate native sequence. 413 // Generate native sequence.
406 CodeGenerator generator(&sequence); 414 CodeGenerator generator(&sequence);
407 return generator.GenerateCode(); 415 Handle<Code> code = generator.GenerateCode();
416 if (profiler_data != NULL) {
417 #if ENABLE_DISASSEMBLER
418 OStringStream os;
419 code->Disassemble(NULL, os);
420 profiler_data->SetCode(&os);
421 #endif
422 }
423 return code;
408 } 424 }
409 425
410 426
411 void Pipeline::SetUp() { 427 void Pipeline::SetUp() {
412 InstructionOperand::SetUpCaches(); 428 InstructionOperand::SetUpCaches();
413 } 429 }
414 430
415 431
416 void Pipeline::TearDown() { 432 void Pipeline::TearDown() {
417 InstructionOperand::TearDownCaches(); 433 InstructionOperand::TearDownCaches();
418 } 434 }
419 435
420 } // namespace compiler 436 } // namespace compiler
421 } // namespace internal 437 } // namespace internal
422 } // namespace v8 438 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698