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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 I->object_store()->set_stream_iterator_class(null_class); | 475 I->object_store()->set_stream_iterator_class(null_class); |
476 I->object_store()->set_symbol_class(null_class); | 476 I->object_store()->set_symbol_class(null_class); |
477 I->object_store()->set_compiletime_error_class(null_class); | 477 I->object_store()->set_compiletime_error_class(null_class); |
478 I->object_store()->set_simple_instance_of_function(null_function); | 478 I->object_store()->set_simple_instance_of_function(null_function); |
479 I->object_store()->set_simple_instance_of_true_function(null_function); | 479 I->object_store()->set_simple_instance_of_true_function(null_function); |
480 I->object_store()->set_simple_instance_of_false_function(null_function); | 480 I->object_store()->set_simple_instance_of_false_function(null_function); |
481 I->object_store()->set_async_set_thread_stack_trace(null_function); | 481 I->object_store()->set_async_set_thread_stack_trace(null_function); |
482 I->object_store()->set_async_star_move_next_helper(null_function); | 482 I->object_store()->set_async_star_move_next_helper(null_function); |
483 I->object_store()->set_complete_on_async_return(null_function); | 483 I->object_store()->set_complete_on_async_return(null_function); |
484 I->object_store()->set_async_star_stream_controller(null_class); | 484 I->object_store()->set_async_star_stream_controller(null_class); |
| 485 DropMetadata(); |
485 DropLibraryEntries(); | 486 DropLibraryEntries(); |
486 } | 487 } |
487 DropClasses(); | 488 DropClasses(); |
488 DropLibraries(); | 489 DropLibraries(); |
489 | 490 |
490 BindStaticCalls(); | 491 BindStaticCalls(); |
491 SwitchICCalls(); | 492 SwitchICCalls(); |
492 | 493 |
493 ProgramVisitor::Dedup(); | 494 ProgramVisitor::Dedup(); |
494 | 495 |
(...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1961 retain = true; | 1962 retain = true; |
1962 } | 1963 } |
1963 | 1964 |
1964 if (retain) { | 1965 if (retain) { |
1965 AddTypesOf(cls); | 1966 AddTypesOf(cls); |
1966 } | 1967 } |
1967 } | 1968 } |
1968 } | 1969 } |
1969 } | 1970 } |
1970 | 1971 |
| 1972 void Precompiler::DropMetadata() { |
| 1973 Library& lib = Library::Handle(Z); |
| 1974 const GrowableObjectArray& null_growable_list = |
| 1975 GrowableObjectArray::Handle(Z); |
| 1976 Array& dependencies = Array::Handle(Z); |
| 1977 Namespace& ns = Namespace::Handle(Z); |
| 1978 const Field& null_field = Field::Handle(Z); |
| 1979 |
| 1980 for (intptr_t i = 0; i < libraries_.Length(); i++) { |
| 1981 lib ^= libraries_.At(i); |
| 1982 lib.set_metadata(null_growable_list); |
| 1983 |
| 1984 dependencies = lib.imports(); |
| 1985 for (intptr_t j = 0; j < dependencies.Length(); j++) { |
| 1986 ns ^= dependencies.At(j); |
| 1987 if (!ns.IsNull()) { |
| 1988 ns.set_metadata_field(null_field); |
| 1989 } |
| 1990 } |
| 1991 |
| 1992 dependencies = lib.exports(); |
| 1993 for (intptr_t j = 0; j < dependencies.Length(); j++) { |
| 1994 ns ^= dependencies.At(j); |
| 1995 if (!ns.IsNull()) { |
| 1996 ns.set_metadata_field(null_field); |
| 1997 } |
| 1998 } |
| 1999 } |
| 2000 } |
| 2001 |
1971 void Precompiler::DropLibraryEntries() { | 2002 void Precompiler::DropLibraryEntries() { |
1972 Library& lib = Library::Handle(Z); | 2003 Library& lib = Library::Handle(Z); |
1973 Array& dict = Array::Handle(Z); | 2004 Array& dict = Array::Handle(Z); |
1974 Object& entry = Object::Handle(Z); | 2005 Object& entry = Object::Handle(Z); |
1975 | 2006 |
1976 for (intptr_t i = 0; i < libraries_.Length(); i++) { | 2007 for (intptr_t i = 0; i < libraries_.Length(); i++) { |
1977 lib ^= libraries_.At(i); | 2008 lib ^= libraries_.At(i); |
1978 | 2009 |
1979 dict = lib.dictionary(); | 2010 dict = lib.dictionary(); |
1980 intptr_t dict_size = dict.Length() - 1; | 2011 intptr_t dict_size = dict.Length() - 1; |
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3342 | 3373 |
3343 ASSERT(FLAG_precompiled_mode); | 3374 ASSERT(FLAG_precompiled_mode); |
3344 const bool optimized = function.IsOptimizable(); // False for natives. | 3375 const bool optimized = function.IsOptimizable(); // False for natives. |
3345 DartPrecompilationPipeline pipeline(zone, field_type_map); | 3376 DartPrecompilationPipeline pipeline(zone, field_type_map); |
3346 return PrecompileFunctionHelper(precompiler, &pipeline, function, optimized); | 3377 return PrecompileFunctionHelper(precompiler, &pipeline, function, optimized); |
3347 } | 3378 } |
3348 | 3379 |
3349 #endif // DART_PRECOMPILER | 3380 #endif // DART_PRECOMPILER |
3350 | 3381 |
3351 } // namespace dart | 3382 } // namespace dart |
OLD | NEW |