| 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/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 VMState<COMPILER> state(isolate); | 860 VMState<COMPILER> state(isolate); |
| 861 PostponeInterruptsScope postpone(isolate); | 861 PostponeInterruptsScope postpone(isolate); |
| 862 | 862 |
| 863 info.SetOptimizing(BailoutId::None(), handle(function->shared()->code())); | 863 info.SetOptimizing(BailoutId::None(), handle(function->shared()->code())); |
| 864 info.MarkAsContextSpecializing(); | 864 info.MarkAsContextSpecializing(); |
| 865 | 865 |
| 866 if (GetOptimizedCodeNow(&info)) { | 866 if (GetOptimizedCodeNow(&info)) { |
| 867 DCHECK(function->shared()->is_compiled()); | 867 DCHECK(function->shared()->is_compiled()); |
| 868 return info.code(); | 868 return info.code(); |
| 869 } | 869 } |
| 870 // We have failed compilation. If there was an exception clear it so that |
| 871 // we can compile unoptimized code. |
| 872 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); |
| 870 } | 873 } |
| 871 | 874 |
| 872 if (function->shared()->is_compiled()) { | 875 if (function->shared()->is_compiled()) { |
| 873 return Handle<Code>(function->shared()->code()); | 876 return Handle<Code>(function->shared()->code()); |
| 874 } | 877 } |
| 875 | 878 |
| 876 CompilationInfoWithZone info(function); | 879 CompilationInfoWithZone info(function); |
| 877 Handle<Code> result; | 880 Handle<Code> result; |
| 878 ASSIGN_RETURN_ON_EXCEPTION(isolate, result, GetUnoptimizedCodeCommon(&info), | 881 ASSIGN_RETURN_ON_EXCEPTION(isolate, result, GetUnoptimizedCodeCommon(&info), |
| 879 Code); | 882 Code); |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1521 } | 1524 } |
| 1522 | 1525 |
| 1523 | 1526 |
| 1524 #if DEBUG | 1527 #if DEBUG |
| 1525 void CompilationInfo::PrintAstForTesting() { | 1528 void CompilationInfo::PrintAstForTesting() { |
| 1526 PrintF("--- Source from AST ---\n%s\n", | 1529 PrintF("--- Source from AST ---\n%s\n", |
| 1527 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1530 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
| 1528 } | 1531 } |
| 1529 #endif | 1532 #endif |
| 1530 } } // namespace v8::internal | 1533 } } // namespace v8::internal |
| OLD | NEW |