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

Unified Diff: runtime/vm/code_generator.cc

Issue 10134069: Inline type check where type argument that we check against is instantiated. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/code_generator_ia32.h » ('j') | runtime/vm/code_generator_ia32.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_generator.cc
===================================================================
--- runtime/vm/code_generator.cc (revision 7042)
+++ runtime/vm/code_generator.cc (working copy)
@@ -394,7 +394,27 @@
const bool is_raw_type = type_arguments.IsNull() ||
type_arguments.IsRaw(type_arguments.Length());
if (!is_raw_type) {
- return;
+ // We cannot inline tests for instances with more than one type argument
+ // or if its class has not been resolved (malformed type).
+ if (type_arguments.Length() != 1) {
+ // We can handle only one argument so far.
+ return;
+ }
+ const AbstractType& tp_argument =
+ AbstractType::ZoneHandle(type_arguments.TypeAt(0));
+ if (!tp_argument.IsType()) {
+ // E.g, it is TypeParameter.
+ return;
+ }
+ const Type& list_type =
+ Type::Handle(Isolate::Current()->object_store()->list_interface());
+ Error& malformed_error = Error::Handle();
+ if (!list_type.IsSubtypeOf(type, &malformed_error)) {
+ return;
+ }
+ // The type argument at index 0 must be instantiated and not malformed.
+ // A malformed type would have caused a type error earlier.
+ ASSERT(tp_argument.HasResolvedTypeClass());
}
}
DartFrameIterator iterator;
« no previous file with comments | « no previous file | runtime/vm/code_generator_ia32.h » ('j') | runtime/vm/code_generator_ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698