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

Unified Diff: runtime/vm/simulator_dbc.cc

Issue 2737303003: Allow dispatch to use a range of Class-ids in tests (Closed)
Patch Set: Feedback from Slava Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« runtime/vm/jit_optimizer.cc ('K') | « runtime/vm/jit_optimizer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/simulator_dbc.cc
diff --git a/runtime/vm/simulator_dbc.cc b/runtime/vm/simulator_dbc.cc
index d16a5a375869ea3c06faeb2d7826d0b627feec63..d211405b6089ce91120b943590f2e7df719d30df 100644
--- a/runtime/vm/simulator_dbc.cc
+++ b/runtime/vm/simulator_dbc.cc
@@ -1858,6 +1858,28 @@ RawObject* Simulator::Call(const Code& code,
}
{
+ BYTECODE(PushPolymorphicInstanceCallByRange, A_D);
+ const uint8_t argc = rA;
+ const intptr_t cids_length = rD;
+ RawObject** args = SP - argc + 1;
+ const intptr_t receiver_cid = SimulatorHelpers::GetClassId(args[0]);
+ for (intptr_t i = 0; i < 3 * cids_length; i += 3) {
+ // Note unsigned types to get an unsigned range compare.
+ const uintptr_t cid_start = Bytecode::DecodeD(*(pc + i));
+ const uintptr_t cids = Bytecode::DecodeD(*(pc + i + 1));
+ if (receiver_cid - cid_start < cids) {
+ RawFunction* target =
+ RAW_CAST(Function, LOAD_CONSTANT(Bytecode::DecodeD(*(pc + i + 2))));
+ *++SP = target;
+ pc++;
+ break;
+ }
+ }
+ pc += 3 * cids_length;
+ DISPATCH();
+ }
+
+ {
BYTECODE(NativeBootstrapCall, 0);
RawFunction* function = FrameFunction(FP);
RawObject** incoming_args =
@@ -3208,6 +3230,31 @@ RawObject* Simulator::Call(const Code& code,
}
{
+ BYTECODE(CheckCidsByRange, A_B_C);
+ const intptr_t raw_value = reinterpret_cast<intptr_t>(FP[rA]);
+ const bool is_smi = ((raw_value & kSmiTagMask) == kSmiTag);
+ const bool may_be_smi = (rB == 1);
+ const intptr_t cids_length = rC;
+ if (LIKELY(!is_smi)) {
+ const intptr_t cid = SimulatorHelpers::GetClassId(FP[rA]);
+ for (intptr_t i = 0; i < cids_length; i += 2) {
+ // Note unsigned type to get unsigned range check below.
+ const uintptr_t cid_start = Bytecode::DecodeD(*(pc + i));
+ const uintptr_t cids = Bytecode::DecodeD(*(pc + i + 1));
+ if (cid - cid_start < cids) {
+ pc++;
+ break;
+ }
+ }
+ pc += cids_length;
+ } else {
+ pc += cids_length;
+ pc += (may_be_smi ? 1 : 0);
+ }
+ DISPATCH();
+ }
+
+ {
BYTECODE(IfEqStrictTOS, 0);
SP -= 2;
if (SP[1] != SP[2]) {
« runtime/vm/jit_optimizer.cc ('K') | « runtime/vm/jit_optimizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698