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

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

Issue 1679373002: Disable reg-exp compilation in background via a flag (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Sync problem 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
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/flow_graph.h » ('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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 ASSERT(!is_osr); // OSR is compiled in background. 511 ASSERT(!is_osr); // OSR is compiled in background.
512 function.InstallOptimizedCode(code, is_osr); 512 function.InstallOptimizedCode(code, is_osr);
513 } 513 }
514 if (function.usage_counter() < 0) { 514 if (function.usage_counter() < 0) {
515 // Reset to 0 so that it can be recompiled if needed. 515 // Reset to 0 so that it can be recompiled if needed.
516 function.set_usage_counter(0); 516 function.set_usage_counter(0);
517 } 517 }
518 } 518 }
519 519
520 // Register code with the classes it depends on because of CHA and 520 // Register code with the classes it depends on because of CHA and
521 // fields it depends on because of store guards. 521 // fields it depends on because of store guards, unless we cannot
522 // Deoptimize field dependent code first, before registering 522 // deopt.
523 // this yet uninstalled code as dependent on a field.
524 // TODO(srdjan): Debugging dart2js crashes;
525 // FlowGraphOptimizer::VisitStoreInstanceField populates
526 // deoptimize_dependent_code() list, currently disabled.
527 for (intptr_t i = 0;
528 i < flow_graph->deoptimize_dependent_code().length();
529 i++) {
530 const Field* field = flow_graph->deoptimize_dependent_code()[i];
531 field->DeoptimizeDependentCode();
532 }
533 for (intptr_t i = 0; 523 for (intptr_t i = 0;
534 i < thread()->cha()->leaf_classes().length(); 524 i < thread()->cha()->leaf_classes().length();
535 ++i) { 525 ++i) {
536 thread()->cha()->leaf_classes()[i]->RegisterCHACode(code); 526 thread()->cha()->leaf_classes()[i]->RegisterCHACode(code);
537 } 527 }
538 for (intptr_t i = 0; 528 for (intptr_t i = 0;
539 i < flow_graph->guarded_fields()->length(); 529 i < flow_graph->guarded_fields()->length();
540 i++) { 530 i++) {
541 const Field* field = (*flow_graph->guarded_fields())[i]; 531 const Field* field = (*flow_graph->guarded_fields())[i];
542 field->RegisterDependentCode(code); 532 field->RegisterDependentCode(code);
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 1308
1319 RawError* Compiler::CompileOptimizedFunction(Thread* thread, 1309 RawError* Compiler::CompileOptimizedFunction(Thread* thread,
1320 const Function& function, 1310 const Function& function,
1321 intptr_t osr_id) { 1311 intptr_t osr_id) {
1322 VMTagScope tagScope(thread, VMTag::kCompileOptimizedTagId); 1312 VMTagScope tagScope(thread, VMTag::kCompileOptimizedTagId);
1323 TIMELINE_FUNCTION_COMPILATION_DURATION(thread, 1313 TIMELINE_FUNCTION_COMPILATION_DURATION(thread,
1324 "OptimizedFunction", function); 1314 "OptimizedFunction", function);
1325 1315
1326 // Optimization must happen in non-mutator/Dart thread if background 1316 // Optimization must happen in non-mutator/Dart thread if background
1327 // compilation is on. OSR compilation still occurs in the main thread. 1317 // compilation is on. OSR compilation still occurs in the main thread.
1318 // TODO(Srdjan): Remove assert allowance for regular expression functions
1319 // once they can be compiled in background.
1328 ASSERT((osr_id != kNoOSRDeoptId) || !FLAG_background_compilation || 1320 ASSERT((osr_id != kNoOSRDeoptId) || !FLAG_background_compilation ||
1329 !thread->IsMutatorThread()); 1321 !thread->IsMutatorThread() ||
1322 function.IsIrregexpFunction());
1330 CompilationPipeline* pipeline = 1323 CompilationPipeline* pipeline =
1331 CompilationPipeline::New(thread->zone(), function); 1324 CompilationPipeline::New(thread->zone(), function);
1332 return CompileFunctionHelper(pipeline, 1325 return CompileFunctionHelper(pipeline,
1333 function, 1326 function,
1334 true, /* optimized */ 1327 true, /* optimized */
1335 osr_id); 1328 osr_id);
1336 } 1329 }
1337 1330
1338 1331
1339 // This is only used from unit tests. 1332 // This is only used from unit tests.
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 } 1882 }
1890 1883
1891 1884
1892 void BackgroundCompiler::EnsureInit(Thread* thread) { 1885 void BackgroundCompiler::EnsureInit(Thread* thread) {
1893 UNREACHABLE(); 1886 UNREACHABLE();
1894 } 1887 }
1895 1888
1896 #endif // DART_PRECOMPILED_RUNTIME 1889 #endif // DART_PRECOMPILED_RUNTIME
1897 1890
1898 } // namespace dart 1891 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/flow_graph.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698