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

Unified Diff: runtime/vm/code_generator.cc

Issue 10381045: Improve type checking, remove unused stub (removed also in x64 in preparation of porting the better… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_generator.cc
===================================================================
--- runtime/vm/code_generator.cc (revision 7391)
+++ runtime/vm/code_generator.cc (working copy)
@@ -431,24 +431,22 @@
return true;
}
if (type_arguments.IsInstantiatedTypeArguments()) {
+ AbstractTypeArguments& temp_type_arguments =
regis 2012/05/07 21:13:04 Why do you need temp_type_arguments instead of usi
srdjan 2012/05/07 21:23:12 Good point, eliminating temp_type_arguments.
+ AbstractTypeArguments::Handle(type_arguments.raw());
+ do {
+ InstantiatedTypeArguments& instantiated_type_arguments =
+ InstantiatedTypeArguments::Handle();
+ instantiated_type_arguments ^= temp_type_arguments.raw();
+ const AbstractTypeArguments& uninstantiated =
+ AbstractTypeArguments::Handle(
+ instantiated_type_arguments.uninstantiated_type_arguments());
+ const AbstractTypeArguments& instantiator =
+ AbstractTypeArguments::Handle(
+ instantiated_type_arguments.instantiator_type_arguments());
+ temp_type_arguments = uninstantiated.InstantiateFrom(instantiator);
+ } while (temp_type_arguments.IsInstantiatedTypeArguments());
TypeArguments& new_type_arguments = TypeArguments::Handle();
- InstantiatedTypeArguments& instantiated_type_arguments =
- InstantiatedTypeArguments::Handle();
- instantiated_type_arguments ^= type_arguments.raw();
- const AbstractTypeArguments& uninstantiated =
- AbstractTypeArguments::Handle(
- instantiated_type_arguments.uninstantiated_type_arguments());
- const AbstractTypeArguments& instantiator =
- AbstractTypeArguments::Handle(
- instantiated_type_arguments.instantiator_type_arguments());
- AbstractTypeArguments& temp = AbstractTypeArguments::Handle();
- temp = uninstantiated.InstantiateFrom(instantiator);
- if (!temp.IsTypeArguments()) {
- // TODO(srdjan): Figure out why it does not want to convert to
- // TypeArguments.
- return false;
- }
- new_type_arguments ^= temp.raw();
+ new_type_arguments ^= temp_type_arguments.raw();
new_type_arguments ^= new_type_arguments.Canonicalize();
instance.SetTypeArguments(new_type_arguments);
*type_arguments_replaced = true;
@@ -540,8 +538,13 @@
instantiator_type_arguments.raw())) {
if (FLAG_trace_type_checks) {
OS::Print("%d ", i);
- PrintTypeCheck("WARNING duplicate cache entry", instance, type,
- instantiator_type_arguments, result);
+ if (type_arguments_replaced) {
+ PrintTypeCheck("Duplicate cache entry (canonical.)", instance, type,
+ instantiator_type_arguments, result);
+ } else {
+ PrintTypeCheck("WARNING Duplicate cache entry", instance, type,
+ instantiator_type_arguments, result);
+ }
}
// Can occur if we have canonicalized arguments.
// TODO(srdjan): Investigate why this assert can fail.
@@ -554,6 +557,10 @@
instantiator_type_arguments,
result);
if (FLAG_trace_type_checks) {
+ AbstractType& test_type = AbstractType::Handle(type.raw());
+ if (!test_type.IsInstantiated()) {
+ test_type = type.InstantiateFrom(instantiator_type_arguments);
+ }
OS::Print(" Updated test cache 0x%x ix:%d:\n"
" [0x%x %s, 0x%x %s]\n"
" [0x%x %s, 0x%x %s] %s\n",
@@ -563,8 +570,8 @@
instance_class.ToCString(),
instance_type_arguments.raw(),
instance_type_arguments.ToCString(),
- type.type_class(),
- Class::Handle(type.type_class()).ToCString(),
+ test_type.type_class(),
+ Class::Handle(test_type.type_class()).ToCString(),
instantiator_type_arguments.raw(),
instantiator_type_arguments.ToCString(),
result.ToCString());
« no previous file with comments | « no previous file | runtime/vm/code_generator_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698