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

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

Issue 1870343002: - Refactor Symbol allocation to expect a thread parameter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review feedback. Created 4 years, 8 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/parser_test.cc ('k') | runtime/vm/profiler_test.cc » ('j') | 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 void Precompiler::AddEntryPoints(Dart_QualifiedFunctionName entry_points[]) { 341 void Precompiler::AddEntryPoints(Dart_QualifiedFunctionName entry_points[]) {
342 Library& lib = Library::Handle(Z); 342 Library& lib = Library::Handle(Z);
343 Class& cls = Class::Handle(Z); 343 Class& cls = Class::Handle(Z);
344 Function& func = Function::Handle(Z); 344 Function& func = Function::Handle(Z);
345 Field& field = Field::Handle(Z); 345 Field& field = Field::Handle(Z);
346 String& library_uri = String::Handle(Z); 346 String& library_uri = String::Handle(Z);
347 String& class_name = String::Handle(Z); 347 String& class_name = String::Handle(Z);
348 String& function_name = String::Handle(Z); 348 String& function_name = String::Handle(Z);
349 349
350 for (intptr_t i = 0; entry_points[i].library_uri != NULL; i++) { 350 for (intptr_t i = 0; entry_points[i].library_uri != NULL; i++) {
351 library_uri = Symbols::New(entry_points[i].library_uri); 351 library_uri = Symbols::New(thread(), entry_points[i].library_uri);
352 class_name = Symbols::New(entry_points[i].class_name); 352 class_name = Symbols::New(thread(), entry_points[i].class_name);
353 function_name = Symbols::New(entry_points[i].function_name); 353 function_name = Symbols::New(thread(), entry_points[i].function_name);
354 354
355 lib = Library::LookupLibrary(library_uri); 355 lib = Library::LookupLibrary(library_uri);
356 if (lib.IsNull()) { 356 if (lib.IsNull()) {
357 String& msg = String::Handle(Z, String::NewFormatted( 357 String& msg = String::Handle(Z, String::NewFormatted(
358 "Cannot find entry point %s\n", entry_points[i].library_uri)); 358 "Cannot find entry point %s\n", entry_points[i].library_uri));
359 Jump(Error::Handle(Z, ApiError::New(msg))); 359 Jump(Error::Handle(Z, ApiError::New(msg)));
360 UNREACHABLE(); 360 UNREACHABLE();
361 } 361 }
362 362
363 if (class_name.raw() == Symbols::TopLevel().raw()) { 363 if (class_name.raw() == Symbols::TopLevel().raw()) {
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 if (FLAG_support_ast_printer && FLAG_trace_compiler) { 839 if (FLAG_support_ast_printer && FLAG_trace_compiler) {
840 THR_Print("compiling expression: "); 840 THR_Print("compiling expression: ");
841 AstPrinter::PrintNode(fragment); 841 AstPrinter::PrintNode(fragment);
842 } 842 }
843 843
844 // Create a dummy function object for the code generator. 844 // Create a dummy function object for the code generator.
845 // The function needs to be associated with a named Class: the interface 845 // The function needs to be associated with a named Class: the interface
846 // Function fits the bill. 846 // Function fits the bill.
847 const char* kEvalConst = "eval_const"; 847 const char* kEvalConst = "eval_const";
848 const Function& func = Function::ZoneHandle(Function::New( 848 const Function& func = Function::ZoneHandle(Function::New(
849 String::Handle(Symbols::New(kEvalConst)), 849 String::Handle(Symbols::New(thread, kEvalConst)),
850 RawFunction::kRegularFunction, 850 RawFunction::kRegularFunction,
851 true, // static function 851 true, // static function
852 false, // not const function 852 false, // not const function
853 false, // not abstract 853 false, // not abstract
854 false, // not external 854 false, // not external
855 false, // not native 855 false, // not native
856 Class::Handle(Type::Handle(Type::DartFunctionType()).type_class()), 856 Class::Handle(Type::Handle(Type::DartFunctionType()).type_class()),
857 fragment->token_pos())); 857 fragment->token_pos()));
858 858
859 func.set_result_type(Object::dynamic_type()); 859 func.set_result_type(Object::dynamic_type());
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 // if (function.HasCode()) continue; 982 // if (function.HasCode()) continue;
983 983
984 selector = function.name(); 984 selector = function.name();
985 if (IsSent(selector)) { 985 if (IsSent(selector)) {
986 AddFunction(function); 986 AddFunction(function);
987 } 987 }
988 988
989 // Handle the implicit call type conversions. 989 // Handle the implicit call type conversions.
990 if (Field::IsGetterName(selector)) { 990 if (Field::IsGetterName(selector)) {
991 selector2 = Field::NameFromGetter(selector); 991 selector2 = Field::NameFromGetter(selector);
992 selector3 = Symbols::Lookup(selector2); 992 selector3 = Symbols::Lookup(thread(), selector2);
993 if (IsSent(selector2)) { 993 if (IsSent(selector2)) {
994 // Call-through-getter. 994 // Call-through-getter.
995 // Function is get:foo and somewhere foo is called. 995 // Function is get:foo and somewhere foo is called.
996 AddFunction(function); 996 AddFunction(function);
997 } 997 }
998 selector3 = Symbols::LookupFromConcat(Symbols::ClosurizePrefix(), 998 selector3 = Symbols::LookupFromConcat(thread(),
999 selector2); 999 Symbols::ClosurizePrefix(), selector2);
1000 if (IsSent(selector3)) { 1000 if (IsSent(selector3)) {
1001 // Hash-closurization. 1001 // Hash-closurization.
1002 // Function is get:foo and somewhere get:#foo is called. 1002 // Function is get:foo and somewhere get:#foo is called.
1003 AddFunction(function); 1003 AddFunction(function);
1004 1004
1005 function2 = function.ImplicitClosureFunction(); 1005 function2 = function.ImplicitClosureFunction();
1006 AddFunction(function2); 1006 AddFunction(function2);
1007 1007
1008 // Add corresponding method extractor get:#foo. 1008 // Add corresponding method extractor get:#foo.
1009 function2 = function.GetMethodExtractor(selector3); 1009 function2 = function.GetMethodExtractor(selector3);
1010 AddFunction(function2); 1010 AddFunction(function2);
1011 } 1011 }
1012 } else if (Field::IsSetterName(selector)) { 1012 } else if (Field::IsSetterName(selector)) {
1013 selector2 = Symbols::LookupFromConcat(Symbols::ClosurizePrefix(), 1013 selector2 = Symbols::LookupFromConcat(thread(),
1014 selector); 1014 Symbols::ClosurizePrefix(), selector);
1015 if (IsSent(selector2)) { 1015 if (IsSent(selector2)) {
1016 // Hash-closurization. 1016 // Hash-closurization.
1017 // Function is set:foo and somewhere get:#set:foo is called. 1017 // Function is set:foo and somewhere get:#set:foo is called.
1018 AddFunction(function); 1018 AddFunction(function);
1019 1019
1020 function2 = function.ImplicitClosureFunction(); 1020 function2 = function.ImplicitClosureFunction();
1021 AddFunction(function2); 1021 AddFunction(function2);
1022 1022
1023 // Add corresponding method extractor get:#set:foo. 1023 // Add corresponding method extractor get:#set:foo.
1024 function2 = function.GetMethodExtractor(selector2); 1024 function2 = function.GetMethodExtractor(selector2);
1025 AddFunction(function2); 1025 AddFunction(function2);
1026 } 1026 }
1027 } else if (function.kind() == RawFunction::kRegularFunction) { 1027 } else if (function.kind() == RawFunction::kRegularFunction) {
1028 selector2 = Field::LookupGetterSymbol(selector); 1028 selector2 = Field::LookupGetterSymbol(selector);
1029 if (IsSent(selector2)) { 1029 if (IsSent(selector2)) {
1030 // Closurization. 1030 // Closurization.
1031 // Function is foo and somewhere get:foo is called. 1031 // Function is foo and somewhere get:foo is called.
1032 function2 = function.ImplicitClosureFunction(); 1032 function2 = function.ImplicitClosureFunction();
1033 AddFunction(function2); 1033 AddFunction(function2);
1034 1034
1035 // Add corresponding method extractor. 1035 // Add corresponding method extractor.
1036 function2 = function.GetMethodExtractor(selector2); 1036 function2 = function.GetMethodExtractor(selector2);
1037 AddFunction(function2); 1037 AddFunction(function2);
1038 } 1038 }
1039 selector2 = Symbols::LookupFromConcat(Symbols::ClosurizePrefix(), 1039 selector2 = Symbols::LookupFromConcat(thread(),
1040 selector); 1040 Symbols::ClosurizePrefix(), selector);
1041 if (IsSent(selector2)) { 1041 if (IsSent(selector2)) {
1042 // Hash-closurization. 1042 // Hash-closurization.
1043 // Function is foo and somewhere get:#foo is called. 1043 // Function is foo and somewhere get:#foo is called.
1044 function2 = function.ImplicitClosureFunction(); 1044 function2 = function.ImplicitClosureFunction();
1045 AddFunction(function2); 1045 AddFunction(function2);
1046 1046
1047 // Add corresponding method extractor get:#foo 1047 // Add corresponding method extractor get:#foo
1048 function2 = function.GetMethodExtractor(selector2); 1048 function2 = function.GetMethodExtractor(selector2);
1049 AddFunction(function2); 1049 AddFunction(function2);
1050 } 1050 }
(...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after
2682 CompilationPipeline::New(thread->zone(), function); 2682 CompilationPipeline::New(thread->zone(), function);
2683 2683
2684 ASSERT(FLAG_precompiled_mode); 2684 ASSERT(FLAG_precompiled_mode);
2685 const bool optimized = function.IsOptimizable(); // False for natives. 2685 const bool optimized = function.IsOptimizable(); // False for natives.
2686 return PrecompileFunctionHelper(pipeline, function, optimized); 2686 return PrecompileFunctionHelper(pipeline, function, optimized);
2687 } 2687 }
2688 2688
2689 #endif // DART_PRECOMPILER 2689 #endif // DART_PRECOMPILER
2690 2690
2691 } // namespace dart 2691 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/parser_test.cc ('k') | runtime/vm/profiler_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698