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

Side by Side Diff: runtime/vm/intermediate_language_mips.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 // 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 3021 matching lines...) Expand 10 before | Expand all | Expand 10 after
3032 if (!combined_smi_check) { 3032 if (!combined_smi_check) {
3033 __ or_(result, left, right); 3033 __ or_(result, left, right);
3034 } 3034 }
3035 break; 3035 break;
3036 case Token::kBIT_AND: 3036 case Token::kBIT_AND:
3037 __ and_(result, left, right); 3037 __ and_(result, left, right);
3038 break; 3038 break;
3039 case Token::kBIT_XOR: 3039 case Token::kBIT_XOR:
3040 __ xor_(result, left, right); 3040 __ xor_(result, left, right);
3041 break; 3041 break;
3042 case Token::kSHL:
3043 ASSERT(result != left);
3044 ASSERT(result != right);
3045 __ BranchUnsignedGreater(right, Immediate(Smi::RawValue(Smi::kBits)),
3046 slow_path->entry_label());
3047 // Check for overflow by shifting left and shifting back arithmetically.
3048 // If the result is different from the original, there was overflow.
3049 __ delay_slot()->SmiUntag(TMP, right);
3050 __ sllv(result, left, TMP);
3051 __ srav(CMPRES1, result, TMP);
3052 __ bne(CMPRES1, left, slow_path->entry_label());
3053 break;
3054 case Token::kSHR:
3055 __ BranchUnsignedGreater(right, Immediate(Smi::RawValue(Smi::kBits)),
3056 slow_path->entry_label());
3057 __ delay_slot()->SmiUntag(result, right);
3058 __ SmiUntag(TMP, left);
3059 __ srav(result, TMP, result);
3060 __ SmiTag(result);
3061 break;
3042 default: 3062 default:
3043 UNIMPLEMENTED(); 3063 UNIMPLEMENTED();
3044 } 3064 }
3045 __ Bind(slow_path->exit_label()); 3065 __ Bind(slow_path->exit_label());
3046 } 3066 }
3047 3067
3048 3068
3049 class CheckedSmiComparisonSlowPath : public SlowPathCode { 3069 class CheckedSmiComparisonSlowPath : public SlowPathCode {
3050 public: 3070 public:
3051 CheckedSmiComparisonSlowPath(CheckedSmiComparisonInstr* instruction, 3071 CheckedSmiComparisonSlowPath(CheckedSmiComparisonInstr* instruction,
(...skipping 2932 matching lines...) Expand 10 before | Expand all | Expand 10 after
5984 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(), 6004 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(),
5985 kGrowRegExpStackRuntimeEntry, 1, locs()); 6005 kGrowRegExpStackRuntimeEntry, 1, locs());
5986 __ lw(result, Address(SP, 1 * kWordSize)); 6006 __ lw(result, Address(SP, 1 * kWordSize));
5987 __ addiu(SP, SP, Immediate(2 * kWordSize)); 6007 __ addiu(SP, SP, Immediate(2 * kWordSize));
5988 } 6008 }
5989 6009
5990 6010
5991 } // namespace dart 6011 } // namespace dart
5992 6012
5993 #endif // defined TARGET_ARCH_MIPS 6013 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698