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

Unified Diff: runtime/vm/code_generator.cc

Issue 11369204: Do not add InstantiatedTypeArgument entries into cache as they cannot be canonicalized. Limit the m… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | 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 14816)
+++ runtime/vm/code_generator.cc (working copy)
@@ -47,6 +47,8 @@
DEFINE_FLAG(charp, optimization_filter, NULL, "Optimize only named function");
DEFINE_FLAG(bool, trace_failed_optimization_attempts, false,
"Traces all failed optimization attempts");
+DEFINE_FLAG(int, max_subtype_cache_entries, 100,
+ "Maximum number of subtype cache entries (number of checks cached).");
DEFINE_RUNTIME_ENTRY(TraceFunctionEntry, 1) {
@@ -495,7 +497,10 @@
AbstractTypeArguments& last_instantiator_type_arguments =
AbstractTypeArguments::Handle();
Bool& last_result = Bool::Handle();
- intptr_t len = new_cache.NumberOfChecks();
+ const intptr_t len = new_cache.NumberOfChecks();
+ if (len >= FLAG_max_subtype_cache_entries) {
+ return;
+ }
for (intptr_t i = 0; i < len; ++i) {
new_cache.GetCheck(
i,
@@ -523,25 +528,34 @@
return;
}
}
- new_cache.AddCheck(instance_class.id(),
- instance_type_arguments,
- instantiator_type_arguments,
- result);
+ if (!instantiator_type_arguments.IsInstantiatedTypeArguments()) {
+ new_cache.AddCheck(instance_class.id(),
+ instance_type_arguments,
+ 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 %p ix:%"Pd":\n"
+ OS::Print(" Updated test cache %p ix: %"Pd" with (%"Pd", %p, %p, %s)\n"
" [%p %s %"Pd", %p %s]\n"
" [%p %s %"Pd", %p %s] %s\n",
new_cache.raw(),
len,
+ instance_class.id(),
+
+ instance_type_arguments.raw(),
+ instantiator_type_arguments.raw(),
+ result.ToCString(),
+
instance_class.raw(),
instance_class.ToCString(),
instance_class.id(),
instance_type_arguments.raw(),
instance_type_arguments.ToCString(),
+
test_type.type_class(),
Class::Handle(test_type.type_class()).ToCString(),
Class::Handle(test_type.type_class()).id(),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698