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/compiler.h" | 5 #include "src/compiler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/ast/ast-numbering.h" | 9 #include "src/ast/ast-numbering.h" |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 // If the debugger is active, do not compile with turbofan unless we can | 1017 // If the debugger is active, do not compile with turbofan unless we can |
1018 // deopt from turbofan code. | 1018 // deopt from turbofan code. |
1019 if (FLAG_turbo_asm && function->shared()->asm_function() && | 1019 if (FLAG_turbo_asm && function->shared()->asm_function() && |
1020 (FLAG_turbo_asm_deoptimization || !isolate->debug()->is_active()) && | 1020 (FLAG_turbo_asm_deoptimization || !isolate->debug()->is_active()) && |
1021 !FLAG_turbo_osr) { | 1021 !FLAG_turbo_osr) { |
1022 CompilationInfoWithZone info(function); | 1022 CompilationInfoWithZone info(function); |
1023 | 1023 |
1024 VMState<COMPILER> state(isolate); | 1024 VMState<COMPILER> state(isolate); |
1025 PostponeInterruptsScope postpone(isolate); | 1025 PostponeInterruptsScope postpone(isolate); |
1026 | 1026 |
1027 info.SetOptimizing(BailoutId::None(), handle(function->shared()->code())); | 1027 info.SetOptimizing(); |
1028 | 1028 |
1029 if (GetOptimizedCodeNow(&info)) { | 1029 if (GetOptimizedCodeNow(&info)) { |
1030 DCHECK(function->shared()->is_compiled()); | 1030 DCHECK(function->shared()->is_compiled()); |
1031 return info.code(); | 1031 return info.code(); |
1032 } | 1032 } |
1033 // We have failed compilation. If there was an exception clear it so that | 1033 // We have failed compilation. If there was an exception clear it so that |
1034 // we can compile unoptimized code. | 1034 // we can compile unoptimized code. |
1035 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); | 1035 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); |
1036 } | 1036 } |
1037 | 1037 |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1764 if (shared->is_toplevel() && isolate->bootstrapper()->IsActive()) { | 1764 if (shared->is_toplevel() && isolate->bootstrapper()->IsActive()) { |
1765 return MaybeHandle<Code>(); | 1765 return MaybeHandle<Code>(); |
1766 } | 1766 } |
1767 | 1767 |
1768 base::SmartPointer<CompilationInfo> info( | 1768 base::SmartPointer<CompilationInfo> info( |
1769 new CompilationInfoWithZone(function)); | 1769 new CompilationInfoWithZone(function)); |
1770 VMState<COMPILER> state(isolate); | 1770 VMState<COMPILER> state(isolate); |
1771 DCHECK(!isolate->has_pending_exception()); | 1771 DCHECK(!isolate->has_pending_exception()); |
1772 PostponeInterruptsScope postpone(isolate); | 1772 PostponeInterruptsScope postpone(isolate); |
1773 | 1773 |
1774 info->SetOptimizing(osr_ast_id, current_code); | 1774 info->SetOptimizingForOsr(osr_ast_id, current_code); |
1775 | 1775 |
1776 if (mode == CONCURRENT) { | 1776 if (mode == CONCURRENT) { |
1777 if (GetOptimizedCodeLater(info.get())) { | 1777 if (GetOptimizedCodeLater(info.get())) { |
1778 info.Detach(); // The background recompile job owns this now. | 1778 info.Detach(); // The background recompile job owns this now. |
1779 return isolate->builtins()->InOptimizationQueue(); | 1779 return isolate->builtins()->InOptimizationQueue(); |
1780 } | 1780 } |
1781 } else { | 1781 } else { |
1782 info->set_osr_frame(osr_frame); | 1782 info->set_osr_frame(osr_frame); |
1783 if (GetOptimizedCodeNow(info.get())) return info->code(); | 1783 if (GetOptimizedCodeNow(info.get())) return info->code(); |
1784 } | 1784 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1868 } | 1868 } |
1869 | 1869 |
1870 #if DEBUG | 1870 #if DEBUG |
1871 void CompilationInfo::PrintAstForTesting() { | 1871 void CompilationInfo::PrintAstForTesting() { |
1872 PrintF("--- Source from AST ---\n%s\n", | 1872 PrintF("--- Source from AST ---\n%s\n", |
1873 PrettyPrinter(isolate()).PrintProgram(literal())); | 1873 PrettyPrinter(isolate()).PrintProgram(literal())); |
1874 } | 1874 } |
1875 #endif | 1875 #endif |
1876 } // namespace internal | 1876 } // namespace internal |
1877 } // namespace v8 | 1877 } // namespace v8 |
OLD | NEW |