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

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: b 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. 523 if (!FLAG_precompilation) {
rmacnak 2016/02/09 20:26:11 Always true as precompiled code doesn't go through
srdjan 2016/02/09 20:44:43 Thanks, that was a sync issue,.
524 // TODO(srdjan): Debugging dart2js crashes; 524 for (intptr_t i = 0;
525 // FlowGraphOptimizer::VisitStoreInstanceField populates 525 i < thread()->cha()->leaf_classes().length();
526 // deoptimize_dependent_code() list, currently disabled. 526 ++i) {
527 for (intptr_t i = 0; 527 thread()->cha()->leaf_classes()[i]->RegisterCHACode(code);
528 i < flow_graph->deoptimize_dependent_code().length(); 528 }
529 i++) { 529 for (intptr_t i = 0;
530 const Field* field = flow_graph->deoptimize_dependent_code()[i]; 530 i < flow_graph->guarded_fields()->length();
531 field->DeoptimizeDependentCode(); 531 i++) {
532 } 532 const Field* field = (*flow_graph->guarded_fields())[i];
533 for (intptr_t i = 0; 533 field->RegisterDependentCode(code);
534 i < thread()->cha()->leaf_classes().length(); 534 }
535 ++i) {
536 thread()->cha()->leaf_classes()[i]->RegisterCHACode(code);
537 }
538 for (intptr_t i = 0;
539 i < flow_graph->guarded_fields()->length();
540 i++) {
541 const Field* field = (*flow_graph->guarded_fields())[i];
542 field->RegisterDependentCode(code);
543 } 535 }
544 } else { // not optimized. 536 } else { // not optimized.
545 if (function.ic_data_array() == Array::null()) { 537 if (function.ic_data_array() == Array::null()) {
546 function.SaveICDataMap( 538 function.SaveICDataMap(
547 graph_compiler->deopt_id_to_ic_data(), 539 graph_compiler->deopt_id_to_ic_data(),
548 Array::Handle(zone, graph_compiler->edge_counters_array())); 540 Array::Handle(zone, graph_compiler->edge_counters_array()));
549 } 541 }
550 function.set_unoptimized_code(code); 542 function.set_unoptimized_code(code);
551 function.AttachCode(code); 543 function.AttachCode(code);
552 } 544 }
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 1310
1319 RawError* Compiler::CompileOptimizedFunction(Thread* thread, 1311 RawError* Compiler::CompileOptimizedFunction(Thread* thread,
1320 const Function& function, 1312 const Function& function,
1321 intptr_t osr_id) { 1313 intptr_t osr_id) {
1322 VMTagScope tagScope(thread, VMTag::kCompileOptimizedTagId); 1314 VMTagScope tagScope(thread, VMTag::kCompileOptimizedTagId);
1323 TIMELINE_FUNCTION_COMPILATION_DURATION(thread, 1315 TIMELINE_FUNCTION_COMPILATION_DURATION(thread,
1324 "OptimizedFunction", function); 1316 "OptimizedFunction", function);
1325 1317
1326 // Optimization must happen in non-mutator/Dart thread if background 1318 // Optimization must happen in non-mutator/Dart thread if background
1327 // compilation is on. OSR compilation still occurs in the main thread. 1319 // compilation is on. OSR compilation still occurs in the main thread.
1320 // TODO(Srdjan): Remove assert allowance for regular expression functions
1321 // once they can be compiled in background.
1328 ASSERT((osr_id != kNoOSRDeoptId) || !FLAG_background_compilation || 1322 ASSERT((osr_id != kNoOSRDeoptId) || !FLAG_background_compilation ||
1329 !thread->IsMutatorThread()); 1323 !thread->IsMutatorThread() ||
1324 function.IsIrregexpFunction());
1330 CompilationPipeline* pipeline = 1325 CompilationPipeline* pipeline =
1331 CompilationPipeline::New(thread->zone(), function); 1326 CompilationPipeline::New(thread->zone(), function);
1332 return CompileFunctionHelper(pipeline, 1327 return CompileFunctionHelper(pipeline,
1333 function, 1328 function,
1334 true, /* optimized */ 1329 true, /* optimized */
1335 osr_id); 1330 osr_id);
1336 } 1331 }
1337 1332
1338 1333
1339 // This is only used from unit tests. 1334 // This is only used from unit tests.
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 } 1884 }
1890 1885
1891 1886
1892 void BackgroundCompiler::EnsureInit(Thread* thread) { 1887 void BackgroundCompiler::EnsureInit(Thread* thread) {
1893 UNREACHABLE(); 1888 UNREACHABLE();
1894 } 1889 }
1895 1890
1896 #endif // DART_PRECOMPILED_RUNTIME 1891 #endif // DART_PRECOMPILED_RUNTIME
1897 1892
1898 } // namespace dart 1893 } // 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