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

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

Issue 23102006: Skip over unfinalized interface types during a compile-time subtype check in (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/utils/utils.status » ('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) 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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after
2504 } 2504 }
2505 // Check for 'direct super type' specified in the implements clause 2505 // Check for 'direct super type' specified in the implements clause
2506 // and check for transitivity at the same time. 2506 // and check for transitivity at the same time.
2507 Array& interfaces = Array::Handle(this->interfaces()); 2507 Array& interfaces = Array::Handle(this->interfaces());
2508 AbstractType& interface = AbstractType::Handle(); 2508 AbstractType& interface = AbstractType::Handle();
2509 Class& interface_class = Class::Handle(); 2509 Class& interface_class = Class::Handle();
2510 AbstractTypeArguments& interface_args = AbstractTypeArguments::Handle(); 2510 AbstractTypeArguments& interface_args = AbstractTypeArguments::Handle();
2511 Error& args_malformed_error = Error::Handle(); 2511 Error& args_malformed_error = Error::Handle();
2512 for (intptr_t i = 0; i < interfaces.Length(); i++) { 2512 for (intptr_t i = 0; i < interfaces.Length(); i++) {
2513 interface ^= interfaces.At(i); 2513 interface ^= interfaces.At(i);
2514 if (!interface.IsFinalized()) {
2515 // We may be checking bounds at finalization time. Skipping this
2516 // unfinalized interface will postpone bound checking to run time.
2517 continue;
2518 }
2514 interface_class = interface.type_class(); 2519 interface_class = interface.type_class();
2515 interface_args = interface.arguments(); 2520 interface_args = interface.arguments();
2516 if (!interface_args.IsNull() && !interface_args.IsInstantiated()) { 2521 if (!interface_args.IsNull() && !interface_args.IsInstantiated()) {
2517 // This type class implements an interface that is parameterized with 2522 // This type class implements an interface that is parameterized with
2518 // generic type(s), e.g. it implements List<T>. 2523 // generic type(s), e.g. it implements List<T>.
2519 // The uninstantiated type T must be instantiated using the type 2524 // The uninstantiated type T must be instantiated using the type
2520 // parameters of this type before performing the type test. 2525 // parameters of this type before performing the type test.
2521 // The type arguments of this type that are referred to by the type 2526 // The type arguments of this type that are referred to by the type
2522 // parameters of the interface are at the end of the type vector, 2527 // parameters of the interface are at the end of the type vector,
2523 // after the type arguments of the super type of this type. 2528 // after the type arguments of the super type of this type.
2524 // The index of the type parameters is adjusted upon finalization. 2529 // The index of the type parameters is adjusted upon finalization.
2525 ASSERT(interface.IsFinalized());
2526 args_malformed_error = Error::null(); 2530 args_malformed_error = Error::null();
2527 interface_args = interface_args.InstantiateFrom(type_arguments, 2531 interface_args = interface_args.InstantiateFrom(type_arguments,
2528 &args_malformed_error); 2532 &args_malformed_error);
2529 if (!args_malformed_error.IsNull()) { 2533 if (!args_malformed_error.IsNull()) {
2530 // Return the first malformed error to the caller if it requests it. 2534 // Return the first malformed error to the caller if it requests it.
2531 if ((malformed_error != NULL) && malformed_error->IsNull()) { 2535 if ((malformed_error != NULL) && malformed_error->IsNull()) {
2532 *malformed_error = args_malformed_error.raw(); 2536 *malformed_error = args_malformed_error.raw();
2533 } 2537 }
2534 continue; // Another interface may work better. 2538 continue; // Another interface may work better.
2535 } 2539 }
(...skipping 12121 matching lines...) Expand 10 before | Expand all | Expand 10 after
14657 } 14661 }
14658 14662
14659 14663
14660 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 14664 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
14661 stream->OpenObject(); 14665 stream->OpenObject();
14662 stream->CloseObject(); 14666 stream->CloseObject();
14663 } 14667 }
14664 14668
14665 14669
14666 } // namespace dart 14670 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/utils/utils.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698