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

Unified Diff: runtime/vm/stub_code.cc

Issue 1708013002: Minor fixes for background compilation (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: i Created 4 years, 10 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
« no previous file with comments | « runtime/vm/compiler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code.cc
diff --git a/runtime/vm/stub_code.cc b/runtime/vm/stub_code.cc
index f7116e320371bc3d51e99a1beef1747e0462a4cb..6738a259e013a45f22462378ff8130e586e52a2a 100644
--- a/runtime/vm/stub_code.cc
+++ b/runtime/vm/stub_code.cc
@@ -124,8 +124,11 @@ RawCode* StubCode::GetAllocationStubForClass(const Class& cls) {
if (thread->IsMutatorThread()) {
stub ^= Code::FinalizeCode(name, &assembler, false /* optimized */);
- stub.set_owner(cls);
- cls.set_allocation_stub(stub);
+ // Check if background compilation thread has not already added the stub.
+ if (cls.allocation_stub() == Code::null()) {
+ stub.set_owner(cls);
+ cls.set_allocation_stub(stub);
+ }
} else {
// This part of stub code generation must be at a safepoint.
// Stop mutator thread before creating the instruction object and
@@ -136,6 +139,11 @@ RawCode* StubCode::GetAllocationStubForClass(const Class& cls) {
// executable).
{
SafepointOperationScope safepoint_scope(thread);
+ stub = cls.allocation_stub();
+ // Check if stub was already generated.
+ if (!stub.IsNull()) {
+ return stub.raw();
+ }
// Do not Garbage collect during this stage and instead allow the
// heap to grow.
NoHeapGrowthControlScope no_growth_control;
« no previous file with comments | « runtime/vm/compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698