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

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

Issue 1436243005: Collect closure functions in isolate (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 unified diff | Download patch
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 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 !func.is_abstract() && 1300 !func.is_abstract() &&
1301 !func.IsRedirectingFactory()) { 1301 !func.IsRedirectingFactory()) {
1302 error = CompileFunction(thread, func); 1302 error = CompileFunction(thread, func);
1303 if (!error.IsNull()) { 1303 if (!error.IsNull()) {
1304 return error.raw(); 1304 return error.raw();
1305 } 1305 }
1306 func.ClearICDataArray(); 1306 func.ClearICDataArray();
1307 func.ClearCode(); 1307 func.ClearCode();
1308 } 1308 }
1309 } 1309 }
1310
1310 // Inner functions get added to the closures array. As part of compilation 1311 // Inner functions get added to the closures array. As part of compilation
1311 // more closures can be added to the end of the array. Compile all the 1312 // more closures can be added to the end of the array. Compile all the
1312 // closures until we have reached the end of the "worklist". 1313 // closures until we have reached the end of the "worklist".
1313 GrowableObjectArray& closures = 1314 const GrowableObjectArray& closures =
1314 GrowableObjectArray::Handle(zone, cls.closures()); 1315 GrowableObjectArray::Handle(zone,
1315 if (!closures.IsNull()) { 1316 Isolate::Current()->object_store()->closure_functions());
1316 for (int i = 0; i < closures.Length(); i++) { 1317 for (int i = 0; i < closures.Length(); i++) {
1317 func ^= closures.At(i); 1318 func ^= closures.At(i);
1318 if (!func.HasCode()) { 1319 if ((func.Owner() == cls.raw()) && !func.HasCode()) {
1319 error = CompileFunction(thread, func); 1320 error = CompileFunction(thread, func);
1320 if (!error.IsNull()) { 1321 if (!error.IsNull()) {
1321 return error.raw(); 1322 return error.raw();
1322 }
1323 func.ClearICDataArray();
1324 func.ClearCode();
1325 } 1323 }
1324 func.ClearICDataArray();
1325 func.ClearCode();
1326 } 1326 }
1327 } 1327 }
1328 return error.raw(); 1328 return error.raw();
1329 } 1329 }
1330 1330
1331 1331
1332 void Compiler::CompileStaticInitializer(const Field& field) { 1332 void Compiler::CompileStaticInitializer(const Field& field) {
1333 ASSERT(field.is_static()); 1333 ASSERT(field.is_static());
1334 if (field.HasPrecompiledInitializer()) { 1334 if (field.HasPrecompiledInitializer()) {
1335 // TODO(rmacnak): Investigate why this happens for _enum_names. 1335 // TODO(rmacnak): Investigate why this happens for _enum_names.
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 isolate->set_background_compiler(task); 1828 isolate->set_background_compiler(task);
1829 start_task = true; 1829 start_task = true;
1830 } 1830 }
1831 } 1831 }
1832 if (start_task) { 1832 if (start_task) {
1833 Dart::thread_pool()->Run(isolate->background_compiler()); 1833 Dart::thread_pool()->Run(isolate->background_compiler());
1834 } 1834 }
1835 } 1835 }
1836 1836
1837 } // namespace dart 1837 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698