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

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

Issue 2487873003: Speculate on bitwise operators. (Closed)
Patch Set: git cl format 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 3184 matching lines...) Expand 10 before | Expand all | Expand 10 after
3195 if (!combined_smi_check) { 3195 if (!combined_smi_check) {
3196 __ orr(result, left, Operand(right)); 3196 __ orr(result, left, Operand(right));
3197 } 3197 }
3198 break; 3198 break;
3199 case Token::kBIT_AND: 3199 case Token::kBIT_AND:
3200 __ and_(result, left, Operand(right)); 3200 __ and_(result, left, Operand(right));
3201 break; 3201 break;
3202 case Token::kBIT_XOR: 3202 case Token::kBIT_XOR:
3203 __ eor(result, left, Operand(right)); 3203 __ eor(result, left, Operand(right));
3204 break; 3204 break;
3205 case Token::kSHL:
3206 ASSERT(result != left);
3207 ASSERT(result != right);
3208 __ CompareImmediate(right, Smi::RawValue(Smi::kBits));
3209 __ b(slow_path->entry_label(), HI);
3210
3211 __ SmiUntag(TMP, right);
3212 // Check for overflow by shifting left and shifting back arithmetically.
3213 // If the result is different from the original, there was overflow.
3214 __ Lsl(result, left, TMP);
3215 __ cmp(left, Operand(result, ASR, TMP));
3216 __ b(slow_path->entry_label(), NE);
3217 break;
3218 case Token::kSHR:
3219 ASSERT(result != left);
3220 ASSERT(result != right);
3221 __ CompareImmediate(right, Smi::RawValue(Smi::kBits));
3222 __ b(slow_path->entry_label(), HI);
3223
3224 __ SmiUntag(result, right);
3225 __ SmiUntag(TMP, left);
3226 __ Asr(result, TMP, result);
3227 __ SmiTag(result);
3228 break;
3205 default: 3229 default:
3206 UNREACHABLE(); 3230 UNREACHABLE();
3207 } 3231 }
3208 __ Bind(slow_path->exit_label()); 3232 __ Bind(slow_path->exit_label());
3209 } 3233 }
3210 3234
3211 3235
3212 class CheckedSmiComparisonSlowPath : public SlowPathCode { 3236 class CheckedSmiComparisonSlowPath : public SlowPathCode {
3213 public: 3237 public:
3214 CheckedSmiComparisonSlowPath(CheckedSmiComparisonInstr* instruction, 3238 CheckedSmiComparisonSlowPath(CheckedSmiComparisonInstr* instruction,
(...skipping 3983 matching lines...) Expand 10 before | Expand all | Expand 10 after
7198 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(), 7222 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(),
7199 kGrowRegExpStackRuntimeEntry, 1, locs()); 7223 kGrowRegExpStackRuntimeEntry, 1, locs());
7200 __ Drop(1); 7224 __ Drop(1);
7201 __ Pop(result); 7225 __ Pop(result);
7202 } 7226 }
7203 7227
7204 7228
7205 } // namespace dart 7229 } // namespace dart
7206 7230
7207 #endif // defined TARGET_ARCH_ARM 7231 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698