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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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 2910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2921 | 2921 |
2922 | 2922 |
2923 void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2923 void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2924 CheckedSmiSlowPath* slow_path = | 2924 CheckedSmiSlowPath* slow_path = |
2925 new CheckedSmiSlowPath(this, compiler->CurrentTryIndex()); | 2925 new CheckedSmiSlowPath(this, compiler->CurrentTryIndex()); |
2926 compiler->AddSlowPathCode(slow_path); | 2926 compiler->AddSlowPathCode(slow_path); |
2927 // Test operands if necessary. | 2927 // Test operands if necessary. |
2928 Register left = locs()->in(0).reg(); | 2928 Register left = locs()->in(0).reg(); |
2929 Register right = locs()->in(1).reg(); | 2929 Register right = locs()->in(1).reg(); |
2930 Register result = locs()->out(0).reg(); | 2930 Register result = locs()->out(0).reg(); |
2931 __ or_(result, left, right); | 2931 intptr_t left_cid = this->left()->Type()->ToCid(); |
2932 __ andi(CMPRES1, result, Immediate(kSmiTagMask)); | 2932 intptr_t right_cid = this->right()->Type()->ToCid(); |
| 2933 bool combined_smi_check = false; |
| 2934 if (this->left()->definition() == this->right()->definition()) { |
| 2935 __ andi(CMPRES1, left, Immediate(kSmiTagMask)); |
| 2936 } else if (left_cid == kSmiCid) { |
| 2937 __ andi(CMPRES1, right, Immediate(kSmiTagMask)); |
| 2938 } else if (right_cid == kSmiCid) { |
| 2939 __ andi(CMPRES1, left, Immediate(kSmiTagMask)); |
| 2940 } else { |
| 2941 combined_smi_check = true; |
| 2942 __ or_(result, left, right); |
| 2943 __ andi(CMPRES1, result, Immediate(kSmiTagMask)); |
| 2944 } |
2933 __ bne(CMPRES1, ZR, slow_path->entry_label()); | 2945 __ bne(CMPRES1, ZR, slow_path->entry_label()); |
2934 switch (op_kind()) { | 2946 switch (op_kind()) { |
2935 case Token::kADD: | 2947 case Token::kADD: |
2936 __ AdduDetectOverflow(result, left, right, CMPRES1); | 2948 __ AdduDetectOverflow(result, left, right, CMPRES1); |
2937 __ bltz(CMPRES1, slow_path->entry_label()); | 2949 __ bltz(CMPRES1, slow_path->entry_label()); |
2938 break; | 2950 break; |
2939 case Token::kSUB: | 2951 case Token::kSUB: |
2940 __ SubuDetectOverflow(result, left, right, CMPRES1); | 2952 __ SubuDetectOverflow(result, left, right, CMPRES1); |
2941 __ bltz(CMPRES1, slow_path->entry_label()); | 2953 __ bltz(CMPRES1, slow_path->entry_label()); |
2942 break; | 2954 break; |
2943 case Token::kBIT_OR: | 2955 case Token::kBIT_OR: |
2944 // Operation part of combined smi check. | 2956 // Operation part of combined smi check. |
| 2957 if (!combined_smi_check) { |
| 2958 __ or_(result, left, right); |
| 2959 } |
2945 break; | 2960 break; |
2946 case Token::kBIT_AND: | 2961 case Token::kBIT_AND: |
2947 __ and_(result, left, right); | 2962 __ and_(result, left, right); |
2948 break; | 2963 break; |
2949 case Token::kBIT_XOR: | 2964 case Token::kBIT_XOR: |
2950 __ xor_(result, left, right); | 2965 __ xor_(result, left, right); |
2951 break; | 2966 break; |
2952 case Token::kEQ: | 2967 case Token::kEQ: |
2953 case Token::kLT: | 2968 case Token::kLT: |
2954 case Token::kLTE: | 2969 case Token::kLTE: |
(...skipping 2732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5687 1, | 5702 1, |
5688 locs()); | 5703 locs()); |
5689 __ lw(result, Address(SP, 1 * kWordSize)); | 5704 __ lw(result, Address(SP, 1 * kWordSize)); |
5690 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 5705 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
5691 } | 5706 } |
5692 | 5707 |
5693 | 5708 |
5694 } // namespace dart | 5709 } // namespace dart |
5695 | 5710 |
5696 #endif // defined TARGET_ARCH_MIPS | 5711 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |