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

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

Issue 10868109: Factored out code, based on Florian's recent submit. (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 | « 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/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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 return; 600 return;
601 } 601 }
602 const intptr_t kMaxChecks = 4; 602 const intptr_t kMaxChecks = 4;
603 if (comp->ic_data()->NumberOfChecks() <= kMaxChecks) { 603 if (comp->ic_data()->NumberOfChecks() <= kMaxChecks) {
604 const ICData& unary_checks = 604 const ICData& unary_checks =
605 ICData::ZoneHandle(comp->ic_data()->AsUnaryClassChecks()); 605 ICData::ZoneHandle(comp->ic_data()->AsUnaryClassChecks());
606 bool call_with_checks; 606 bool call_with_checks;
607 // TODO(srdjan): Add check class comp for mixed smi/non-smi. 607 // TODO(srdjan): Add check class comp for mixed smi/non-smi.
608 if (HasOneTarget(unary_checks) && 608 if (HasOneTarget(unary_checks) &&
609 (unary_checks.GetReceiverClassIdAt(0) != kSmiCid)) { 609 (unary_checks.GetReceiverClassIdAt(0) != kSmiCid)) {
610 Value* value = comp->ArgumentAt(0)->value()->CopyValue();
611 // Type propagation has not run yet, we cannot eliminate the check. 610 // Type propagation has not run yet, we cannot eliminate the check.
612 CheckClassComp* check = new CheckClassComp(value, comp); 611 AddCheckClass(instr, comp, comp->ArgumentAt(0)->value()->CopyValue());
613 check->set_ic_data(&unary_checks);
614 InsertBefore(instr, check, instr->env(), BindInstr::kUnused);
615 // Call can still deoptimize, do not detach environment from instr. 612 // Call can still deoptimize, do not detach environment from instr.
616 call_with_checks = false; 613 call_with_checks = false;
617 } else { 614 } else {
618 call_with_checks = true; 615 call_with_checks = true;
619 } 616 }
620 PolymorphicInstanceCallComp* call = 617 PolymorphicInstanceCallComp* call =
621 new PolymorphicInstanceCallComp(comp, call_with_checks); 618 new PolymorphicInstanceCallComp(comp, call_with_checks);
622 call->set_ic_data(&unary_checks); 619 call->set_ic_data(&unary_checks);
623 instr->set_computation(call); 620 instr->set_computation(call);
624 } 621 }
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 DirectChainedHashMap<BindInstr*> child_map(*map); // Copy map. 1049 DirectChainedHashMap<BindInstr*> child_map(*map); // Copy map.
1053 OptimizeRecursive(child, &child_map); 1050 OptimizeRecursive(child, &child_map);
1054 } else { 1051 } else {
1055 OptimizeRecursive(child, map); // Reuse map for the last child. 1052 OptimizeRecursive(child, map); // Reuse map for the last child.
1056 } 1053 }
1057 } 1054 }
1058 } 1055 }
1059 1056
1060 1057
1061 } // namespace dart 1058 } // 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