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

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

Issue 2487873003: Speculate on bitwise operators. (Closed)
Patch Set: . Created 4 years, 1 month 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
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/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 3045 matching lines...) Expand 10 before | Expand all | Expand 10 after
3056 if (!combined_smi_check) { 3056 if (!combined_smi_check) {
3057 __ or_(result, left, right); 3057 __ or_(result, left, right);
3058 } 3058 }
3059 break; 3059 break;
3060 case Token::kBIT_AND: 3060 case Token::kBIT_AND:
3061 __ and_(result, left, right); 3061 __ and_(result, left, right);
3062 break; 3062 break;
3063 case Token::kBIT_XOR: 3063 case Token::kBIT_XOR:
3064 __ xor_(result, left, right); 3064 __ xor_(result, left, right);
3065 break; 3065 break;
3066 case Token::kSHL:
3067 ASSERT(result != left);
3068 ASSERT(result != right);
3069 __ BranchUnsignedGreater(right,
3070 Immediate(Smi::RawValue(Smi::kBits)),
3071 slow_path->entry_label());
3072 // Check for overflow by shifting left and shifting back arithmetically.
3073 // If the result is different from the original, there was overflow.
3074 __ SmiUntag(TMP, right);
3075 __ sllv(result, left, TMP);
3076 __ srav(CMPRES1, result, TMP);
3077 __ bne(CMPRES1, left, slow_path->entry_label());
3078 break;
3079 case Token::kSHR:
3080 __ bltz(right, slow_path->entry_label());
3081 __ SmiUntag(result, right);
3082
3083 __ LoadImmediate(TMP, 0x1F);
3084 __ slt(CMPRES1, TMP, result); // CMPRES1 := 0x1F < result ? 1 : 0
3085 __ movn(result, TMP, CMPRES1); // result := 0x1F < result ? 0x1F : result
3086 __ SmiUntag(TMP, left);
3087 __ srav(result, TMP, result);
3088 __ SmiTag(result);
3089 break;
3066 default: 3090 default:
3067 UNIMPLEMENTED(); 3091 UNIMPLEMENTED();
3068 } 3092 }
3069 __ Bind(slow_path->exit_label()); 3093 __ Bind(slow_path->exit_label());
3070 } 3094 }
3071 3095
3072 3096
3073 class CheckedSmiComparisonSlowPath : public SlowPathCode { 3097 class CheckedSmiComparisonSlowPath : public SlowPathCode {
3074 public: 3098 public:
3075 CheckedSmiComparisonSlowPath(CheckedSmiComparisonInstr* instruction, 3099 CheckedSmiComparisonSlowPath(CheckedSmiComparisonInstr* instruction,
(...skipping 2977 matching lines...) Expand 10 before | Expand all | Expand 10 after
6053 1, 6077 1,
6054 locs()); 6078 locs());
6055 __ lw(result, Address(SP, 1 * kWordSize)); 6079 __ lw(result, Address(SP, 1 * kWordSize));
6056 __ addiu(SP, SP, Immediate(2 * kWordSize)); 6080 __ addiu(SP, SP, Immediate(2 * kWordSize));
6057 } 6081 }
6058 6082
6059 6083
6060 } // namespace dart 6084 } // namespace dart
6061 6085
6062 #endif // defined TARGET_ARCH_MIPS 6086 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698