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

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

Issue 2141263003: Fix clearing compile time constant caches during tree shaking. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: whitespace Created 4 years, 5 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/precompiler.h ('k') | no next file » | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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/precompiler.h" 5 #include "vm/precompiler.h"
6 6
7 #include "vm/aot_optimizer.h" 7 #include "vm/aot_optimizer.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/branch_optimizer.h" 10 #include "vm/branch_optimizer.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 TraceForRetainedFunctions(); 235 TraceForRetainedFunctions();
236 DropFunctions(); 236 DropFunctions();
237 DropFields(); 237 DropFields();
238 TraceTypesFromRetainedClasses(); 238 TraceTypesFromRetainedClasses();
239 DropTypes(); 239 DropTypes();
240 DropTypeArguments(); 240 DropTypeArguments();
241 241
242 // Clear these before dropping classes as they may hold onto otherwise 242 // Clear these before dropping classes as they may hold onto otherwise
243 // dead instances of classes we will remove. 243 // dead instances of classes we will remove.
244 DropCompileTimeConstantCaches();
244 I->object_store()->set_unique_dynamic_targets(Array::null_array()); 245 I->object_store()->set_unique_dynamic_targets(Array::null_array());
245 Class& null_class = Class::Handle(Z); 246 Class& null_class = Class::Handle(Z);
246 I->object_store()->set_future_class(null_class); 247 I->object_store()->set_future_class(null_class);
247 I->object_store()->set_completer_class(null_class); 248 I->object_store()->set_completer_class(null_class);
248 I->object_store()->set_stream_iterator_class(null_class); 249 I->object_store()->set_stream_iterator_class(null_class);
249 I->object_store()->set_symbol_class(null_class); 250 I->object_store()->set_symbol_class(null_class);
250 } 251 }
251 DropClasses(); 252 DropClasses();
252 DropLibraries(); 253 DropLibraries();
253 254
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1552 bool present; 1553 bool present;
1553 for (intptr_t i = 0; i < retained_typeargs.Length(); i++) { 1554 for (intptr_t i = 0; i < retained_typeargs.Length(); i++) {
1554 typeargs ^= retained_typeargs.At(i); 1555 typeargs ^= retained_typeargs.At(i);
1555 present = typeargs_table.Insert(typeargs); 1556 present = typeargs_table.Insert(typeargs);
1556 ASSERT(!present); 1557 ASSERT(!present);
1557 } 1558 }
1558 object_store->set_canonical_type_arguments(typeargs_table.Release()); 1559 object_store->set_canonical_type_arguments(typeargs_table.Release());
1559 } 1560 }
1560 1561
1561 1562
1563 void Precompiler::DropCompileTimeConstantCaches() {
1564 Library& lib = Library::Handle(Z);
1565 Array& scripts = Array::Handle(Z);
1566 Script& script = Script::Handle(Z);
1567 for (intptr_t i = 0; i < libraries_.Length(); i++) {
1568 lib ^= libraries_.At(i);
1569 scripts = lib.LoadedScripts();
1570 for (intptr_t j = 0; j < scripts.Length(); j++) {
1571 script ^= scripts.At(j);
1572 script.set_compile_time_constants(Array::null_array());
1573 }
1574 }
1575 }
1576
1577
1562 void Precompiler::TraceTypesFromRetainedClasses() { 1578 void Precompiler::TraceTypesFromRetainedClasses() {
1563 Library& lib = Library::Handle(Z); 1579 Library& lib = Library::Handle(Z);
1564 Class& cls = Class::Handle(Z); 1580 Class& cls = Class::Handle(Z);
1565 Array& members = Array::Handle(Z); 1581 Array& members = Array::Handle(Z);
1566 Array& constants = Array::Handle(Z); 1582 Array& constants = Array::Handle(Z);
1567 GrowableObjectArray& retained_constants = GrowableObjectArray::Handle(Z); 1583 GrowableObjectArray& retained_constants = GrowableObjectArray::Handle(Z);
1568 Instance& constant = Instance::Handle(Z); 1584 Instance& constant = Instance::Handle(Z);
1569 1585
1570 for (intptr_t i = 0; i < libraries_.Length(); i++) { 1586 for (intptr_t i = 0; i < libraries_.Length(); i++) {
1571 lib ^= libraries_.At(i); 1587 lib ^= libraries_.At(i);
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after
2864 CompilationPipeline::New(thread->zone(), function); 2880 CompilationPipeline::New(thread->zone(), function);
2865 2881
2866 ASSERT(FLAG_precompiled_mode); 2882 ASSERT(FLAG_precompiled_mode);
2867 const bool optimized = function.IsOptimizable(); // False for natives. 2883 const bool optimized = function.IsOptimizable(); // False for natives.
2868 return PrecompileFunctionHelper(pipeline, function, optimized); 2884 return PrecompileFunctionHelper(pipeline, function, optimized);
2869 } 2885 }
2870 2886
2871 #endif // DART_PRECOMPILER 2887 #endif // DART_PRECOMPILER
2872 2888
2873 } // namespace dart 2889 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/precompiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698