OLD | NEW |
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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 I->set_compilation_allowed(false); | 233 I->set_compilation_allowed(false); |
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 or otherwise unused symbols. |
244 DropCompileTimeConstantCaches(); | 244 DropScriptData(); |
245 I->object_store()->set_unique_dynamic_targets(Array::null_array()); | 245 I->object_store()->set_unique_dynamic_targets(Array::null_array()); |
246 Class& null_class = Class::Handle(Z); | 246 Class& null_class = Class::Handle(Z); |
247 I->object_store()->set_future_class(null_class); | 247 I->object_store()->set_future_class(null_class); |
248 I->object_store()->set_completer_class(null_class); | 248 I->object_store()->set_completer_class(null_class); |
249 I->object_store()->set_stream_iterator_class(null_class); | 249 I->object_store()->set_stream_iterator_class(null_class); |
250 I->object_store()->set_symbol_class(null_class); | 250 I->object_store()->set_symbol_class(null_class); |
251 } | 251 } |
252 DropClasses(); | 252 DropClasses(); |
253 DropLibraries(); | 253 DropLibraries(); |
254 | 254 |
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1553 bool present; | 1553 bool present; |
1554 for (intptr_t i = 0; i < retained_typeargs.Length(); i++) { | 1554 for (intptr_t i = 0; i < retained_typeargs.Length(); i++) { |
1555 typeargs ^= retained_typeargs.At(i); | 1555 typeargs ^= retained_typeargs.At(i); |
1556 present = typeargs_table.Insert(typeargs); | 1556 present = typeargs_table.Insert(typeargs); |
1557 ASSERT(!present); | 1557 ASSERT(!present); |
1558 } | 1558 } |
1559 object_store->set_canonical_type_arguments(typeargs_table.Release()); | 1559 object_store->set_canonical_type_arguments(typeargs_table.Release()); |
1560 } | 1560 } |
1561 | 1561 |
1562 | 1562 |
1563 void Precompiler::DropCompileTimeConstantCaches() { | 1563 void Precompiler::DropScriptData() { |
1564 Library& lib = Library::Handle(Z); | 1564 Library& lib = Library::Handle(Z); |
1565 Array& scripts = Array::Handle(Z); | 1565 Array& scripts = Array::Handle(Z); |
1566 Script& script = Script::Handle(Z); | 1566 Script& script = Script::Handle(Z); |
| 1567 const TokenStream& null_tokens = TokenStream::Handle(Z); |
1567 for (intptr_t i = 0; i < libraries_.Length(); i++) { | 1568 for (intptr_t i = 0; i < libraries_.Length(); i++) { |
1568 lib ^= libraries_.At(i); | 1569 lib ^= libraries_.At(i); |
1569 scripts = lib.LoadedScripts(); | 1570 scripts = lib.LoadedScripts(); |
1570 for (intptr_t j = 0; j < scripts.Length(); j++) { | 1571 for (intptr_t j = 0; j < scripts.Length(); j++) { |
1571 script ^= scripts.At(j); | 1572 script ^= scripts.At(j); |
1572 script.set_compile_time_constants(Array::null_array()); | 1573 script.set_compile_time_constants(Array::null_array()); |
| 1574 script.set_source(String::null_string()); |
| 1575 script.set_tokens(null_tokens); |
1573 } | 1576 } |
1574 } | 1577 } |
1575 } | 1578 } |
1576 | 1579 |
1577 | 1580 |
1578 void Precompiler::TraceTypesFromRetainedClasses() { | 1581 void Precompiler::TraceTypesFromRetainedClasses() { |
1579 Library& lib = Library::Handle(Z); | 1582 Library& lib = Library::Handle(Z); |
1580 Class& cls = Class::Handle(Z); | 1583 Class& cls = Class::Handle(Z); |
1581 Array& members = Array::Handle(Z); | 1584 Array& members = Array::Handle(Z); |
1582 Array& constants = Array::Handle(Z); | 1585 Array& constants = Array::Handle(Z); |
(...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2883 CompilationPipeline::New(thread->zone(), function); | 2886 CompilationPipeline::New(thread->zone(), function); |
2884 | 2887 |
2885 ASSERT(FLAG_precompiled_mode); | 2888 ASSERT(FLAG_precompiled_mode); |
2886 const bool optimized = function.IsOptimizable(); // False for natives. | 2889 const bool optimized = function.IsOptimizable(); // False for natives. |
2887 return PrecompileFunctionHelper(pipeline, function, optimized); | 2890 return PrecompileFunctionHelper(pipeline, function, optimized); |
2888 } | 2891 } |
2889 | 2892 |
2890 #endif // DART_PRECOMPILER | 2893 #endif // DART_PRECOMPILER |
2891 | 2894 |
2892 } // namespace dart | 2895 } // namespace dart |
OLD | NEW |