| 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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 | 614 |
| 615 if (types_to_retain_.Lookup(&abstype) != NULL) return; | 615 if (types_to_retain_.Lookup(&abstype) != NULL) return; |
| 616 types_to_retain_.Insert(&AbstractType::ZoneHandle(Z, abstype.raw())); | 616 types_to_retain_.Insert(&AbstractType::ZoneHandle(Z, abstype.raw())); |
| 617 | 617 |
| 618 if (abstype.IsType()) { | 618 if (abstype.IsType()) { |
| 619 const Type& type = Type::Cast(abstype); | 619 const Type& type = Type::Cast(abstype); |
| 620 const Class& cls = Class::Handle(Z, type.type_class()); | 620 const Class& cls = Class::Handle(Z, type.type_class()); |
| 621 AddTypesOf(cls); | 621 AddTypesOf(cls); |
| 622 const TypeArguments& vector = TypeArguments::Handle(Z, abstype.arguments()); | 622 const TypeArguments& vector = TypeArguments::Handle(Z, abstype.arguments()); |
| 623 AddTypeArguments(vector); | 623 AddTypeArguments(vector); |
| 624 } else if (abstype.IsFunctionType()) { | 624 if (type.IsFunctionType()) { |
| 625 const FunctionType& func_type = FunctionType::Cast(abstype); | 625 const Function& func = Function::Handle(Z, type.signature()); |
| 626 const Class& cls = Class::Handle(Z, func_type.scope_class()); | 626 AddTypesOf(func); |
| 627 AddTypesOf(cls); | 627 } |
| 628 const Function& func = Function::Handle(Z, func_type.signature()); | |
| 629 AddTypesOf(func); | |
| 630 const TypeArguments& vector = TypeArguments::Handle(Z, abstype.arguments()); | |
| 631 AddTypeArguments(vector); | |
| 632 } else if (abstype.IsBoundedType()) { | 628 } else if (abstype.IsBoundedType()) { |
| 633 AbstractType& type = AbstractType::Handle(Z); | 629 AbstractType& type = AbstractType::Handle(Z); |
| 634 type = BoundedType::Cast(abstype).type(); | 630 type = BoundedType::Cast(abstype).type(); |
| 635 AddType(type); | 631 AddType(type); |
| 636 type = BoundedType::Cast(abstype).bound(); | 632 type = BoundedType::Cast(abstype).bound(); |
| 637 AddType(type); | 633 AddType(type); |
| 638 } else if (abstype.IsTypeRef()) { | 634 } else if (abstype.IsTypeRef()) { |
| 639 AbstractType& type = AbstractType::Handle(Z); | 635 AbstractType& type = AbstractType::Handle(Z); |
| 640 type = TypeRef::Cast(abstype).type(); | 636 type = TypeRef::Cast(abstype).type(); |
| 641 AddType(type); | 637 AddType(type); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 // Function fits the bill. | 836 // Function fits the bill. |
| 841 const char* kEvalConst = "eval_const"; | 837 const char* kEvalConst = "eval_const"; |
| 842 const Function& func = Function::ZoneHandle(Function::New( | 838 const Function& func = Function::ZoneHandle(Function::New( |
| 843 String::Handle(Symbols::New(kEvalConst)), | 839 String::Handle(Symbols::New(kEvalConst)), |
| 844 RawFunction::kRegularFunction, | 840 RawFunction::kRegularFunction, |
| 845 true, // static function | 841 true, // static function |
| 846 false, // not const function | 842 false, // not const function |
| 847 false, // not abstract | 843 false, // not abstract |
| 848 false, // not external | 844 false, // not external |
| 849 false, // not native | 845 false, // not native |
| 850 Class::Handle(Type::Handle(Type::Function()).type_class()), | 846 Class::Handle(Type::Handle(Type::DartFunctionType()).type_class()), |
| 851 fragment->token_pos())); | 847 fragment->token_pos())); |
| 852 | 848 |
| 853 func.set_result_type(Object::dynamic_type()); | 849 func.set_result_type(Object::dynamic_type()); |
| 854 func.set_num_fixed_parameters(0); | 850 func.set_num_fixed_parameters(0); |
| 855 func.SetNumOptionalParameters(0, true); | 851 func.SetNumOptionalParameters(0, true); |
| 856 // Manually generated AST, do not recompile. | 852 // Manually generated AST, do not recompile. |
| 857 func.SetIsOptimizable(false); | 853 func.SetIsOptimizable(false); |
| 858 func.set_is_debuggable(false); | 854 func.set_is_debuggable(false); |
| 859 | 855 |
| 860 // We compile the function here, even though InvokeFunction() below | 856 // We compile the function here, even though InvokeFunction() below |
| (...skipping 1815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2676 CompilationPipeline::New(thread->zone(), function); | 2672 CompilationPipeline::New(thread->zone(), function); |
| 2677 | 2673 |
| 2678 ASSERT(FLAG_precompiled_mode); | 2674 ASSERT(FLAG_precompiled_mode); |
| 2679 const bool optimized = function.IsOptimizable(); // False for natives. | 2675 const bool optimized = function.IsOptimizable(); // False for natives. |
| 2680 return PrecompileFunctionHelper(pipeline, function, optimized); | 2676 return PrecompileFunctionHelper(pipeline, function, optimized); |
| 2681 } | 2677 } |
| 2682 | 2678 |
| 2683 #endif // DART_PRECOMPILER | 2679 #endif // DART_PRECOMPILER |
| 2684 | 2680 |
| 2685 } // namespace dart | 2681 } // namespace dart |
| OLD | NEW |