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

Unified Diff: runtime/vm/code_generator.cc

Issue 11428079: Cleanup: Remove unused return value in OptimizeTypeArguments. (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 15510)
+++ runtime/vm/code_generator.cc (working copy)
@@ -402,19 +402,17 @@
// Converts InstantiatedTypeArguments to TypeArguments and stores it
// into the instance. The assembly code can handle only type arguments of
// class TypeArguments. Because of the overhead, do it only when needed.
-// Return false if the optimization was aborted.
-// Set type_arguments_replaced to true if they have changed.
-static bool OptimizeTypeArguments(const Instance& instance,
- bool* type_arguments_replaced) {
- *type_arguments_replaced = false;
+// Return true if type arguments have been replaced, false otherwise.
+static bool OptimizeTypeArguments(const Instance& instance) {
+ bool replaced = false;
const Class& type_class = Class::ZoneHandle(instance.clazz());
if (!type_class.HasTypeArguments()) {
- return true;
+ return replaced;
Vyacheslav Egorov (Google) 2012/11/29 12:57:05 return false;
}
AbstractTypeArguments& type_arguments =
AbstractTypeArguments::Handle(instance.GetTypeArguments());
if (type_arguments.IsNull()) {
- return true;
+ return replaced;
Vyacheslav Egorov (Google) 2012/11/29 12:57:05 return false;
}
if (type_arguments.IsInstantiatedTypeArguments()) {
Vyacheslav Egorov (Google) 2012/11/29 12:57:05 move variable here.
do {
@@ -431,16 +429,16 @@
AbstractTypeArguments& new_type_arguments = AbstractTypeArguments::Handle();
new_type_arguments = type_arguments.Canonicalize();
instance.SetTypeArguments(new_type_arguments);
- *type_arguments_replaced = true;
+ replaced = true;
} else if (!type_arguments.IsCanonical()) {
AbstractTypeArguments& new_type_arguments = AbstractTypeArguments::Handle();
new_type_arguments = type_arguments.Canonicalize();
instance.SetTypeArguments(new_type_arguments);
- *type_arguments_replaced = true;
+ replaced = true;
}
srdjan 2012/11/29 21:12:20 Add } else { return false; } here and remove varia
ASSERT(AbstractTypeArguments::Handle(
instance.GetTypeArguments()).IsTypeArguments());
- return true;
+ return replaced;
}
@@ -473,26 +471,11 @@
bool type_arguments_replaced = false;
if (instance_class.HasTypeArguments()) {
// Canonicalize type arguments.
- if (!OptimizeTypeArguments(instance, &type_arguments_replaced)) {
- if (FLAG_trace_type_checks) {
- PrintTypeCheck("WARNING: Cannot canonicalize instance type arguments",
- instance, type, instantiator_type_arguments, result);
- }
- return;
- }
+ type_arguments_replaced = OptimizeTypeArguments(instance);
instance_type_arguments = instance.GetTypeArguments();
}
if (!instantiator.IsNull()) {
- bool replaced = false;
- if (!OptimizeTypeArguments(instantiator, &replaced)) {
- if (FLAG_trace_type_checks) {
- PrintTypeCheck("WARNING: Cannot canonicalize instantiator "
- "type arguments",
- instance, type, instantiator_type_arguments, result);
- }
- return;
- }
- if (replaced) {
+ if (OptimizeTypeArguments(instantiator)) {
type_arguments_replaced = true;
}
instantiator_type_arguments = instantiator.GetTypeArguments();
« 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