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

Unified Diff: runtime/vm/code_generator.cc

Issue 26682003: Cache number of type arguments in class object instead of recalculating it. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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 | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/dart_api_impl.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 28669)
+++ runtime/vm/code_generator.cc (working copy)
@@ -111,7 +111,7 @@
const Class& cls = Class::CheckedHandle(arguments.ArgAt(0));
const Instance& instance = Instance::Handle(Instance::New(cls));
arguments.SetReturn(instance);
- if (!cls.HasTypeArguments()) {
+ if (cls.NumTypeArguments() == 0) {
// No type arguments required for a non-parameterized type.
ASSERT(Instance::CheckedHandle(arguments.ArgAt(1)).IsNull());
return;
@@ -165,7 +165,7 @@
const Class& cls = Class::CheckedHandle(arguments.ArgAt(0));
const Instance& instance = Instance::Handle(Instance::New(cls));
arguments.SetReturn(instance);
- ASSERT(cls.HasTypeArguments());
+ ASSERT(cls.NumTypeArguments() > 0);
AbstractTypeArguments& type_arguments =
AbstractTypeArguments::CheckedHandle(arguments.ArgAt(1));
if (Object::Handle(arguments.ArgAt(2)).IsSmi()) {
@@ -372,7 +372,7 @@
// Return true if type arguments have been replaced, false otherwise.
static bool OptimizeTypeArguments(const Instance& instance) {
const Class& type_class = Class::ZoneHandle(instance.clazz());
- if (!type_class.HasTypeArguments()) {
+ if (type_class.NumTypeArguments() == 0) {
return false;
}
AbstractTypeArguments& type_arguments =
@@ -438,7 +438,7 @@
// Canonicalize type arguments.
bool type_arguments_replaced = false;
- if (instance_class.HasTypeArguments()) {
+ if (instance_class.NumTypeArguments() > 0) {
// Canonicalize type arguments.
type_arguments_replaced = OptimizeTypeArguments(instance);
instance_type_arguments = instance.GetTypeArguments();
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698