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

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

Issue 21081003: Fix incorrectly factored-out code in https://codereview.chromium.org/20468002/ (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | « 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 2759 matching lines...) Expand 10 before | Expand all | Expand 10 after
2770 2770
2771 2771
2772 static bool SmiFitsInDouble() { return kSmiBits < 53; } 2772 static bool SmiFitsInDouble() { return kSmiBits < 53; }
2773 2773
2774 2774
2775 void FlowGraphOptimizer::HandleComparison(ComparisonInstr* comp, 2775 void FlowGraphOptimizer::HandleComparison(ComparisonInstr* comp,
2776 const ICData& ic_data, 2776 const ICData& ic_data,
2777 Instruction* current_instruction) { 2777 Instruction* current_instruction) {
2778 ASSERT(ic_data.num_args_tested() == 2); 2778 ASSERT(ic_data.num_args_tested() == 2);
2779 ASSERT(comp->operation_cid() == kIllegalCid); 2779 ASSERT(comp->operation_cid() == kIllegalCid);
2780 Instruction* instr = current_iterator()->Current();
2781 if (HasOnlyTwoSmis(ic_data)) { 2780 if (HasOnlyTwoSmis(ic_data)) {
2782 InsertBefore(instr, 2781 InsertBefore(current_instruction,
2783 new CheckSmiInstr(comp->left()->Copy(), comp->deopt_id()), 2782 new CheckSmiInstr(comp->left()->Copy(), comp->deopt_id()),
2784 instr->env(), 2783 current_instruction->env(),
2785 Definition::kEffect); 2784 Definition::kEffect);
2786 InsertBefore(instr, 2785 InsertBefore(current_instruction,
2787 new CheckSmiInstr(comp->right()->Copy(), comp->deopt_id()), 2786 new CheckSmiInstr(comp->right()->Copy(), comp->deopt_id()),
2788 instr->env(), 2787 current_instruction->env(),
2789 Definition::kEffect); 2788 Definition::kEffect);
2790 comp->set_operation_cid(kSmiCid); 2789 comp->set_operation_cid(kSmiCid);
2791 } else if (HasTwoMintOrSmi(ic_data) && 2790 } else if (HasTwoMintOrSmi(ic_data) &&
2792 FlowGraphCompiler::SupportsUnboxedMints()) { 2791 FlowGraphCompiler::SupportsUnboxedMints()) {
2793 comp->set_operation_cid(kMintCid); 2792 comp->set_operation_cid(kMintCid);
2794 } else if (HasTwoDoubleOrSmi(ic_data)) { 2793 } else if (HasTwoDoubleOrSmi(ic_data)) {
2795 // Use double comparison. 2794 // Use double comparison.
2796 if (SmiFitsInDouble()) { 2795 if (SmiFitsInDouble()) {
2797 comp->set_operation_cid(kDoubleCid); 2796 comp->set_operation_cid(kDoubleCid);
2798 } else { 2797 } else {
2799 if (ICDataHasReceiverArgumentClassIds(ic_data, kSmiCid, kSmiCid)) { 2798 if (ICDataHasReceiverArgumentClassIds(ic_data, kSmiCid, kSmiCid)) {
2800 // We cannot use double comparison on two Smi-s. 2799 // We cannot use double comparison on two Smi-s.
2801 ASSERT(comp->operation_cid() == kIllegalCid); 2800 ASSERT(comp->operation_cid() == kIllegalCid);
2802 } else { 2801 } else {
2803 InsertBefore(instr, 2802 InsertBefore(current_instruction,
2804 new CheckEitherNonSmiInstr(comp->left()->Copy(), 2803 new CheckEitherNonSmiInstr(comp->left()->Copy(),
2805 comp->right()->Copy(), 2804 comp->right()->Copy(),
2806 comp->deopt_id()), 2805 comp->deopt_id()),
2807 instr->env(), 2806 current_instruction->env(),
2808 Definition::kEffect); 2807 Definition::kEffect);
2809 comp->set_operation_cid(kDoubleCid); 2808 comp->set_operation_cid(kDoubleCid);
2810 } 2809 }
2811 } 2810 }
2812 } else { 2811 } else {
2813 ASSERT(comp->operation_cid() == kIllegalCid); 2812 ASSERT(comp->operation_cid() == kIllegalCid);
2814 } 2813 }
2815 } 2814 }
2816 2815
2817 2816
(...skipping 4549 matching lines...) Expand 10 before | Expand all | Expand 10 after
7367 7366
7368 // Insert materializations at environment uses. 7367 // Insert materializations at environment uses.
7369 const Class& cls = Class::Handle(alloc->constructor().Owner()); 7368 const Class& cls = Class::Handle(alloc->constructor().Owner());
7370 for (intptr_t i = 0; i < exits.length(); i++) { 7369 for (intptr_t i = 0; i < exits.length(); i++) {
7371 CreateMaterializationAt(exits[i], alloc, cls, *fields); 7370 CreateMaterializationAt(exits[i], alloc, cls, *fields);
7372 } 7371 }
7373 } 7372 }
7374 7373
7375 7374
7376 } // namespace dart 7375 } // 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