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

Side by Side Diff: runtime/vm/compiler.cc

Issue 1393373003: Remove isolate argument from handle allocation: Part I (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cleanups Created 5 years, 2 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
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/compiler_test.cc » ('j') | 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/compiler.h" 5 #include "vm/compiler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 8
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/block_scheduler.h" 10 #include "vm/block_scheduler.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 208 }
209 UNREACHABLE(); 209 UNREACHABLE();
210 return Error::null(); 210 return Error::null();
211 } 211 }
212 212
213 213
214 static void AddRelatedClassesToList( 214 static void AddRelatedClassesToList(
215 const Class& cls, 215 const Class& cls,
216 GrowableHandlePtrArray<const Class>* parse_list, 216 GrowableHandlePtrArray<const Class>* parse_list,
217 GrowableHandlePtrArray<const Class>* patch_list) { 217 GrowableHandlePtrArray<const Class>* patch_list) {
218 Isolate* isolate = Isolate::Current(); 218 Zone* zone = Thread::Current()->zone();
219 Class& parse_class = Class::Handle(isolate); 219 Class& parse_class = Class::Handle(zone);
220 AbstractType& interface_type = Type::Handle(isolate); 220 AbstractType& interface_type = Type::Handle(zone);
221 Array& interfaces = Array::Handle(isolate); 221 Array& interfaces = Array::Handle(zone);
222 222
223 // Add all the interfaces implemented by the class that have not been 223 // Add all the interfaces implemented by the class that have not been
224 // already parsed to the parse list. Mark the interface as parsed so that 224 // already parsed to the parse list. Mark the interface as parsed so that
225 // we don't recursively add it back into the list. 225 // we don't recursively add it back into the list.
226 interfaces ^= cls.interfaces(); 226 interfaces ^= cls.interfaces();
227 for (intptr_t i = 0; i < interfaces.Length(); i++) { 227 for (intptr_t i = 0; i < interfaces.Length(); i++) {
228 interface_type ^= interfaces.At(i); 228 interface_type ^= interfaces.At(i);
229 parse_class ^= interface_type.type_class(); 229 parse_class ^= interface_type.type_class();
230 if (!parse_class.is_finalized() && !parse_class.is_marked_for_parsing()) { 230 if (!parse_class.is_finalized() && !parse_class.is_marked_for_parsing()) {
231 parse_list->Add(parse_class); 231 parse_list->Add(parse_class);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 const Type& type = Type::Handle( 274 const Type& type = Type::Handle(
275 Isolate::Current()->object_store()->function_impl_type()); 275 Isolate::Current()->object_store()->function_impl_type());
276 const Class& type_cls = Class::Handle(type.type_class()); 276 const Class& type_cls = Class::Handle(type.type_class());
277 ASSERT(type_cls.is_finalized()); 277 ASSERT(type_cls.is_finalized());
278 #endif 278 #endif
279 LongJumpScope jump; 279 LongJumpScope jump;
280 if (setjmp(*jump.Set()) == 0) { 280 if (setjmp(*jump.Set()) == 0) {
281 ClassFinalizer::FinalizeClass(cls); 281 ClassFinalizer::FinalizeClass(cls);
282 return Error::null(); 282 return Error::null();
283 } else { 283 } else {
284 Isolate* isolate = Isolate::Current(); 284 Thread* thread = Thread::Current();
285 Error& error = Error::Handle(isolate); 285 Isolate* isolate = thread->isolate();
286 Error& error = Error::Handle(thread->zone());
286 error = isolate->object_store()->sticky_error(); 287 error = isolate->object_store()->sticky_error();
287 isolate->object_store()->clear_sticky_error(); 288 isolate->object_store()->clear_sticky_error();
288 return error.raw(); 289 return error.raw();
289 } 290 }
290 } 291 }
291 292
292 Thread* const thread = Thread::Current(); 293 Thread* const thread = Thread::Current();
293 Isolate* const isolate = thread->isolate(); 294 Isolate* const isolate = thread->isolate();
294 StackZone zone(thread); 295 StackZone zone(thread);
295 // We remember all the classes that are being compiled in these lists. This 296 // We remember all the classes that are being compiled in these lists. This
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 if (parse_class.is_marked_for_parsing()) { 359 if (parse_class.is_marked_for_parsing()) {
359 parse_class.reset_is_marked_for_parsing(); 360 parse_class.reset_is_marked_for_parsing();
360 } 361 }
361 } 362 }
362 for (intptr_t i = 0; i < patch_list.length(); i++) { 363 for (intptr_t i = 0; i < patch_list.length(); i++) {
363 const Class& parse_class = patch_list.At(i); 364 const Class& parse_class = patch_list.At(i);
364 if (parse_class.is_marked_for_parsing()) { 365 if (parse_class.is_marked_for_parsing()) {
365 parse_class.reset_is_marked_for_parsing(); 366 parse_class.reset_is_marked_for_parsing();
366 } 367 }
367 } 368 }
368 Error& error = Error::Handle(isolate); 369 Error& error = Error::Handle(zone.GetZone());
369 error = isolate->object_store()->sticky_error(); 370 error = isolate->object_store()->sticky_error();
370 isolate->object_store()->clear_sticky_error(); 371 isolate->object_store()->clear_sticky_error();
371 return error.raw(); 372 return error.raw();
372 } 373 }
373 UNREACHABLE(); 374 UNREACHABLE();
374 return Error::null(); 375 return Error::null();
375 } 376 }
376 377
377 378
378 // Return false if bailed out. 379 // Return false if bailed out.
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 } 1546 }
1546 1547
1547 1548
1548 void BackgroundCompiler::EnsureInit(Isolate* isolate) { 1549 void BackgroundCompiler::EnsureInit(Isolate* isolate) {
1549 bool start_task = false; 1550 bool start_task = false;
1550 { 1551 {
1551 MutexLocker ml(isolate->mutex()); 1552 MutexLocker ml(isolate->mutex());
1552 if (isolate->background_compiler() == NULL) { 1553 if (isolate->background_compiler() == NULL) {
1553 BackgroundCompiler* task = new BackgroundCompiler(isolate); 1554 BackgroundCompiler* task = new BackgroundCompiler(isolate);
1554 isolate->set_background_compiler(task); 1555 isolate->set_background_compiler(task);
1555 isolate->set_background_compilation_queue( 1556 isolate->set_background_compilation_queue(GrowableObjectArray::Handle(
1556 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New())); 1557 isolate->current_zone(), GrowableObjectArray::New()));
1557 start_task = true; 1558 start_task = true;
1558 } 1559 }
1559 } 1560 }
1560 if (start_task) { 1561 if (start_task) {
1561 Dart::thread_pool()->Run(isolate->background_compiler()); 1562 Dart::thread_pool()->Run(isolate->background_compiler());
1562 } 1563 }
1563 } 1564 }
1564 1565
1565 } // namespace dart 1566 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/compiler_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698