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

Unified Diff: runtime/vm/compiler.cc

Issue 1414333014: Queueing fix, cleanups. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: d Created 5 years, 1 month 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
« no previous file with comments | « runtime/vm/compiler.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/compiler.cc
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc
index 17fa6f7973f0cc52a2412bb74278a45c7f1bd9b5..220bb8b515dd9ff5923b53ae9eedc82ae69effee 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -785,10 +785,10 @@ static bool CompileParsedFunctionHelper(CompilationPipeline* pipeline,
result->ClearCHAInvalidationGen();
}
if (flow_graph->guarded_fields()->is_empty()) {
- result->ClearFieldInnvalidationGen();
+ result->ClearFieldInvalidationGen();
}
if (!parsed_function->HasDeferredPrefixes()) {
- result->ClearPrefixInnvalidationGen();
+ result->ClearPrefixInvalidationGen();
}
} else {
const bool is_osr = osr_id != Compiler::kNoOSRDeoptId;
@@ -1138,6 +1138,9 @@ static RawError* CompileFunctionHelper(CompilationPipeline* pipeline,
// We got an error during compilation.
error = isolate->object_store()->sticky_error();
isolate->object_store()->clear_sticky_error();
+ ASSERT(!optimized);
+ // Do not attempt to optimize functions that can cause errors.
+ function.set_is_optimizable(false);
return error.raw();
}
UNREACHABLE();
@@ -1495,9 +1498,7 @@ class QueueElement {
}
siva 2015/11/06 23:12:54 This is not used anymore, can be removed?
srdjan 2015/12/09 22:43:17 Done.
RawFunction* Function() const { return Function::RawCast(obj_); }
- RawCode* Code() const {
- return (obj_ == Object::null()) ? Code::null() : Code::RawCast(obj_);
- }
+ RawCode* Code() const { return Code::RawCast(obj_); }
uint32_t cha_invalidation_gen() const { return cha_invalidation_gen_; }
uint32_t field_invalidation_gen() const { return field_invalidation_gen_; }
@@ -1706,15 +1707,10 @@ void BackgroundCompiler::Run() {
&result));
// TODO(srdjan): We do not expect errors while compiling optimized
// code, any errors should have been caught when compiling
- // unoptimized code.
- // If it still happens mark function as not optimizable.
+ // unoptimized code. Any issues while optimizing are flagged by
+ // making the result invalid.
ASSERT(error.IsNull());
- // Reuse the input QueueElement to return the result.
- QueueElement* qelem = function_queue()->Remove();
- qelem->Clear();
- result_queue()->Add(qelem);
- // Add 'qelem' to the queue first so that it gets visited by GC.
- qelem->SetFromResult(result);
+ AddResult(result);
function = function_queue()->PeekFunction();
}
}
@@ -1737,6 +1733,19 @@ void BackgroundCompiler::Run() {
}
+// Use to first queue element to form the result element.
+void BackgroundCompiler::AddResult(const BackgroundCompilationResult& result) {
+ ASSERT(!Thread::Current()->IsMutatorThread());
+ MonitorLocker ml(queue_monitor_);
+ // Reuse the input QueueElement to return the result.
+ QueueElement* qelem = function_queue()->Remove();
+ if (result.IsValid()) {
+ qelem->SetFromResult(result);
+ result_queue()->Add(qelem);
+ }
+}
+
+
void BackgroundCompiler::CompileOptimized(const Function& function) {
ASSERT(Thread::Current()->IsMutatorThread());
MonitorLocker ml(queue_monitor_);
« no previous file with comments | « runtime/vm/compiler.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698