Index: runtime/vm/compiler.cc |
=================================================================== |
--- runtime/vm/compiler.cc (revision 44707) |
+++ runtime/vm/compiler.cc (working copy) |
@@ -973,6 +973,7 @@ |
TIMERSCOPE(isolate, time_compilation); |
Timer per_compile_timer(FLAG_trace_compiler, "Compilation time"); |
per_compile_timer.Start(); |
+ |
ParsedFunction* parsed_function = new(zone) ParsedFunction( |
thread, Function::ZoneHandle(zone, function.raw())); |
if (FLAG_trace_compiler) { |
@@ -1052,6 +1053,33 @@ |
} |
+void Compiler::EnsureUnoptimizedCode(Thread* thread, |
+ const Function& function) { |
+ if (function.unoptimized_code() != Object::null()) { |
+ return; |
+ } |
+ Code& original_code = Code::ZoneHandle(); |
srdjan
2015/04/02 17:43:40
pass thread->zone() to it.
Florian Schneider
2015/04/07 09:07:57
Done.
|
+ if (function.HasCode()) { |
+ original_code = function.CurrentCode(); |
+ } |
+ CompilationPipeline* pipeline = |
+ CompilationPipeline::New(thread->zone(), function); |
+ const Error& error = Error::Handle( |
+ CompileFunctionHelper(pipeline, function, false, Isolate::kNoDeoptId)); |
+ if (!error.IsNull()) { |
+ Exceptions::PropagateError(error); |
+ } |
+ if (!original_code.IsNull() && |
Ivan Posva
2015/04/02 17:14:00
This logic here is really hard to follow. Please e
Florian Schneider
2015/04/07 09:07:57
Done.
|
+ (original_code.raw() != function.CurrentCode())) { |
+ function.AttachCode(original_code); |
+ } |
+ ASSERT(function.unoptimized_code() != Object::null()); |
+ if (FLAG_trace_compiler) { |
+ ISL_Print("Ensure unoptimized code for %s\n", function.ToCString()); |
+ } |
+} |
+ |
+ |
RawError* Compiler::CompileOptimizedFunction(Thread* thread, |
const Function& function, |
intptr_t osr_id) { |