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

Side by Side Diff: runtime/vm/flow_graph_compiler.cc

Issue 154393003: Implement eager instantiation and canonicalization of type arguments at run (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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
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 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 // Could be an interface check? 1233 // Could be an interface check?
1234 if (type_class.is_implemented()) return false; 1234 if (type_class.is_implemented()) return false;
1235 const intptr_t type_cid = type_class.id(); 1235 const intptr_t type_cid = type_class.id();
1236 if (CHA::HasSubclasses(type_cid)) return false; 1236 if (CHA::HasSubclasses(type_cid)) return false;
1237 const intptr_t num_type_args = type_class.NumTypeArguments(); 1237 const intptr_t num_type_args = type_class.NumTypeArguments();
1238 if (num_type_args > 0) { 1238 if (num_type_args > 0) {
1239 // Only raw types can be directly compared, thus disregarding type 1239 // Only raw types can be directly compared, thus disregarding type
1240 // arguments. 1240 // arguments.
1241 const intptr_t num_type_params = type_class.NumTypeParameters(); 1241 const intptr_t num_type_params = type_class.NumTypeParameters();
1242 const intptr_t from_index = num_type_args - num_type_params; 1242 const intptr_t from_index = num_type_args - num_type_params;
1243 const AbstractTypeArguments& type_arguments = 1243 const TypeArguments& type_arguments =
1244 AbstractTypeArguments::Handle(type.arguments()); 1244 TypeArguments::Handle(type.arguments());
1245 const bool is_raw_type = type_arguments.IsNull() || 1245 const bool is_raw_type = type_arguments.IsNull() ||
1246 type_arguments.IsRaw(from_index, num_type_params); 1246 type_arguments.IsRaw(from_index, num_type_params);
1247 return is_raw_type; 1247 return is_raw_type;
1248 } 1248 }
1249 return true; 1249 return true;
1250 } 1250 }
1251 1251
1252 1252
1253 static int HighestCountFirst(const CidTarget* a, const CidTarget* b) { 1253 static int HighestCountFirst(const CidTarget* a, const CidTarget* b) {
1254 // Negative if 'a' should sort before 'b'. 1254 // Negative if 'a' should sort before 'b'.
(...skipping 11 matching lines...) Expand all
1266 1266
1267 for (int i = 0; i < len; i++) { 1267 for (int i = 0; i < len; i++) {
1268 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), 1268 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i),
1269 &Function::ZoneHandle(ic_data.GetTargetAt(i)), 1269 &Function::ZoneHandle(ic_data.GetTargetAt(i)),
1270 ic_data.GetCountAt(i))); 1270 ic_data.GetCountAt(i)));
1271 } 1271 }
1272 sorted->Sort(HighestCountFirst); 1272 sorted->Sort(HighestCountFirst);
1273 } 1273 }
1274 1274
1275 } // namespace dart 1275 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698