OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 | 8 |
9 #include "src/ast-numbering.h" | 9 #include "src/ast-numbering.h" |
10 #include "src/ast-this-access-visitor.h" | 10 #include "src/ast-this-access-visitor.h" |
11 #include "src/bootstrapper.h" | 11 #include "src/bootstrapper.h" |
12 #include "src/codegen.h" | 12 #include "src/codegen.h" |
13 #include "src/compilation-cache.h" | 13 #include "src/compilation-cache.h" |
14 #include "src/compiler/pipeline.h" | 14 #include "src/compiler/pipeline.h" |
15 #include "src/cpu-profiler.h" | 15 #include "src/cpu-profiler.h" |
16 #include "src/debug.h" | 16 #include "src/debug.h" |
17 #include "src/deoptimizer.h" | 17 #include "src/deoptimizer.h" |
18 #include "src/full-codegen.h" | 18 #include "src/full-codegen.h" |
19 #include "src/gdb-jit.h" | 19 #include "src/gdb-jit.h" |
20 #include "src/hydrogen.h" | 20 #include "src/hydrogen.h" |
21 #include "src/isolate-inl.h" | 21 #include "src/isolate-inl.h" |
22 #include "src/lithium.h" | 22 #include "src/lithium.h" |
23 #include "src/liveedit.h" | 23 #include "src/liveedit.h" |
24 #include "src/messages.h" | 24 #include "src/messages.h" |
25 #include "src/parser.h" | 25 #include "src/parser.h" |
| 26 #include "src/prettyprinter.h" |
26 #include "src/rewriter.h" | 27 #include "src/rewriter.h" |
27 #include "src/runtime-profiler.h" | 28 #include "src/runtime-profiler.h" |
28 #include "src/scanner-character-streams.h" | 29 #include "src/scanner-character-streams.h" |
29 #include "src/scopeinfo.h" | 30 #include "src/scopeinfo.h" |
30 #include "src/scopes.h" | 31 #include "src/scopes.h" |
31 #include "src/typing.h" | 32 #include "src/typing.h" |
32 #include "src/vm-state-inl.h" | 33 #include "src/vm-state-inl.h" |
33 | 34 |
34 namespace v8 { | 35 namespace v8 { |
35 namespace internal { | 36 namespace internal { |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 } | 406 } |
406 | 407 |
407 DCHECK(info()->shared_info()->has_deoptimization_support()); | 408 DCHECK(info()->shared_info()->has_deoptimization_support()); |
408 | 409 |
409 // Check the whitelist for TurboFan. | 410 // Check the whitelist for TurboFan. |
410 if ((FLAG_turbo_asm && info()->shared_info()->asm_function()) || | 411 if ((FLAG_turbo_asm && info()->shared_info()->asm_function()) || |
411 info()->closure()->PassesFilter(FLAG_turbo_filter)) { | 412 info()->closure()->PassesFilter(FLAG_turbo_filter)) { |
412 if (FLAG_trace_opt) { | 413 if (FLAG_trace_opt) { |
413 OFStream os(stdout); | 414 OFStream os(stdout); |
414 os << "[compiling method " << Brief(*info()->closure()) | 415 os << "[compiling method " << Brief(*info()->closure()) |
415 << " using TurboFan]" << std::endl; | 416 << " using TurboFan"; |
| 417 if (info()->is_osr()) os << " OSR"; |
| 418 os << "]" << std::endl; |
416 } | 419 } |
417 Timer t(this, &time_taken_to_create_graph_); | 420 Timer t(this, &time_taken_to_create_graph_); |
418 compiler::Pipeline pipeline(info()); | 421 compiler::Pipeline pipeline(info()); |
419 pipeline.GenerateCode(); | 422 pipeline.GenerateCode(); |
420 if (!info()->code().is_null()) { | 423 if (!info()->code().is_null()) { |
421 return SetLastStatus(SUCCEEDED); | 424 return SetLastStatus(SUCCEEDED); |
422 } | 425 } |
423 } | 426 } |
424 | 427 |
425 if (FLAG_trace_opt) { | 428 if (FLAG_trace_opt) { |
426 OFStream os(stdout); | 429 OFStream os(stdout); |
427 os << "[compiling method " << Brief(*info()->closure()) | 430 os << "[compiling method " << Brief(*info()->closure()) |
428 << " using Crankshaft]" << std::endl; | 431 << " using Crankshaft"; |
| 432 if (info()->is_osr()) os << " OSR"; |
| 433 os << "]" << std::endl; |
429 } | 434 } |
430 | 435 |
431 if (FLAG_trace_hydrogen) { | 436 if (FLAG_trace_hydrogen) { |
432 isolate()->GetHTracer()->TraceCompilation(info()); | 437 isolate()->GetHTracer()->TraceCompilation(info()); |
433 } | 438 } |
434 | 439 |
435 // Type-check the function. | 440 // Type-check the function. |
436 AstTyper::Run(info()); | 441 AstTyper::Run(info()); |
437 | 442 |
438 // Optimization could have been disabled by the parser. Note that this check | 443 // Optimization could have been disabled by the parser. Note that this check |
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1580 // character is in the FLAG_trace_phase command line parameter. | 1585 // character is in the FLAG_trace_phase command line parameter. |
1581 AllowHandleDereference allow_deref; | 1586 AllowHandleDereference allow_deref; |
1582 bool tracing_on = info()->IsStub() | 1587 bool tracing_on = info()->IsStub() |
1583 ? FLAG_trace_hydrogen_stubs | 1588 ? FLAG_trace_hydrogen_stubs |
1584 : (FLAG_trace_hydrogen && | 1589 : (FLAG_trace_hydrogen && |
1585 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1590 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
1586 return (tracing_on && | 1591 return (tracing_on && |
1587 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1592 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1588 } | 1593 } |
1589 | 1594 |
| 1595 |
| 1596 #if DEBUG |
| 1597 void CompilationInfo::PrintAstForTesting() { |
| 1598 PrintF("--- Source from AST ---\n%s\n", |
| 1599 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
| 1600 } |
| 1601 #endif |
1590 } } // namespace v8::internal | 1602 } } // namespace v8::internal |
OLD | NEW |