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

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

Issue 10911057: Add check for non-smi to the IL and use it for class checks. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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/code_generator.h ('k') | runtime/vm/intermediate_language.h » ('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/cha.h" 7 #include "vm/cha.h"
8 #include "vm/flow_graph_builder.h" 8 #include "vm/flow_graph_builder.h"
9 #include "vm/hash_map.h" 9 #include "vm/hash_map.h"
10 #include "vm/il_printer.h" 10 #include "vm/il_printer.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 return class_id; 306 return class_id;
307 } 307 }
308 308
309 309
310 void FlowGraphOptimizer::AddCheckClass(BindInstr* instr, 310 void FlowGraphOptimizer::AddCheckClass(BindInstr* instr,
311 InstanceCallComp* comp, 311 InstanceCallComp* comp,
312 Value* value) { 312 Value* value) {
313 // Type propagation has not run yet, we cannot eliminate the check. 313 // Type propagation has not run yet, we cannot eliminate the check.
314 const ICData& unary_checks = 314 const ICData& unary_checks =
315 ICData::ZoneHandle(comp->ic_data()->AsUnaryClassChecks()); 315 ICData::ZoneHandle(comp->ic_data()->AsUnaryClassChecks());
316 CheckClassComp* check = new CheckClassComp(value, comp, unary_checks); 316 CheckNonSmiComp* check_non_smi = new CheckNonSmiComp(value->Copy(),
317 InsertBefore(instr, check, instr->env(), Definition::kEffect); 317 comp->deopt_id());
318 InsertBefore(instr, check_non_smi, instr->env(), Definition::kEffect);
319 CheckClassComp* check_class = new CheckClassComp(value, comp, unary_checks);
320 InsertBefore(instr, check_class, instr->env(), Definition::kEffect);
318 } 321 }
319 322
320 323
321 bool FlowGraphOptimizer::TryReplaceWithArrayOp(BindInstr* instr, 324 bool FlowGraphOptimizer::TryReplaceWithArrayOp(BindInstr* instr,
322 InstanceCallComp* comp, 325 InstanceCallComp* comp,
323 Token::Kind op_kind) { 326 Token::Kind op_kind) {
324 // TODO(fschneider): Optimize []= operator in checked mode as well. 327 // TODO(fschneider): Optimize []= operator in checked mode as well.
325 if (op_kind == Token::kASSIGN_INDEX && FLAG_enable_type_checks) return false; 328 if (op_kind == Token::kASSIGN_INDEX && FLAG_enable_type_checks) return false;
326 329
327 const intptr_t class_id = ReceiverClassId(comp); 330 const intptr_t class_id = ReceiverClassId(comp);
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 DirectChainedHashMap<BindInstr*> child_map(*map); // Copy map. 1202 DirectChainedHashMap<BindInstr*> child_map(*map); // Copy map.
1200 OptimizeRecursive(child, &child_map); 1203 OptimizeRecursive(child, &child_map);
1201 } else { 1204 } else {
1202 OptimizeRecursive(child, map); // Reuse map for the last child. 1205 OptimizeRecursive(child, map); // Reuse map for the last child.
1203 } 1206 }
1204 } 1207 }
1205 } 1208 }
1206 1209
1207 1210
1208 } // namespace dart 1211 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.h ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698