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

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

Issue 10918097: Allow smi comparisons to have constant operands. (Closed) Base URL: https://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/globals.h" // Needed here to get TARGET_ARCH_XXX. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX.
6 6
7 #include "vm/flow_graph_compiler.h" 7 #include "vm/flow_graph_compiler.h"
8 8
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/debugger.h" 10 #include "vm/debugger.h"
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 EmitSwap(index); 800 EmitSwap(index);
801 return; 801 return;
802 } 802 }
803 } 803 }
804 804
805 // This move is not blocked. 805 // This move is not blocked.
806 EmitMove(index); 806 EmitMove(index);
807 } 807 }
808 808
809 809
810 Condition FlowGraphCompiler::FlipCondition(Condition condition) {
811 switch (condition) {
812 case EQUAL: return EQUAL;
813 case NOT_EQUAL: return NOT_EQUAL;
814 case LESS: return GREATER;
815 case LESS_EQUAL: return GREATER_EQUAL;
816 case GREATER: return LESS;
817 case GREATER_EQUAL: return LESS_EQUAL;
818 case BELOW: return ABOVE;
819 case BELOW_EQUAL: return ABOVE_EQUAL;
820 case ABOVE: return BELOW;
821 case ABOVE_EQUAL: return BELOW_EQUAL;
822 default:
823 UNIMPLEMENTED();
824 return EQUAL;
825 }
826 }
827
828
829 bool FlowGraphCompiler::EvaluateCondition(Condition condition,
830 intptr_t left,
831 intptr_t right) {
832 const uintptr_t unsigned_left = static_cast<uintptr_t>(left);
833 const uintptr_t unsigned_right = static_cast<uintptr_t>(right);
834 switch (condition) {
835 case EQUAL: return left == right;
836 case NOT_EQUAL: return left != right;
837 case LESS: return left < right;
838 case LESS_EQUAL: return left <= right;
839 case GREATER: return left > right;
840 case GREATER_EQUAL: return left >= right;
841 case BELOW: return unsigned_left < unsigned_right;
842 case BELOW_EQUAL: return unsigned_left <= unsigned_right;
843 case ABOVE: return unsigned_left > unsigned_right;
844 case ABOVE_EQUAL: return unsigned_left >= unsigned_right;
845 default:
846 UNIMPLEMENTED();
847 return false;
848 }
849 }
850
851
810 } // namespace dart 852 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698