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

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

Issue 2006793002: VM: Fix race between background compiler and guarded cid update. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | runtime/vm/jit_optimizer.cc » ('j') | runtime/vm/object.h » ('J')
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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 // Returns true if any of disabling fields is inside the guarded_fields. 489 // Returns true if any of disabling fields is inside the guarded_fields.
490 // The number of guarded_fields and disabling-fields is expected to be small 490 // The number of guarded_fields and disabling-fields is expected to be small
491 // (less than 5). 491 // (less than 5).
492 static bool CheckDisablingFields( 492 static bool CheckDisablingFields(
493 Thread* thread, 493 Thread* thread,
494 const ZoneGrowableArray<const Field*>& guarded_fields) { 494 const ZoneGrowableArray<const Field*>& guarded_fields) {
495 Isolate* isolate = thread->isolate(); 495 Isolate* isolate = thread->isolate();
496 Zone* zone = thread->zone(); 496 Zone* zone = thread->zone();
497 Field& field = Field::Handle(zone, isolate->GetDisablingField()); 497 Field& field = Field::Handle(zone, isolate->GetDisablingField());
498 while (!field.IsNull()) { 498 while (!field.IsNull()) {
499 ASSERT(field.IsOriginal());
499 for (intptr_t i = 0; i < guarded_fields.length(); i++) { 500 for (intptr_t i = 0; i < guarded_fields.length(); i++) {
500 if (guarded_fields.At(i)->raw() == field.raw()) { 501 if (guarded_fields.At(i)->Original() == field.raw()) {
501 return true; 502 return true;
502 } 503 }
503 } 504 }
504 // Get next field. 505 // Get next field.
505 field = isolate->GetDisablingField(); 506 field = isolate->GetDisablingField();
506 } 507 }
507 return false; 508 return false;
508 } 509 }
509 510
510 511
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 } 640 }
640 641
641 if (code_was_installed) { 642 if (code_was_installed) {
642 // The generated code was compiled under certain assumptions about 643 // The generated code was compiled under certain assumptions about
643 // class hierarchy and field types. Register these dependencies 644 // class hierarchy and field types. Register these dependencies
644 // to ensure that the code will be deoptimized if they are violated. 645 // to ensure that the code will be deoptimized if they are violated.
645 thread()->cha()->RegisterDependencies(code); 646 thread()->cha()->RegisterDependencies(code);
646 647
647 const ZoneGrowableArray<const Field*>& guarded_fields = 648 const ZoneGrowableArray<const Field*>& guarded_fields =
648 *flow_graph->parsed_function().guarded_fields(); 649 *flow_graph->parsed_function().guarded_fields();
650 Field& field = Field::Handle();
649 for (intptr_t i = 0; i < guarded_fields.length(); i++) { 651 for (intptr_t i = 0; i < guarded_fields.length(); i++) {
650 const Field* field = guarded_fields[i]; 652 field = guarded_fields[i]->Original();
651 field->RegisterDependentCode(code); 653 field.RegisterDependentCode(code);
652 } 654 }
653 } 655 }
654 } else { // not optimized. 656 } else { // not optimized.
655 if (function.ic_data_array() == Array::null()) { 657 if (function.ic_data_array() == Array::null()) {
656 function.SaveICDataMap( 658 function.SaveICDataMap(
657 graph_compiler->deopt_id_to_ic_data(), 659 graph_compiler->deopt_id_to_ic_data(),
658 Array::Handle(zone, graph_compiler->edge_counters_array())); 660 Array::Handle(zone, graph_compiler->edge_counters_array()));
659 } 661 }
660 function.set_unoptimized_code(code); 662 function.set_unoptimized_code(code);
661 function.AttachCode(code); 663 function.AttachCode(code);
(...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after
2185 2187
2186 2188
2187 bool BackgroundCompiler::IsDisabled() { 2189 bool BackgroundCompiler::IsDisabled() {
2188 UNREACHABLE(); 2190 UNREACHABLE();
2189 return true; 2191 return true;
2190 } 2192 }
2191 2193
2192 #endif // DART_PRECOMPILED_RUNTIME 2194 #endif // DART_PRECOMPILED_RUNTIME
2193 2195
2194 } // namespace dart 2196 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/jit_optimizer.cc » ('j') | runtime/vm/object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698