OLD | NEW |
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/globals.h" // Needed here to get TARGET_ARCH_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 3075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3086 | 3086 |
3087 | 3087 |
3088 void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3088 void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
3089 CheckedSmiSlowPath* slow_path = | 3089 CheckedSmiSlowPath* slow_path = |
3090 new CheckedSmiSlowPath(this, compiler->CurrentTryIndex()); | 3090 new CheckedSmiSlowPath(this, compiler->CurrentTryIndex()); |
3091 compiler->AddSlowPathCode(slow_path); | 3091 compiler->AddSlowPathCode(slow_path); |
3092 // Test operands if necessary. | 3092 // Test operands if necessary. |
3093 Register left = locs()->in(0).reg(); | 3093 Register left = locs()->in(0).reg(); |
3094 Register right = locs()->in(1).reg(); | 3094 Register right = locs()->in(1).reg(); |
3095 Register result = locs()->out(0).reg(); | 3095 Register result = locs()->out(0).reg(); |
3096 __ orr(result, left, Operand(right)); | 3096 intptr_t left_cid = this->left()->Type()->ToCid(); |
3097 __ tst(result, Operand(kSmiTagMask)); | 3097 intptr_t right_cid = this->right()->Type()->ToCid(); |
| 3098 bool combined_smi_check = false; |
| 3099 if (this->left()->definition() == this->right()->definition()) { |
| 3100 __ tst(left, Operand(kSmiTagMask)); |
| 3101 } else if (left_cid == kSmiCid) { |
| 3102 __ tst(right, Operand(kSmiTagMask)); |
| 3103 } else if (right_cid == kSmiCid) { |
| 3104 __ tst(left, Operand(kSmiTagMask)); |
| 3105 } else { |
| 3106 combined_smi_check = true; |
| 3107 __ orr(result, left, Operand(right)); |
| 3108 __ tst(result, Operand(kSmiTagMask)); |
| 3109 } |
3098 __ b(slow_path->entry_label(), NE); | 3110 __ b(slow_path->entry_label(), NE); |
3099 switch (op_kind()) { | 3111 switch (op_kind()) { |
3100 case Token::kADD: | 3112 case Token::kADD: |
3101 __ adds(result, left, Operand(right)); | 3113 __ adds(result, left, Operand(right)); |
3102 __ b(slow_path->entry_label(), VS); | 3114 __ b(slow_path->entry_label(), VS); |
3103 break; | 3115 break; |
3104 case Token::kSUB: | 3116 case Token::kSUB: |
3105 __ subs(result, left, Operand(right)); | 3117 __ subs(result, left, Operand(right)); |
3106 __ b(slow_path->entry_label(), VS); | 3118 __ b(slow_path->entry_label(), VS); |
3107 break; | 3119 break; |
3108 case Token::kBIT_OR: | 3120 case Token::kBIT_OR: |
3109 // Operation part of combined smi check. | 3121 // Operation may be part of combined smi check. |
| 3122 if (!combined_smi_check) { |
| 3123 __ orr(result, left, Operand(right)); |
| 3124 } |
3110 break; | 3125 break; |
3111 case Token::kBIT_AND: | 3126 case Token::kBIT_AND: |
3112 __ and_(result, left, Operand(right)); | 3127 __ and_(result, left, Operand(right)); |
3113 break; | 3128 break; |
3114 case Token::kBIT_XOR: | 3129 case Token::kBIT_XOR: |
3115 __ eor(result, left, Operand(right)); | 3130 __ eor(result, left, Operand(right)); |
3116 break; | 3131 break; |
3117 case Token::kEQ: | 3132 case Token::kEQ: |
3118 case Token::kLT: | 3133 case Token::kLT: |
3119 case Token::kLTE: | 3134 case Token::kLTE: |
(...skipping 3793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6913 1, | 6928 1, |
6914 locs()); | 6929 locs()); |
6915 __ Drop(1); | 6930 __ Drop(1); |
6916 __ Pop(result); | 6931 __ Pop(result); |
6917 } | 6932 } |
6918 | 6933 |
6919 | 6934 |
6920 } // namespace dart | 6935 } // namespace dart |
6921 | 6936 |
6922 #endif // defined TARGET_ARCH_ARM | 6937 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |