| 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 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1631 lib = cls.library(); | 1631 lib = cls.library(); |
| 1632 name = cls.DictionaryName(); | 1632 name = cls.DictionaryName(); |
| 1633 lib.RemoveObject(cls, name); | 1633 lib.RemoveObject(cls, name); |
| 1634 } | 1634 } |
| 1635 } | 1635 } |
| 1636 | 1636 |
| 1637 | 1637 |
| 1638 void Precompiler::DropLibraries() { | 1638 void Precompiler::DropLibraries() { |
| 1639 const GrowableObjectArray& retained_libraries = | 1639 const GrowableObjectArray& retained_libraries = |
| 1640 GrowableObjectArray::Handle(Z, GrowableObjectArray::New()); | 1640 GrowableObjectArray::Handle(Z, GrowableObjectArray::New()); |
| 1641 Library& root_lib = Library::Handle(Z, I->object_store()->root_library()); |
| 1641 Library& lib = Library::Handle(Z); | 1642 Library& lib = Library::Handle(Z); |
| 1642 | 1643 |
| 1643 for (intptr_t i = 0; i < libraries_.Length(); i++) { | 1644 for (intptr_t i = 0; i < libraries_.Length(); i++) { |
| 1644 lib ^= libraries_.At(i); | 1645 lib ^= libraries_.At(i); |
| 1645 lib.DropDependencies(); | 1646 lib.DropDependencies(); |
| 1646 intptr_t entries = 0; | 1647 intptr_t entries = 0; |
| 1647 DictionaryIterator it(lib); | 1648 DictionaryIterator it(lib); |
| 1648 while (it.HasNext()) { | 1649 while (it.HasNext()) { |
| 1649 it.GetNext(); | 1650 it.GetNext(); |
| 1650 entries++; | 1651 entries++; |
| 1651 } | 1652 } |
| 1652 bool retain = (entries > 0) || lib.is_dart_scheme(); | 1653 // The root library might have no surviving members if it only exports main |
| 1654 // from another library. It will still be referenced from the object store, |
| 1655 // so retain it. |
| 1656 bool retain = (entries > 0) || |
| 1657 lib.is_dart_scheme() || |
| 1658 (lib.raw() == root_lib.raw()); |
| 1653 if (retain) { | 1659 if (retain) { |
| 1654 lib.set_index(retained_libraries.Length()); | 1660 lib.set_index(retained_libraries.Length()); |
| 1655 retained_libraries.Add(lib); | 1661 retained_libraries.Add(lib); |
| 1656 } else { | 1662 } else { |
| 1657 dropped_library_count_++; | 1663 dropped_library_count_++; |
| 1658 lib.set_index(-1); | 1664 lib.set_index(-1); |
| 1659 if (FLAG_trace_precompiler) { | 1665 if (FLAG_trace_precompiler) { |
| 1660 THR_Print("Dropping library %s\n", lib.ToCString()); | 1666 THR_Print("Dropping library %s\n", lib.ToCString()); |
| 1661 } | 1667 } |
| 1662 } | 1668 } |
| (...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2744 CompilationPipeline::New(thread->zone(), function); | 2750 CompilationPipeline::New(thread->zone(), function); |
| 2745 | 2751 |
| 2746 ASSERT(FLAG_precompiled_mode); | 2752 ASSERT(FLAG_precompiled_mode); |
| 2747 const bool optimized = function.IsOptimizable(); // False for natives. | 2753 const bool optimized = function.IsOptimizable(); // False for natives. |
| 2748 return PrecompileFunctionHelper(pipeline, function, optimized); | 2754 return PrecompileFunctionHelper(pipeline, function, optimized); |
| 2749 } | 2755 } |
| 2750 | 2756 |
| 2751 #endif // DART_PRECOMPILER | 2757 #endif // DART_PRECOMPILER |
| 2752 | 2758 |
| 2753 } // namespace dart | 2759 } // namespace dart |
| OLD | NEW |