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

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

Issue 2891713002: Cleanup: Make CheckClassId instruction more general so it (Closed)
Patch Set: Feedback from Martin 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
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_D);
3258 const intptr_t actual_cid =
3259 reinterpret_cast<intptr_t>(FP[rA]) >> kSmiTagSize;
3260 const uintptr_t cid_start = rD;
3261 const uintptr_t cid_range = Bytecode::DecodeD(*pc);
3262 // Unsigned comparison. Skip either just the nop or both the nop and the
3263 // following instruction.
3264 pc += (actual_cid - cid_start <= cid_range) ? 2 : 1;
3265 DISPATCH();
3266 }
3267
3268 {
3257 BYTECODE(CheckBitTest, A_D); 3269 BYTECODE(CheckBitTest, A_D);
3258 const intptr_t raw_value = reinterpret_cast<intptr_t>(FP[rA]); 3270 const intptr_t raw_value = reinterpret_cast<intptr_t>(FP[rA]);
3259 const bool is_smi = ((raw_value & kSmiTagMask) == kSmiTag); 3271 const bool is_smi = ((raw_value & kSmiTagMask) == kSmiTag);
3260 const intptr_t cid_min = Bytecode::DecodeD(*pc); 3272 const intptr_t cid_min = Bytecode::DecodeD(*pc);
3261 const intptr_t cid_mask = 3273 const intptr_t cid_mask =
3262 Smi::Value(RAW_CAST(Smi, LOAD_CONSTANT(Bytecode::DecodeD(*(pc + 1))))); 3274 Smi::Value(RAW_CAST(Smi, LOAD_CONSTANT(Bytecode::DecodeD(*(pc + 1)))));
3263 if (LIKELY(!is_smi)) { 3275 if (LIKELY(!is_smi)) {
3264 const intptr_t cid_max = Utils::HighestBit(cid_mask) + cid_min; 3276 const intptr_t cid_max = Utils::HighestBit(cid_mask) + cid_min;
3265 const intptr_t cid = SimulatorHelpers::GetClassId(FP[rA]); 3277 const intptr_t cid = SimulatorHelpers::GetClassId(FP[rA]);
3266 // The cid is in-bounds, and the bit is set in the mask. 3278 // 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; 3895 pc_ = pc;
3884 } 3896 }
3885 3897
3886 buf->Longjmp(); 3898 buf->Longjmp();
3887 UNREACHABLE(); 3899 UNREACHABLE();
3888 } 3900 }
3889 3901
3890 } // namespace dart 3902 } // namespace dart
3891 3903
3892 #endif // defined TARGET_ARCH_DBC 3904 #endif // defined TARGET_ARCH_DBC
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698