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

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

Issue 10876079: Clean up LoadInstanceField and StoreInstanceField. (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
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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 return false; 465 return false;
466 } 466 }
467 // Inline implicit instance getter. 467 // Inline implicit instance getter.
468 const String& field_name = 468 const String& field_name =
469 String::Handle(Field::NameFromGetter(comp->function_name())); 469 String::Handle(Field::NameFromGetter(comp->function_name()));
470 const Field& field = Field::Handle(GetField(class_ids[0], field_name)); 470 const Field& field = Field::Handle(GetField(class_ids[0], field_name));
471 ASSERT(!field.IsNull()); 471 ASSERT(!field.IsNull());
472 472
473 AddCheckClass(instr, comp, comp->ArgumentAt(0)->value()->CopyValue()); 473 AddCheckClass(instr, comp, comp->ArgumentAt(0)->value()->CopyValue());
474 LoadInstanceFieldComp* load = 474 LoadInstanceFieldComp* load =
475 new LoadInstanceFieldComp(field, 475 new LoadInstanceFieldComp(field, comp->ArgumentAt(0)->value());
476 comp->ArgumentAt(0)->value(),
477 NULL); // Can not deoptimize.
478 instr->set_computation(load); 476 instr->set_computation(load);
479 RemovePushArguments(comp); 477 RemovePushArguments(comp);
480 return true; 478 return true;
481 } 479 }
482 480
483 // Not an implicit getter. 481 // Not an implicit getter.
484 MethodRecognizer::Kind recognized_kind = 482 MethodRecognizer::Kind recognized_kind =
485 MethodRecognizer::RecognizeKind(target); 483 MethodRecognizer::RecognizeKind(target);
486 484
487 // VM objects length getter. 485 // VM objects length getter.
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 // Inline implicit instance setter. 662 // Inline implicit instance setter.
665 const String& field_name = 663 const String& field_name =
666 String::Handle(Field::NameFromSetter(comp->function_name())); 664 String::Handle(Field::NameFromSetter(comp->function_name()));
667 const Field& field = Field::Handle(GetField(class_id, field_name)); 665 const Field& field = Field::Handle(GetField(class_id, field_name));
668 ASSERT(!field.IsNull()); 666 ASSERT(!field.IsNull());
669 667
670 AddCheckClass(instr, comp, comp->ArgumentAt(0)->value()->CopyValue()); 668 AddCheckClass(instr, comp, comp->ArgumentAt(0)->value()->CopyValue());
671 StoreInstanceFieldComp* store = new StoreInstanceFieldComp( 669 StoreInstanceFieldComp* store = new StoreInstanceFieldComp(
672 field, 670 field,
673 comp->ArgumentAt(0)->value(), 671 comp->ArgumentAt(0)->value(),
674 comp->ArgumentAt(1)->value(), 672 comp->ArgumentAt(1)->value());
675 NULL); // Can not deoptimize.
676 instr->set_computation(store); 673 instr->set_computation(store);
677 RemovePushArguments(comp); 674 RemovePushArguments(comp);
678 return true; 675 return true;
679 } 676 }
680 677
681 678
682 void FlowGraphOptimizer::VisitRelationalOp(RelationalOpComp* comp, 679 void FlowGraphOptimizer::VisitRelationalOp(RelationalOpComp* comp,
683 BindInstr* instr) { 680 BindInstr* instr) {
684 if (!comp->HasICData()) return; 681 if (!comp->HasICData()) return;
685 682
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 DirectChainedHashMap<BindInstr*> child_map(*map); // Copy map. 1045 DirectChainedHashMap<BindInstr*> child_map(*map); // Copy map.
1049 OptimizeRecursive(child, &child_map); 1046 OptimizeRecursive(child, &child_map);
1050 } else { 1047 } else {
1051 OptimizeRecursive(child, map); // Reuse map for the last child. 1048 OptimizeRecursive(child, map); // Reuse map for the last child.
1052 } 1049 }
1053 } 1050 }
1054 } 1051 }
1055 1052
1056 1053
1057 } // namespace dart 1054 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698