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

Side by Side Diff: runtime/vm/flow_graph_compiler.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/flow_graph_compiler_arm.cc » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/globals.h" // Needed here to get TARGET_ARCH_XXX. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX.
6 6
7 #include "vm/flow_graph_compiler.h" 7 #include "vm/flow_graph_compiler.h"
8 8
9 #include "vm/cha.h" 9 #include "vm/cha.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 // Requires CHA, which can be applied in optimized code only, 1098 // Requires CHA, which can be applied in optimized code only,
1099 if (!FLAG_use_cha || !is_optimizing()) return false; 1099 if (!FLAG_use_cha || !is_optimizing()) return false;
1100 if (!type.IsInstantiated()) return false; 1100 if (!type.IsInstantiated()) return false;
1101 const Class& type_class = Class::Handle(type.type_class()); 1101 const Class& type_class = Class::Handle(type.type_class());
1102 // Signature classes have different type checking rules. 1102 // Signature classes have different type checking rules.
1103 if (type_class.IsSignatureClass()) return false; 1103 if (type_class.IsSignatureClass()) return false;
1104 // Could be an interface check? 1104 // Could be an interface check?
1105 if (type_class.is_implemented()) return false; 1105 if (type_class.is_implemented()) return false;
1106 const intptr_t type_cid = type_class.id(); 1106 const intptr_t type_cid = type_class.id();
1107 if (CHA::HasSubclasses(type_cid)) return false; 1107 if (CHA::HasSubclasses(type_cid)) return false;
1108 if (type_class.HasTypeArguments()) { 1108 if (type_class.NumTypeArguments() > 0) {
1109 // Only raw types can be directly compared, thus disregarding type 1109 // Only raw types can be directly compared, thus disregarding type
1110 // arguments. 1110 // arguments.
1111 const AbstractTypeArguments& type_arguments = 1111 const AbstractTypeArguments& type_arguments =
1112 AbstractTypeArguments::Handle(type.arguments()); 1112 AbstractTypeArguments::Handle(type.arguments());
1113 const bool is_raw_type = type_arguments.IsNull() || 1113 const bool is_raw_type = type_arguments.IsNull() ||
1114 type_arguments.IsRaw(type_arguments.Length()); 1114 type_arguments.IsRaw(type_arguments.Length());
1115 return is_raw_type; 1115 return is_raw_type;
1116 } 1116 }
1117 return true; 1117 return true;
1118 } 1118 }
(...skipping 15 matching lines...) Expand all
1134 1134
1135 for (int i = 0; i < len; i++) { 1135 for (int i = 0; i < len; i++) {
1136 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), 1136 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i),
1137 &Function::ZoneHandle(ic_data.GetTargetAt(i)), 1137 &Function::ZoneHandle(ic_data.GetTargetAt(i)),
1138 ic_data.GetCountAt(i))); 1138 ic_data.GetCountAt(i)));
1139 } 1139 }
1140 sorted->Sort(HighestCountFirst); 1140 sorted->Sort(HighestCountFirst);
1141 } 1141 }
1142 1142
1143 } // namespace dart 1143 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/flow_graph_compiler_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698