Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index 644f7e9022e6a4066664782dc986b33168787dd7..32ba947928193073c19a0c16acb079790ede6368 100644 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -623,6 +623,7 @@ static void SetFunctionInfo(Handle<SharedFunctionInfo> function_info, |
function_info->set_bailout_reason(lit->dont_optimize_reason()); |
function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); |
function_info->set_kind(lit->kind()); |
+ function_info->set_asm_function(lit->scope()->asm_function()); |
} |
@@ -729,6 +730,38 @@ MaybeHandle<Code> Compiler::GetUnoptimizedCode(Handle<JSFunction> function) { |
MaybeHandle<Code> Compiler::GetLazyCode(Handle<JSFunction> function) { |
DCHECK(!function->GetIsolate()->has_pending_exception()); |
DCHECK(!function->is_compiled()); |
+ |
+ if (FLAG_turbo_asm && function->shared()->asm_function()) { |
+ CompilationInfoWithZone info(function); |
+ |
+ VMState<COMPILER> state(info.isolate()); |
+ PostponeInterruptsScope postpone(info.isolate()); |
+ |
+ if (FLAG_trace_opt) { |
+ // TODO(titzer): record and report full stats here. |
+ PrintF("[optimizing asm "); |
+ function->ShortPrint(); |
+ PrintF("]\n"); |
+ } |
+ |
+ if (!Parser::Parse(&info)) return MaybeHandle<Code>(); |
Michael Starzinger
2014/09/18 19:12:34
I don't particularly like this duplication, in fac
titzer
2014/09/19 11:38:21
Agreed. We need to factor out into a routine to pa
|
+ if (!Rewriter::Rewrite(&info)) return MaybeHandle<Code>(); |
+ if (!Scope::Analyze(&info)) return MaybeHandle<Code>(); |
+ if (FLAG_turbo_deoptimization && !EnsureDeoptimizationSupport(&info)) { |
+ return MaybeHandle<Code>(); |
+ } |
+ |
+ info.SetOptimizing(BailoutId::None(), |
+ Handle<Code>(function->shared()->code())); |
+ |
+ info.MarkAsContextSpecializing(); |
+ info.MarkAsTypingEnabled(); |
+ info.MarkAsInliningDisabled(); |
+ compiler::Pipeline pipeline(&info); |
+ pipeline.GenerateCode(); |
+ if (!info.code().is_null()) return info.code(); |
+ } |
+ |
if (function->shared()->is_compiled()) { |
return Handle<Code>(function->shared()->code()); |
} |