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

Side by Side Diff: runtime/vm/intermediate_language_arm64.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
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 2936 matching lines...) Expand 10 before | Expand all | Expand 10 after
2947 if (!combined_smi_check) { 2947 if (!combined_smi_check) {
2948 __ orr(result, left, Operand(right)); 2948 __ orr(result, left, Operand(right));
2949 } 2949 }
2950 break; 2950 break;
2951 case Token::kBIT_AND: 2951 case Token::kBIT_AND:
2952 __ and_(result, left, Operand(right)); 2952 __ and_(result, left, Operand(right));
2953 break; 2953 break;
2954 case Token::kBIT_XOR: 2954 case Token::kBIT_XOR:
2955 __ eor(result, left, Operand(right)); 2955 __ eor(result, left, Operand(right));
2956 break; 2956 break;
2957 case Token::kSHL:
2958 ASSERT(result != left);
2959 ASSERT(result != right);
2960 __ CompareImmediate(
2961 right, reinterpret_cast<int64_t>(Smi::New(Smi::kBits)));
2962 __ b(slow_path->entry_label(), CS);
2963
2964 __ SmiUntag(TMP, right);
2965 __ lslv(result, left, TMP);
2966 __ asrv(TMP2, result, TMP);
2967 __ CompareRegisters(left, TMP2);
2968 __ b(slow_path->entry_label(), NE); // Overflow.
2969 break;
2970 case Token::kSHR:
2971 ASSERT(result != left);
2972 ASSERT(result != right);
2973 __ SmiUntag(result, right);
2974 __ CompareRegisters(result, ZR);
2975 __ b(slow_path->entry_label(), LT);
2976
2977 // If shift amount is bigger than 63, set to 63.
2978 __ LoadImmediate(TMP, 0x3F);
2979 __ CompareRegisters(result, TMP);
2980 __ csel(result, TMP, result, GT);
2981 __ SmiUntag(TMP, left);
2982 __ asrv(result, TMP, result);
2983 __ SmiTag(result);
2984 break;
2957 default: 2985 default:
2958 UNIMPLEMENTED(); 2986 UNIMPLEMENTED();
2959 } 2987 }
2960 __ Bind(slow_path->exit_label()); 2988 __ Bind(slow_path->exit_label());
2961 } 2989 }
2962 2990
2963 2991
2964 class CheckedSmiComparisonSlowPath : public SlowPathCode { 2992 class CheckedSmiComparisonSlowPath : public SlowPathCode {
2965 public: 2993 public:
2966 CheckedSmiComparisonSlowPath(CheckedSmiComparisonInstr* instruction, 2994 CheckedSmiComparisonSlowPath(CheckedSmiComparisonInstr* instruction,
(...skipping 3064 matching lines...) Expand 10 before | Expand all | Expand 10 after
6031 1, 6059 1,
6032 locs()); 6060 locs());
6033 __ Drop(1); 6061 __ Drop(1);
6034 __ Pop(result); 6062 __ Pop(result);
6035 } 6063 }
6036 6064
6037 6065
6038 } // namespace dart 6066 } // namespace dart
6039 6067
6040 #endif // defined TARGET_ARCH_ARM64 6068 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698