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

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

Issue 2485993002: VM: Support bootstrapping core libraries from Kernel binaries instead of source. (Closed)
Patch Set: Done Created 4 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/parser.h" 5 #include "vm/parser.h"
6 #include "vm/flags.h" 6 #include "vm/flags.h"
7 7
8 #ifndef DART_PRECOMPILED_RUNTIME 8 #ifndef DART_PRECOMPILED_RUNTIME
9 9
10 #include "lib/invocation_mirror.h" 10 #include "lib/invocation_mirror.h"
(...skipping 11847 matching lines...) Expand 10 before | Expand all | Expand 10 after
11858 if (type->IsResolved()) { 11858 if (type->IsResolved()) {
11859 return; 11859 return;
11860 } 11860 }
11861 // Resolve class. 11861 // Resolve class.
11862 if (!type->HasResolvedTypeClass()) { 11862 if (!type->HasResolvedTypeClass()) {
11863 const UnresolvedClass& unresolved_class = 11863 const UnresolvedClass& unresolved_class =
11864 UnresolvedClass::Handle(Z, type->unresolved_class()); 11864 UnresolvedClass::Handle(Z, type->unresolved_class());
11865 const String& unresolved_class_name = 11865 const String& unresolved_class_name =
11866 String::Handle(Z, unresolved_class.ident()); 11866 String::Handle(Z, unresolved_class.ident());
11867 Class& resolved_type_class = Class::Handle(Z); 11867 Class& resolved_type_class = Class::Handle(Z);
11868 if (unresolved_class.library_prefix() == LibraryPrefix::null()) { 11868 if (unresolved_class.library_or_library_prefix() == Object::null()) {
11869 // First check if the type is a function type parameter. 11869 // First check if the type is a function type parameter.
11870 if (!innermost_function().IsNull()) { 11870 if (!innermost_function().IsNull()) {
11871 // TODO(regis): Shortcut this lookup if no generic functions in scope. 11871 // TODO(regis): Shortcut this lookup if no generic functions in scope.
11872 TypeParameter& type_parameter = TypeParameter::ZoneHandle( 11872 TypeParameter& type_parameter = TypeParameter::ZoneHandle(
11873 Z, innermost_function().LookupTypeParameter(unresolved_class_name, 11873 Z, innermost_function().LookupTypeParameter(unresolved_class_name,
11874 NULL)); 11874 NULL));
11875 if (!type_parameter.IsNull()) { 11875 if (!type_parameter.IsNull()) {
11876 // TODO(regis): Check for absence of type arguments. 11876 // TODO(regis): Check for absence of type arguments.
11877 // For now, resolve the function type parameter to dynamic. 11877 // For now, resolve the function type parameter to dynamic.
11878 *type = Type::DynamicType(); 11878 *type = Type::DynamicType();
(...skipping 29 matching lines...) Expand all
11908 return; 11908 return;
11909 } 11909 }
11910 // The referenced class may not have been parsed yet. It would be wrong 11910 // The referenced class may not have been parsed yet. It would be wrong
11911 // to resolve it too early to an imported class of the same name. Only 11911 // to resolve it too early to an imported class of the same name. Only
11912 // resolve the class when a finalized type is requested. 11912 // resolve the class when a finalized type is requested.
11913 if (finalization > ClassFinalizer::kResolveTypeParameters) { 11913 if (finalization > ClassFinalizer::kResolveTypeParameters) {
11914 resolved_type_class = library_.LookupClass(unresolved_class_name); 11914 resolved_type_class = library_.LookupClass(unresolved_class_name);
11915 } 11915 }
11916 } else { 11916 } else {
11917 // Resolve class name in the scope of the library prefix. 11917 // Resolve class name in the scope of the library prefix.
11918 const LibraryPrefix& lib_prefix = 11918 const Object& prefix =
11919 LibraryPrefix::Handle(Z, unresolved_class.library_prefix()); 11919 Object::Handle(Z, unresolved_class.library_or_library_prefix());
11920 resolved_type_class = lib_prefix.LookupClass(unresolved_class_name); 11920 ASSERT(prefix.IsLibraryPrefix());
11921 resolved_type_class =
11922 LibraryPrefix::Cast(prefix).LookupClass(unresolved_class_name);
11921 } 11923 }
11922 // At this point, we can only have a parameterized_type. 11924 // At this point, we can only have a parameterized_type.
11923 const Type& parameterized_type = Type::Cast(*type); 11925 const Type& parameterized_type = Type::Cast(*type);
11924 if (!resolved_type_class.IsNull()) { 11926 if (!resolved_type_class.IsNull()) {
11925 // Replace unresolved class with resolved type class. 11927 // Replace unresolved class with resolved type class.
11926 parameterized_type.set_type_class(resolved_type_class); 11928 parameterized_type.set_type_class(resolved_type_class);
11927 } else if (finalization >= ClassFinalizer::kCanonicalize) { 11929 } else if (finalization >= ClassFinalizer::kCanonicalize) {
11928 ClassFinalizer::FinalizeMalformedType( 11930 ClassFinalizer::FinalizeMalformedType(
11929 Error::Handle(Z), // No previous error. 11931 Error::Handle(Z), // No previous error.
11930 script_, parameterized_type, "type '%s' is not loaded", 11932 script_, parameterized_type, "type '%s' is not loaded",
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after
13445 error, script_, call_pos, 13447 error, script_, call_pos,
13446 "redirecting factory type '%s' cannot be instantiated", 13448 "redirecting factory type '%s' cannot be instantiated",
13447 String::Handle(Z, redirect_type.UserVisibleName()).ToCString()); 13449 String::Handle(Z, redirect_type.UserVisibleName()).ToCString());
13448 } 13450 }
13449 } 13451 }
13450 if (!redirect_type.HasResolvedTypeClass()) { 13452 if (!redirect_type.HasResolvedTypeClass()) {
13451 // If the redirection type is unresolved, we convert the allocation 13453 // If the redirection type is unresolved, we convert the allocation
13452 // into throwing a type error. 13454 // into throwing a type error.
13453 const UnresolvedClass& cls = 13455 const UnresolvedClass& cls =
13454 UnresolvedClass::Handle(Z, redirect_type.unresolved_class()); 13456 UnresolvedClass::Handle(Z, redirect_type.unresolved_class());
13455 const LibraryPrefix& prefix = 13457 const LibraryPrefix& prefix = LibraryPrefix::Cast(
13456 LibraryPrefix::Handle(Z, cls.library_prefix()); 13458 Object::Handle(Z, cls.library_or_library_prefix()));
13457 if (!prefix.IsNull() && !prefix.is_loaded() && 13459 if (!prefix.IsNull() && !prefix.is_loaded() &&
13458 !FLAG_load_deferred_eagerly) { 13460 !FLAG_load_deferred_eagerly) {
13459 // If the redirection type is unresolved because it refers to 13461 // If the redirection type is unresolved because it refers to
13460 // an unloaded deferred prefix, mark this function as depending 13462 // an unloaded deferred prefix, mark this function as depending
13461 // on the library prefix. It will then get invalidated when the 13463 // on the library prefix. It will then get invalidated when the
13462 // prefix is loaded. 13464 // prefix is loaded.
13463 parsed_function()->AddDeferredPrefix(prefix); 13465 parsed_function()->AddDeferredPrefix(prefix);
13464 } 13466 }
13465 redirect_type = ClassFinalizer::NewFinalizedMalformedType( 13467 redirect_type = ClassFinalizer::NewFinalizedMalformedType(
13466 Error::Handle(Z), script_, call_pos, 13468 Error::Handle(Z), script_, call_pos,
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
14485 const ArgumentListNode& function_args, 14487 const ArgumentListNode& function_args,
14486 const LocalVariable* temp_for_last_arg, 14488 const LocalVariable* temp_for_last_arg,
14487 bool is_super_invocation) { 14489 bool is_super_invocation) {
14488 UNREACHABLE(); 14490 UNREACHABLE();
14489 return NULL; 14491 return NULL;
14490 } 14492 }
14491 14493
14492 } // namespace dart 14494 } // namespace dart
14493 14495
14494 #endif // DART_PRECOMPILED_RUNTIME 14496 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698