46 size_(info->zone()->allocation_size()) {
47 if (FLAG_turbo_stats) {
53 if (FLAG_turbo_stats) {
54 base::TimeDelta delta =
timer_.Elapsed();
57 stats->SaveTiming(
name_, delta,
static_cast<int>(bytes));
61 stats->IncrementCreateGraph(delta);
64 stats->IncrementOptimizeGraph(delta);
67 stats->IncrementGenerateCode(delta);
86 return FLAG_turbo_verify;
92 if (FLAG_trace_turbo) {
98 if (strlen(functionname.
get()) > 0) {
99 SNPrintF(filename,
"turbo-%s-%s", functionname.
get(), phase);
101 SNPrintF(filename,
"turbo-%p-%s",
static_cast<void*
>(
info_), phase);
104 SNPrintF(filename,
"turbo-none-%s", phase);
109 char dot_buffer[256];
110 Vector<char> dot_filename(dot_buffer,
sizeof(dot_buffer));
114 dot_of <<
AsDOT(*graph);
117 char json_buffer[256];
118 Vector<char> json_filename(json_buffer,
sizeof(json_buffer));
122 json_of <<
AsJSON(*graph);
126 os <<
"-- " << phase <<
" graph printed to file " << filename.
start()
136 SourcePositionTable* source_positions)
141 SourcePosition::Unknown());
145 #define DEF_VISIT(type) \
146 virtual void Visit##type(type* node) OVERRIDE { \
147 SourcePositionTable::Scope pos(source_positions_, \
148 SourcePosition(node->position())); \
149 AstGraphBuilder::Visit##type(node); \
160 if (!FLAG_trace_turbo)
return;
162 os <<
"-- Schedule --------------------------------------\n" << *schedule;
167 if (
info()->
function()->dont_optimize_reason() == kTryCatchStatement ||
168 info()->
function()->dont_optimize_reason() == kTryFinallyStatement ||
170 info()->
function()->dont_optimize_reason() == kForOfStatement ||
172 info()->
function()->dont_optimize_reason() == kSuperReference ||
180 if (FLAG_trace_turbo) {
182 os <<
"---------------------------------------------------\n"
183 <<
"Begin compiling method "
185 <<
" using Turbofan" <<
endl;
190 SourcePositionTable source_positions(&graph);
191 source_positions.AddDecorator();
196 MachineOperatorBuilder machine;
197 CommonOperatorBuilder common(
zone());
199 JSGraph jsgraph(&graph, &common, &javascript, &typer, &machine);
212 PhiReducer phi_reducer;
213 GraphReducer graph_reducer(&graph);
214 graph_reducer.AddReducer(&phi_reducer);
215 graph_reducer.ReduceGraph();
217 graph_reducer.ReduceGraph();
218 graph_reducer.ReduceGraph();
223 if (
info()->is_context_specializing()) {
224 SourcePositionTable::Scope pos(&source_positions,
225 SourcePosition::Unknown());
232 if (
info()->is_inlining_enabled()) {
233 SourcePositionTable::Scope pos(&source_positions,
234 SourcePosition::Unknown());
241 if (FLAG_print_turbo_replay) {
242 GraphReplayPrinter::PrintReplay(&graph);
248 if (
info()->is_typing_enabled()) {
252 typer.
Run(&graph,
info()->context());
261 SourcePositionTable::Scope pos(&source_positions,
262 SourcePosition::Unknown());
263 JSTypedLowering lowering(&jsgraph);
264 GraphReducer graph_reducer(&graph);
265 graph_reducer.AddReducer(&lowering);
266 graph_reducer.ReduceGraph();
273 "simplified lowering");
274 SourcePositionTable::Scope pos(&source_positions,
275 SourcePosition::Unknown());
285 SourcePositionTable::Scope pos(&source_positions,
286 SourcePosition::Unknown());
290 SimplifiedOperatorReducer simple_reducer(&jsgraph);
291 ChangeLowering lowering(&jsgraph, &linkage);
292 MachineOperatorReducer mach_reducer(&jsgraph);
293 GraphReducer graph_reducer(&graph);
296 graph_reducer.AddReducer(&simple_reducer);
297 graph_reducer.AddReducer(&lowering);
298 graph_reducer.AddReducer(&mach_reducer);
299 graph_reducer.ReduceGraph();
309 SourcePositionTable::Scope pos(&source_positions,
310 SourcePosition::Unknown());
312 GraphReducer graph_reducer(&graph);
313 graph_reducer.AddReducer(&lowering);
314 graph_reducer.ReduceGraph();
319 source_positions.RemoveDecorator();
328 code =
GenerateCode(&linkage, &graph, schedule, &source_positions);
335 if (FLAG_trace_turbo) {
337 os <<
"--------------------------------------------------\n"
338 <<
"Finished compiling method "
340 <<
" using Turbofan" <<
endl;
360 if (schedule ==
NULL) {
366 SourcePositionTable source_positions(graph);
368 #if ENABLE_DISASSEMBLER
369 if (!code.
is_null() && FLAG_print_opt_code) {
370 CodeTracer::Scope tracing_scope(
isolate()->GetCodeTracer());
372 code->Disassemble(
"test code", os);
381 SourcePositionTable* source_positions) {
388 if (FLAG_turbo_profiling) {
396 InstructionSelector selector(&sequence, source_positions);
397 selector.SelectInstructions();
400 if (FLAG_trace_turbo) {
402 os <<
"----- Instruction sequence before register allocation -----\n"
413 RegisterAllocator allocator(&sequence);
414 if (!allocator.Allocate()) {
420 if (FLAG_trace_turbo) {
422 os <<
"----- Instruction sequence after register allocation -----\n"
429 if (profiler_data !=
NULL) {
430 #if ENABLE_DISASSEMBLER
432 code->Disassemble(
NULL, os);
static FILE * FOpen(const char *path, const char *mode)
void SetCode(OStringStream *os)
static void PrintCode(Handle< Code > code, CompilationInfo *info)
void SetCode(Handle< Code > code)
void AbortOptimization(BailoutReason reason)
FunctionLiteral * function() const
Isolate * isolate() const
Handle< SharedFunctionInfo > shared_info() const
static Handle< T > null()
HStatistics * GetTStatistics()
unsigned allocation_size() const
AstGraphBuilderWithPositions(CompilationInfo *info, JSGraph *jsgraph, SourcePositionTable *source_positions)
SourcePositionTable * source_positions_
Node * GetFunctionContext()
static BasicBlockProfiler::Data * Instrument(CompilationInfo *info, Graph *graph, Schedule *schedule)
static void TearDownCaches()
static void SetUpCaches()
void SpecializeToContext()
CompilationInfo * info() const
base::ElapsedTimer timer_
PhaseStats(CompilationInfo *info, PhaseKind kind, const char *name)
Handle< Code > GenerateCode()
CompilationInfo * info() const
static bool SupportedBackend()
Schedule * ComputeSchedule(Graph *graph)
static bool SupportedTarget()
Handle< Code > GenerateCodeForMachineGraph(Linkage *linkage, Graph *graph, Schedule *schedule=NULL)
void VerifyAndPrintGraph(Graph *graph, const char *phase)
static void Run(Schedule *schedule)
static Schedule * ComputeSchedule(Graph *graph)
void Run(Graph *graph, MaybeHandle< Context > context)
void DecorateGraph(Graph *graph)
static const int kMaxVirtualRegisters
static void Run(Graph *graph)
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define DCHECK_NOT_NULL(p)
static void TraceSchedule(Schedule *schedule)
static bool VerifyGraphs()
OStream & endl(OStream &os)
int SNPrintF(Vector< char > str, const char *format,...)
Debugger support for the V8 JavaScript engine.