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

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

Issue 11453008: Avoid unneccary handle allocation in OptimizeTypeArguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 | « no previous file | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/code_generator.h" 5 #include "vm/code_generator.h"
6 6
7 #include "vm/assembler_macros.h" 7 #include "vm/assembler_macros.h"
8 #include "vm/ast.h" 8 #include "vm/ast.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 if (!type_class.HasTypeArguments()) { 408 if (!type_class.HasTypeArguments()) {
409 return false; 409 return false;
410 } 410 }
411 AbstractTypeArguments& type_arguments = 411 AbstractTypeArguments& type_arguments =
412 AbstractTypeArguments::Handle(instance.GetTypeArguments()); 412 AbstractTypeArguments::Handle(instance.GetTypeArguments());
413 if (type_arguments.IsNull()) { 413 if (type_arguments.IsNull()) {
414 return false; 414 return false;
415 } 415 }
416 bool replaced = false; 416 bool replaced = false;
417 if (type_arguments.IsInstantiatedTypeArguments()) { 417 if (type_arguments.IsInstantiatedTypeArguments()) {
418 AbstractTypeArguments& uninstantiated = AbstractTypeArguments::Handle();
419 AbstractTypeArguments& instantiator = AbstractTypeArguments::Handle();
418 do { 420 do {
419 const InstantiatedTypeArguments& instantiated_type_arguments = 421 const InstantiatedTypeArguments& instantiated_type_arguments =
420 InstantiatedTypeArguments::Cast(type_arguments); 422 InstantiatedTypeArguments::Cast(type_arguments);
421 const AbstractTypeArguments& uninstantiated = 423 uninstantiated =
422 AbstractTypeArguments::Handle( 424 instantiated_type_arguments.uninstantiated_type_arguments();
423 instantiated_type_arguments.uninstantiated_type_arguments()); 425 instantiator = instantiated_type_arguments.instantiator_type_arguments();
424 const AbstractTypeArguments& instantiator =
425 AbstractTypeArguments::Handle(
426 instantiated_type_arguments.instantiator_type_arguments());
427 type_arguments = uninstantiated.InstantiateFrom(instantiator); 426 type_arguments = uninstantiated.InstantiateFrom(instantiator);
428 } while (type_arguments.IsInstantiatedTypeArguments()); 427 } while (type_arguments.IsInstantiatedTypeArguments());
429 AbstractTypeArguments& new_type_arguments = AbstractTypeArguments::Handle(); 428 AbstractTypeArguments& new_type_arguments = AbstractTypeArguments::Handle();
430 new_type_arguments = type_arguments.Canonicalize(); 429 new_type_arguments = type_arguments.Canonicalize();
431 instance.SetTypeArguments(new_type_arguments); 430 instance.SetTypeArguments(new_type_arguments);
432 replaced = true; 431 replaced = true;
433 } else if (!type_arguments.IsCanonical()) { 432 } else if (!type_arguments.IsCanonical()) {
434 AbstractTypeArguments& new_type_arguments = AbstractTypeArguments::Handle(); 433 AbstractTypeArguments& new_type_arguments = AbstractTypeArguments::Handle();
435 new_type_arguments = type_arguments.Canonicalize(); 434 new_type_arguments = type_arguments.Canonicalize();
436 instance.SetTypeArguments(new_type_arguments); 435 instance.SetTypeArguments(new_type_arguments);
(...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after
1878 Isolate* isolate = Isolate::Current(); 1877 Isolate* isolate = Isolate::Current();
1879 StackZone zone(isolate); 1878 StackZone zone(isolate);
1880 HANDLESCOPE(isolate); 1879 HANDLESCOPE(isolate);
1881 const Bigint& big_left = Bigint::Handle(left); 1880 const Bigint& big_left = Bigint::Handle(left);
1882 const Bigint& big_right = Bigint::Handle(right); 1881 const Bigint& big_right = Bigint::Handle(right);
1883 return BigintOperations::Compare(big_left, big_right); 1882 return BigintOperations::Compare(big_left, big_right);
1884 } 1883 }
1885 END_LEAF_RUNTIME_ENTRY 1884 END_LEAF_RUNTIME_ENTRY
1886 1885
1887 } // namespace dart 1886 } // namespace dart
OLDNEW
« 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