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

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

Issue 11785006: Support Null type in Class::TypeTest and simplify Instance::IsInstanceOf. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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/lib/object.cc ('k') | runtime/vm/object.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) 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/flow_graph_optimizer.h" 5 #include "vm/flow_graph_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cha.h" 8 #include "vm/cha.h"
9 #include "vm/flow_graph_builder.h" 9 #include "vm/flow_graph_builder.h"
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 ASSERT(ic_data.num_args_tested() == 1); // Unary checks only. 1257 ASSERT(ic_data.num_args_tested() == 1); // Unary checks only.
1258 if (!type.IsInstantiated() || type.IsMalformed()) return Bool::null(); 1258 if (!type.IsInstantiated() || type.IsMalformed()) return Bool::null();
1259 const Class& type_class = Class::Handle(type.type_class()); 1259 const Class& type_class = Class::Handle(type.type_class());
1260 if (type_class.HasTypeArguments()) return Bool::null(); 1260 if (type_class.HasTypeArguments()) return Bool::null();
1261 const ClassTable& class_table = *Isolate::Current()->class_table(); 1261 const ClassTable& class_table = *Isolate::Current()->class_table();
1262 Bool& prev = Bool::Handle(); 1262 Bool& prev = Bool::Handle();
1263 Class& cls = Class::Handle(); 1263 Class& cls = Class::Handle();
1264 for (int i = 0; i < ic_data.NumberOfChecks(); i++) { 1264 for (int i = 0; i < ic_data.NumberOfChecks(); i++) {
1265 cls = class_table.At(ic_data.GetReceiverClassIdAt(i)); 1265 cls = class_table.At(ic_data.GetReceiverClassIdAt(i));
1266 if (cls.HasTypeArguments()) return Bool::null(); 1266 if (cls.HasTypeArguments()) return Bool::null();
1267 bool is_subtype = false; 1267 const bool is_subtype = cls.IsSubtypeOf(TypeArguments::Handle(),
1268 if (cls.IsNullClass()) { 1268 type_class,
1269 is_subtype = type_class.IsDynamicClass() || type_class.IsObjectClass(); 1269 TypeArguments::Handle(),
1270 } else { 1270 NULL);
1271 is_subtype = cls.IsSubtypeOf(TypeArguments::Handle(),
1272 type_class,
1273 TypeArguments::Handle(),
1274 NULL);
1275 }
1276 if (prev.IsNull()) { 1271 if (prev.IsNull()) {
1277 prev = is_subtype ? Bool::True().raw() : Bool::False().raw(); 1272 prev = is_subtype ? Bool::True().raw() : Bool::False().raw();
1278 } else { 1273 } else {
1279 if (is_subtype != prev.value()) return Bool::null(); 1274 if (is_subtype != prev.value()) return Bool::null();
1280 } 1275 }
1281 } 1276 }
1282 return prev.raw(); 1277 return prev.raw();
1283 } 1278 }
1284 1279
1285 1280
(...skipping 3141 matching lines...) Expand 10 before | Expand all | Expand 10 after
4427 4422
4428 if (FLAG_trace_constant_propagation) { 4423 if (FLAG_trace_constant_propagation) {
4429 OS::Print("\n==== After constant propagation ====\n"); 4424 OS::Print("\n==== After constant propagation ====\n");
4430 FlowGraphPrinter printer(*graph_); 4425 FlowGraphPrinter printer(*graph_);
4431 printer.PrintBlocks(); 4426 printer.PrintBlocks();
4432 } 4427 }
4433 } 4428 }
4434 4429
4435 4430
4436 } // namespace dart 4431 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/object.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698