Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1004)

Unified Diff: runtime/vm/compiler.cc

Issue 1052563003: VM: Add infrastructure to support deferred generation of unoptimized code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698