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

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

Issue 10861017: Fix performance regression introduced by new equality semantic: we do not collect ICData when compa… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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/flow_graph_optimizer.h ('k') | 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/flow_graph_builder.h" 7 #include "vm/flow_graph_builder.h"
8 #include "vm/hash_map.h" 8 #include "vm/hash_map.h"
9 #include "vm/il_printer.h" 9 #include "vm/il_printer.h"
10 #include "vm/object_store.h" 10 #include "vm/object_store.h"
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 } else if (HasOnlyTwoDouble(ic_data)) { 594 } else if (HasOnlyTwoDouble(ic_data)) {
595 comp->set_operands_class_id(kDoubleCid); 595 comp->set_operands_class_id(kDoubleCid);
596 } else if (comp->ic_data()->AllReceiversAreNumbers()) { 596 } else if (comp->ic_data()->AllReceiversAreNumbers()) {
597 comp->set_operands_class_id(kNumberCid); 597 comp->set_operands_class_id(kNumberCid);
598 } 598 }
599 } 599 }
600 600
601 601
602 void FlowGraphOptimizer::VisitEqualityCompare(EqualityCompareComp* comp, 602 void FlowGraphOptimizer::VisitEqualityCompare(EqualityCompareComp* comp,
603 BindInstr* instr) { 603 BindInstr* instr) {
604 // If one of the inputs is null, no ICdata will be collected.
605 if (comp->left()->BindsToConstantNull() ||
606 comp->right()->BindsToConstantNull()) {
607 Token::Kind strict_kind = (comp->kind() == Token::kEQ) ?
608 Token::kEQ_STRICT : Token::kNE_STRICT;
609 StrictCompareComp* strict_comp =
610 new StrictCompareComp(strict_kind, comp->left(), comp->right());
611 instr->set_computation(strict_comp);
612 return;
613 }
604 if (!comp->HasICData() || (comp->ic_data()->NumberOfChecks() == 0)) return; 614 if (!comp->HasICData() || (comp->ic_data()->NumberOfChecks() == 0)) return;
605 if (comp->ic_data()->NumberOfChecks() == 1) { 615 if (comp->ic_data()->NumberOfChecks() == 1) {
606 ASSERT(comp->ic_data()->num_args_tested() == 2); 616 ASSERT(comp->ic_data()->num_args_tested() == 2);
607 GrowableArray<intptr_t> class_ids; 617 GrowableArray<intptr_t> class_ids;
608 Function& target = Function::Handle(); 618 Function& target = Function::Handle();
609 comp->ic_data()->GetCheckAt(0, &class_ids, &target); 619 comp->ic_data()->GetCheckAt(0, &class_ids, &target);
610 // TODO(srdjan): allow for mixed mode comparison. 620 // TODO(srdjan): allow for mixed mode comparison.
611 if ((class_ids[0] == kSmiCid) && (class_ids[1] == kSmiCid)) { 621 if ((class_ids[0] == kSmiCid) && (class_ids[1] == kSmiCid)) {
612 comp->set_receiver_class_id(kSmiCid); 622 comp->set_receiver_class_id(kSmiCid);
613 } else if ((class_ids[0] == kDoubleCid) && (class_ids[1] == kDoubleCid)) { 623 } else if ((class_ids[0] == kDoubleCid) && (class_ids[1] == kDoubleCid)) {
614 comp->set_receiver_class_id(kDoubleCid); 624 comp->set_receiver_class_id(kDoubleCid);
615 } else { 625 } else {
616 ASSERT(comp->receiver_class_id() == kIllegalCid); 626 ASSERT(comp->receiver_class_id() == kIllegalCid);
617 } 627 }
618 } else if (comp->ic_data()->AllReceiversAreNumbers()) { 628 } else if (comp->ic_data()->AllReceiversAreNumbers()) {
619 comp->set_receiver_class_id(kNumberCid); 629 comp->set_receiver_class_id(kNumberCid);
620 } 630 }
621 } 631 }
622 632
623 633
634 void FlowGraphOptimizer::VisitBranch(BranchInstr* instr) {
635 if ((instr->kind() != Token::kEQ) &&
636 (instr->kind() != Token::kNE)) {
637 return;
638 }
639 if (!instr->left()->BindsToConstantNull() &&
640 !instr->right()->BindsToConstantNull()) {
641 return;
642 }
643 Token::Kind strict_kind = (instr->kind() == Token::kEQ) ?
644 Token::kEQ_STRICT : Token::kNE_STRICT;
645 instr->set_kind(strict_kind);
646 }
647
648
624 void FlowGraphOptimizer::VisitBind(BindInstr* instr) { 649 void FlowGraphOptimizer::VisitBind(BindInstr* instr) {
625 instr->computation()->Accept(this, instr); 650 instr->computation()->Accept(this, instr);
626 } 651 }
627 652
628 653
629 void FlowGraphTypePropagator::VisitAssertAssignable(AssertAssignableComp* comp, 654 void FlowGraphTypePropagator::VisitAssertAssignable(AssertAssignableComp* comp,
630 BindInstr* instr) { 655 BindInstr* instr) {
631 if (FLAG_eliminate_type_checks && 656 if (FLAG_eliminate_type_checks &&
632 !comp->is_eliminated() && 657 !comp->is_eliminated() &&
633 comp->value()->CompileTypeIsMoreSpecificThan(comp->dst_type())) { 658 comp->value()->CompileTypeIsMoreSpecificThan(comp->dst_type())) {
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 OS::Print("Replacing v%d with v%d\n", 941 OS::Print("Replacing v%d with v%d\n",
917 instr->ssa_temp_index(), 942 instr->ssa_temp_index(),
918 result->ssa_temp_index()); 943 result->ssa_temp_index());
919 } 944 }
920 } 945 }
921 } 946 }
922 } 947 }
923 948
924 949
925 } // namespace dart 950 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698