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

Side by Side 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: 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 unified diff | Download patch
« runtime/vm/compiler.cc ('K') | « runtime/vm/compiler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/stub_code.h" 5 #include "vm/stub_code.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "platform/globals.h" 8 #include "platform/globals.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/disassembler.h" 10 #include "vm/disassembler.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 118 }
119 Code& stub = Code::Handle(zone, cls.allocation_stub()); 119 Code& stub = Code::Handle(zone, cls.allocation_stub());
120 if (stub.IsNull()) { 120 if (stub.IsNull()) {
121 Assembler assembler; 121 Assembler assembler;
122 const char* name = cls.ToCString(); 122 const char* name = cls.ToCString();
123 StubCode::GenerateAllocationStubForClass(&assembler, cls); 123 StubCode::GenerateAllocationStubForClass(&assembler, cls);
124 124
125 if (thread->IsMutatorThread()) { 125 if (thread->IsMutatorThread()) {
126 stub ^= Code::FinalizeCode(name, &assembler, false /* optimized */); 126 stub ^= Code::FinalizeCode(name, &assembler, false /* optimized */);
127 stub.set_owner(cls); 127 stub.set_owner(cls);
128 cls.set_allocation_stub(stub); 128 cls.set_allocation_stub(stub);
siva 2016/02/17 23:12:48 As discussed offline you might need a check here t
srdjan 2016/02/17 23:32:29 Done.
129 } else { 129 } else {
130 // This part of stub code generation must be at a safepoint. 130 // This part of stub code generation must be at a safepoint.
131 // Stop mutator thread before creating the instruction object and 131 // Stop mutator thread before creating the instruction object and
132 // installing code. 132 // installing code.
133 // Mutator thread may not run code while we are creating the 133 // Mutator thread may not run code while we are creating the
134 // instruction object, since the creation of instruction object 134 // instruction object, since the creation of instruction object
135 // changes code page access permissions (makes them temporary not 135 // changes code page access permissions (makes them temporary not
136 // executable). 136 // executable).
137 { 137 {
138 SafepointOperationScope safepoint_scope(thread); 138 SafepointOperationScope safepoint_scope(thread);
139 stub = cls.allocation_stub();
140 // Check if stub was already generated.
141 if (!stub.IsNull()) {
142 return stub.raw();
143 }
139 // Do not Garbage collect during this stage and instead allow the 144 // Do not Garbage collect during this stage and instead allow the
140 // heap to grow. 145 // heap to grow.
141 NoHeapGrowthControlScope no_growth_control; 146 NoHeapGrowthControlScope no_growth_control;
142 stub ^= Code::FinalizeCode(name, &assembler, false /* optimized */); 147 stub ^= Code::FinalizeCode(name, &assembler, false /* optimized */);
143 stub.set_owner(cls); 148 stub.set_owner(cls);
144 cls.set_allocation_stub(stub); 149 cls.set_allocation_stub(stub);
145 } 150 }
146 Isolate* isolate = thread->isolate(); 151 Isolate* isolate = thread->isolate();
147 if (isolate->heap()->NeedsGarbageCollection()) { 152 if (isolate->heap()->NeedsGarbageCollection()) {
148 isolate->heap()->CollectAllGarbage(); 153 isolate->heap()->CollectAllGarbage();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 if ((name##_entry() != NULL) && \ 209 if ((name##_entry() != NULL) && \
205 (entry_point == name##_entry()->EntryPoint())) { \ 210 (entry_point == name##_entry()->EntryPoint())) { \
206 return ""#name; \ 211 return ""#name; \
207 } 212 }
208 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER); 213 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER);
209 #undef VM_STUB_CODE_TESTER 214 #undef VM_STUB_CODE_TESTER
210 return NULL; 215 return NULL;
211 } 216 }
212 217
213 } // namespace dart 218 } // namespace dart
OLDNEW
« runtime/vm/compiler.cc ('K') | « runtime/vm/compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698