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

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

Issue 2891713002: Cleanup: Make CheckClassId instruction more general so it (Closed)
Patch Set: Created 3 years, 7 months 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 <setjmp.h> // NOLINT 5 #include <setjmp.h> // NOLINT
6 #include <stdlib.h> 6 #include <stdlib.h>
7 7
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #if defined(TARGET_ARCH_DBC) 9 #if defined(TARGET_ARCH_DBC)
10 10
(...skipping 3236 matching lines...) Expand 10 before | Expand all | Expand 10 after
3247 { 3247 {
3248 BYTECODE(CheckClassId, A_D); 3248 BYTECODE(CheckClassId, A_D);
3249 const intptr_t actual_cid = 3249 const intptr_t actual_cid =
3250 reinterpret_cast<intptr_t>(FP[rA]) >> kSmiTagSize; 3250 reinterpret_cast<intptr_t>(FP[rA]) >> kSmiTagSize;
3251 const intptr_t desired_cid = rD; 3251 const intptr_t desired_cid = rD;
3252 pc += (actual_cid == desired_cid) ? 1 : 0; 3252 pc += (actual_cid == desired_cid) ? 1 : 0;
3253 DISPATCH(); 3253 DISPATCH();
3254 } 3254 }
3255 3255
3256 { 3256 {
3257 BYTECODE(CheckClassIdRange, A_B_C);
3258 const intptr_t actual_cid =
3259 reinterpret_cast<intptr_t>(FP[rA]) >> kSmiTagSize;
3260 const uintptr_t cid_start = rB;
3261 const uintptr_t cid_end = rC;
3262 // Unsigned comparison.
3263 pc += (actual_cid - cid_start <= cid_end + 1u - cid_start) ? 1 : 0;
kustermann 2017/05/18 09:59:45 If [cid_start, cid_end] = [0, 1] actual_cid =
erikcorry 2017/05/18 14:25:30 Oops, fixed.
3264 DISPATCH();
3265 }
3266
3267 {
3257 BYTECODE(CheckBitTest, A_D); 3268 BYTECODE(CheckBitTest, A_D);
3258 const intptr_t raw_value = reinterpret_cast<intptr_t>(FP[rA]); 3269 const intptr_t raw_value = reinterpret_cast<intptr_t>(FP[rA]);
3259 const bool is_smi = ((raw_value & kSmiTagMask) == kSmiTag); 3270 const bool is_smi = ((raw_value & kSmiTagMask) == kSmiTag);
3260 const intptr_t cid_min = Bytecode::DecodeD(*pc); 3271 const intptr_t cid_min = Bytecode::DecodeD(*pc);
3261 const intptr_t cid_mask = 3272 const intptr_t cid_mask =
3262 Smi::Value(RAW_CAST(Smi, LOAD_CONSTANT(Bytecode::DecodeD(*(pc + 1))))); 3273 Smi::Value(RAW_CAST(Smi, LOAD_CONSTANT(Bytecode::DecodeD(*(pc + 1)))));
3263 if (LIKELY(!is_smi)) { 3274 if (LIKELY(!is_smi)) {
3264 const intptr_t cid_max = Utils::HighestBit(cid_mask) + cid_min; 3275 const intptr_t cid_max = Utils::HighestBit(cid_mask) + cid_min;
3265 const intptr_t cid = SimulatorHelpers::GetClassId(FP[rA]); 3276 const intptr_t cid = SimulatorHelpers::GetClassId(FP[rA]);
3266 // The cid is in-bounds, and the bit is set in the mask. 3277 // The cid is in-bounds, and the bit is set in the mask.
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
3883 pc_ = pc; 3894 pc_ = pc;
3884 } 3895 }
3885 3896
3886 buf->Longjmp(); 3897 buf->Longjmp();
3887 UNREACHABLE(); 3898 UNREACHABLE();
3888 } 3899 }
3889 3900
3890 } // namespace dart 3901 } // namespace dart
3891 3902
3892 #endif // defined TARGET_ARCH_DBC 3903 #endif // defined TARGET_ARCH_DBC
OLDNEW
« runtime/vm/intermediate_language_dbc.cc ('K') | « runtime/vm/intermediate_language_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698