| 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 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 CompilationInfoWithZone info(function); | 838 CompilationInfoWithZone info(function); |
| 839 Handle<Code> result; | 839 Handle<Code> result; |
| 840 ASSIGN_RETURN_ON_EXCEPTION(info.isolate(), result, | 840 ASSIGN_RETURN_ON_EXCEPTION(info.isolate(), result, |
| 841 GetUnoptimizedCodeCommon(&info), | 841 GetUnoptimizedCodeCommon(&info), |
| 842 Code); | 842 Code); |
| 843 return result; | 843 return result; |
| 844 } | 844 } |
| 845 | 845 |
| 846 | 846 |
| 847 MaybeHandle<Code> Compiler::GetLazyCode(Handle<JSFunction> function) { | 847 MaybeHandle<Code> Compiler::GetLazyCode(Handle<JSFunction> function) { |
| 848 DCHECK(!function->GetIsolate()->has_pending_exception()); | 848 Isolate* isolate = function->GetIsolate(); |
| 849 DCHECK(!isolate->has_pending_exception()); |
| 849 DCHECK(!function->is_compiled()); | 850 DCHECK(!function->is_compiled()); |
| 850 | 851 // If the debugger is active, do not compile with turbofan unless we can |
| 851 if (FLAG_turbo_asm && function->shared()->asm_function()) { | 852 // deopt from turbofan code. |
| 853 if (FLAG_turbo_asm && function->shared()->asm_function() && |
| 854 (FLAG_turbo_deoptimization || !isolate->debug()->is_active())) { |
| 852 CompilationInfoWithZone info(function); | 855 CompilationInfoWithZone info(function); |
| 853 | 856 |
| 854 VMState<COMPILER> state(info.isolate()); | 857 VMState<COMPILER> state(isolate); |
| 855 PostponeInterruptsScope postpone(info.isolate()); | 858 PostponeInterruptsScope postpone(isolate); |
| 856 | 859 |
| 857 info.SetOptimizing(BailoutId::None(), | 860 info.SetOptimizing(BailoutId::None(), |
| 858 Handle<Code>(function->shared()->code())); | 861 Handle<Code>(function->shared()->code())); |
| 859 | 862 |
| 860 info.MarkAsContextSpecializing(); | 863 info.MarkAsContextSpecializing(); |
| 861 info.MarkAsTypingEnabled(); | 864 info.MarkAsTypingEnabled(); |
| 862 info.MarkAsInliningDisabled(); | 865 info.MarkAsInliningDisabled(); |
| 863 | 866 |
| 864 if (GetOptimizedCodeNow(&info)) return info.code(); | 867 if (GetOptimizedCodeNow(&info)) { |
| 868 DCHECK(function->shared()->is_compiled()); |
| 869 return info.code(); |
| 870 } |
| 865 } | 871 } |
| 866 | 872 |
| 867 if (function->shared()->is_compiled()) { | 873 if (function->shared()->is_compiled()) { |
| 868 return Handle<Code>(function->shared()->code()); | 874 return Handle<Code>(function->shared()->code()); |
| 869 } | 875 } |
| 870 | 876 |
| 871 CompilationInfoWithZone info(function); | 877 CompilationInfoWithZone info(function); |
| 872 Handle<Code> result; | 878 Handle<Code> result; |
| 873 ASSIGN_RETURN_ON_EXCEPTION(info.isolate(), result, | 879 ASSIGN_RETURN_ON_EXCEPTION(isolate, result, GetUnoptimizedCodeCommon(&info), |
| 874 GetUnoptimizedCodeCommon(&info), Code); | 880 Code); |
| 875 | 881 |
| 876 if (FLAG_always_opt && | 882 if (FLAG_always_opt && isolate->use_crankshaft() && |
| 877 info.isolate()->use_crankshaft() && | |
| 878 !info.shared_info()->optimization_disabled() && | 883 !info.shared_info()->optimization_disabled() && |
| 879 !info.isolate()->DebuggerHasBreakPoints()) { | 884 !isolate->DebuggerHasBreakPoints()) { |
| 880 Handle<Code> opt_code; | 885 Handle<Code> opt_code; |
| 881 if (Compiler::GetOptimizedCode( | 886 if (Compiler::GetOptimizedCode( |
| 882 function, result, | 887 function, result, |
| 883 Compiler::NOT_CONCURRENT).ToHandle(&opt_code)) { | 888 Compiler::NOT_CONCURRENT).ToHandle(&opt_code)) { |
| 884 result = opt_code; | 889 result = opt_code; |
| 885 } | 890 } |
| 886 } | 891 } |
| 887 | 892 |
| 888 return result; | 893 return result; |
| 889 } | 894 } |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 AllowHandleDereference allow_deref; | 1473 AllowHandleDereference allow_deref; |
| 1469 bool tracing_on = info()->IsStub() | 1474 bool tracing_on = info()->IsStub() |
| 1470 ? FLAG_trace_hydrogen_stubs | 1475 ? FLAG_trace_hydrogen_stubs |
| 1471 : (FLAG_trace_hydrogen && | 1476 : (FLAG_trace_hydrogen && |
| 1472 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1477 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
| 1473 return (tracing_on && | 1478 return (tracing_on && |
| 1474 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1479 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1475 } | 1480 } |
| 1476 | 1481 |
| 1477 } } // namespace v8::internal | 1482 } } // namespace v8::internal |
| OLD | NEW |