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

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 12407 matching lines...) Expand 10 before | Expand all | Expand 10 after
12418 if (type->IsResolved()) { 12418 if (type->IsResolved()) {
12419 return; 12419 return;
12420 } 12420 }
12421 // Resolve class. 12421 // Resolve class.
12422 if (!type->HasResolvedTypeClass()) { 12422 if (!type->HasResolvedTypeClass()) {
12423 const UnresolvedClass& unresolved_class = 12423 const UnresolvedClass& unresolved_class =
12424 UnresolvedClass::Handle(Z, type->unresolved_class()); 12424 UnresolvedClass::Handle(Z, type->unresolved_class());
12425 const String& unresolved_class_name = 12425 const String& unresolved_class_name =
12426 String::Handle(Z, unresolved_class.ident()); 12426 String::Handle(Z, unresolved_class.ident());
12427 Class& resolved_type_class = Class::Handle(Z); 12427 Class& resolved_type_class = Class::Handle(Z);
12428 if (unresolved_class.library_prefix() == LibraryPrefix::null()) { 12428 if (unresolved_class.library_or_library_prefix() == Object::null()) {
12429 // First check if the type is a function type parameter. 12429 // First check if the type is a function type parameter.
12430 if (!innermost_function().IsNull()) { 12430 if (!innermost_function().IsNull()) {
12431 // TODO(regis): Shortcut this lookup if no generic functions in scope. 12431 // TODO(regis): Shortcut this lookup if no generic functions in scope.
12432 TypeParameter& type_parameter = TypeParameter::ZoneHandle(Z, 12432 TypeParameter& type_parameter = TypeParameter::ZoneHandle(Z,
12433 innermost_function().LookupTypeParameter(unresolved_class_name, 12433 innermost_function().LookupTypeParameter(unresolved_class_name,
12434 NULL)); 12434 NULL));
12435 if (!type_parameter.IsNull()) { 12435 if (!type_parameter.IsNull()) {
12436 // TODO(regis): Check for absence of type arguments. 12436 // TODO(regis): Check for absence of type arguments.
12437 // For now, resolve the function type parameter to dynamic. 12437 // For now, resolve the function type parameter to dynamic.
12438 *type = Type::DynamicType(); 12438 *type = Type::DynamicType();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
12470 return; 12470 return;
12471 } 12471 }
12472 // The referenced class may not have been parsed yet. It would be wrong 12472 // The referenced class may not have been parsed yet. It would be wrong
12473 // to resolve it too early to an imported class of the same name. Only 12473 // to resolve it too early to an imported class of the same name. Only
12474 // resolve the class when a finalized type is requested. 12474 // resolve the class when a finalized type is requested.
12475 if (finalization > ClassFinalizer::kResolveTypeParameters) { 12475 if (finalization > ClassFinalizer::kResolveTypeParameters) {
12476 resolved_type_class = library_.LookupClass(unresolved_class_name); 12476 resolved_type_class = library_.LookupClass(unresolved_class_name);
12477 } 12477 }
12478 } else { 12478 } else {
12479 // Resolve class name in the scope of the library prefix. 12479 // Resolve class name in the scope of the library prefix.
12480 const LibraryPrefix& lib_prefix = 12480 const Object& prefix =
12481 LibraryPrefix::Handle(Z, unresolved_class.library_prefix()); 12481 Object::Handle(Z, unresolved_class.library_or_library_prefix());
12482 resolved_type_class = lib_prefix.LookupClass(unresolved_class_name); 12482 ASSERT(prefix.IsLibraryPrefix());
12483 resolved_type_class =
12484 LibraryPrefix::Cast(prefix).LookupClass(unresolved_class_name);
12483 } 12485 }
12484 // At this point, we can only have a parameterized_type. 12486 // At this point, we can only have a parameterized_type.
12485 const Type& parameterized_type = Type::Cast(*type); 12487 const Type& parameterized_type = Type::Cast(*type);
12486 if (!resolved_type_class.IsNull()) { 12488 if (!resolved_type_class.IsNull()) {
12487 // Replace unresolved class with resolved type class. 12489 // Replace unresolved class with resolved type class.
12488 parameterized_type.set_type_class(resolved_type_class); 12490 parameterized_type.set_type_class(resolved_type_class);
12489 } else if (finalization >= ClassFinalizer::kCanonicalize) { 12491 } else if (finalization >= ClassFinalizer::kCanonicalize) {
12490 ClassFinalizer::FinalizeMalformedType( 12492 ClassFinalizer::FinalizeMalformedType(
12491 Error::Handle(Z), // No previous error. 12493 Error::Handle(Z), // No previous error.
12492 script_, 12494 script_,
(...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after
14079 call_pos, 14081 call_pos,
14080 "redirecting factory type '%s' cannot be instantiated", 14082 "redirecting factory type '%s' cannot be instantiated",
14081 String::Handle(Z, redirect_type.UserVisibleName()).ToCString()); 14083 String::Handle(Z, redirect_type.UserVisibleName()).ToCString());
14082 } 14084 }
14083 } 14085 }
14084 if (!redirect_type.HasResolvedTypeClass()) { 14086 if (!redirect_type.HasResolvedTypeClass()) {
14085 // If the redirection type is unresolved, we convert the allocation 14087 // If the redirection type is unresolved, we convert the allocation
14086 // into throwing a type error. 14088 // into throwing a type error.
14087 const UnresolvedClass& cls = 14089 const UnresolvedClass& cls =
14088 UnresolvedClass::Handle(Z, redirect_type.unresolved_class()); 14090 UnresolvedClass::Handle(Z, redirect_type.unresolved_class());
14089 const LibraryPrefix& prefix = 14091 const LibraryPrefix& prefix = LibraryPrefix::Cast(
14090 LibraryPrefix::Handle(Z, cls.library_prefix()); 14092 Object::Handle(Z, cls.library_or_library_prefix()));
14091 if (!prefix.IsNull() && !prefix.is_loaded() && 14093 if (!prefix.IsNull() && !prefix.is_loaded() &&
14092 !FLAG_load_deferred_eagerly) { 14094 !FLAG_load_deferred_eagerly) {
14093 // If the redirection type is unresolved because it refers to 14095 // If the redirection type is unresolved because it refers to
14094 // an unloaded deferred prefix, mark this function as depending 14096 // an unloaded deferred prefix, mark this function as depending
14095 // on the library prefix. It will then get invalidated when the 14097 // on the library prefix. It will then get invalidated when the
14096 // prefix is loaded. 14098 // prefix is loaded.
14097 parsed_function()->AddDeferredPrefix(prefix); 14099 parsed_function()->AddDeferredPrefix(prefix);
14098 } 14100 }
14099 redirect_type = ClassFinalizer::NewFinalizedMalformedType( 14101 redirect_type = ClassFinalizer::NewFinalizedMalformedType(
14100 Error::Handle(Z), 14102 Error::Handle(Z),
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after
15145 const ArgumentListNode& function_args, 15147 const ArgumentListNode& function_args,
15146 const LocalVariable* temp_for_last_arg, 15148 const LocalVariable* temp_for_last_arg,
15147 bool is_super_invocation) { 15149 bool is_super_invocation) {
15148 UNREACHABLE(); 15150 UNREACHABLE();
15149 return NULL; 15151 return NULL;
15150 } 15152 }
15151 15153
15152 } // namespace dart 15154 } // namespace dart
15153 15155
15154 #endif // DART_PRECOMPILED_RUNTIME 15156 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698