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

Side by Side Diff: runtime/vm/intermediate_language_arm.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 1
2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. 6 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
7 #if defined(TARGET_ARCH_ARM) 7 #if defined(TARGET_ARCH_ARM)
8 8
9 #include "vm/intermediate_language.h" 9 #include "vm/intermediate_language.h"
10 10
(...skipping 3241 matching lines...) Expand 10 before | Expand all | Expand 10 after
3252 if (!combined_smi_check) { 3252 if (!combined_smi_check) {
3253 __ orr(result, left, Operand(right)); 3253 __ orr(result, left, Operand(right));
3254 } 3254 }
3255 break; 3255 break;
3256 case Token::kBIT_AND: 3256 case Token::kBIT_AND:
3257 __ and_(result, left, Operand(right)); 3257 __ and_(result, left, Operand(right));
3258 break; 3258 break;
3259 case Token::kBIT_XOR: 3259 case Token::kBIT_XOR:
3260 __ eor(result, left, Operand(right)); 3260 __ eor(result, left, Operand(right));
3261 break; 3261 break;
3262 case Token::kSHL:
3263 ASSERT(result != left);
3264 ASSERT(result != right);
3265 __ CompareImmediate(right, Smi::RawValue(Smi::kBits));
3266 __ b(slow_path->entry_label(), HI);
3267
3268 __ SmiUntag(TMP, right);
3269 // Check for overflow by shifting left and shifting back arithmetically.
3270 // If the result is different from the original, there was overflow.
3271 __ mov(result, Operand(left, LSL, TMP));
Florian Schneider 2016/11/11 18:12:20 Can Assembler::LsL be used here as well?
rmacnak 2016/11/11 21:29:02 Done.
3272 __ cmp(left, Operand(result, ASR, TMP));
3273 __ b(slow_path->entry_label(), NE);
3274 break;
3275 case Token::kSHR:
3276 ASSERT(result != left);
3277 ASSERT(result != right);
3278 __ CompareImmediate(right, 0);
3279 __ b(slow_path->entry_label(), LT);
3280
3281 __ SmiUntag(result, right);
3282 __ CompareImmediate(result, 0x1F);
3283 __ LoadImmediate(result, 0x1F, GT);
3284 __ SmiUntag(TMP, left);
3285 __ mov(result, Operand(TMP, ASR, result));
Florian Schneider 2016/11/11 18:12:20 Use Asr?
rmacnak 2016/11/11 21:29:02 Done.
3286 __ SmiTag(result);
3287 break;
3262 default: 3288 default:
3263 UNREACHABLE(); 3289 UNREACHABLE();
3264 } 3290 }
3265 __ Bind(slow_path->exit_label()); 3291 __ Bind(slow_path->exit_label());
3266 } 3292 }
3267 3293
3268 3294
3269 class CheckedSmiComparisonSlowPath : public SlowPathCode { 3295 class CheckedSmiComparisonSlowPath : public SlowPathCode {
3270 public: 3296 public:
3271 CheckedSmiComparisonSlowPath(CheckedSmiComparisonInstr* instruction, 3297 CheckedSmiComparisonSlowPath(CheckedSmiComparisonInstr* instruction,
(...skipping 4009 matching lines...) Expand 10 before | Expand all | Expand 10 after
7281 1, 7307 1,
7282 locs()); 7308 locs());
7283 __ Drop(1); 7309 __ Drop(1);
7284 __ Pop(result); 7310 __ Pop(result);
7285 } 7311 }
7286 7312
7287 7313
7288 } // namespace dart 7314 } // namespace dart
7289 7315
7290 #endif // defined TARGET_ARCH_ARM 7316 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698