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

Unified Diff: runtime/vm/simulator_dbc.cc

Issue 2122363002: DBC: Implement TestCids instruction. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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
Index: runtime/vm/simulator_dbc.cc
diff --git a/runtime/vm/simulator_dbc.cc b/runtime/vm/simulator_dbc.cc
index b1c648dc96d9e61026a30e3c64623a54b7d7c0e8..fb4929082189002aa42866699d26ead969c1a23e 100644
--- a/runtime/vm/simulator_dbc.cc
+++ b/runtime/vm/simulator_dbc.cc
@@ -2058,6 +2058,29 @@ RawObject* Simulator::Call(const Code& code,
}
{
+ BYTECODE(TestCids, A_D);
+ intptr_t cid = SimulatorHelpers::GetClassId(FP[rA]);
Vyacheslav Egorov (Google) 2016/07/07 17:08:28 const
rmacnak 2016/07/08 00:54:21 Done.
+ intptr_t num_cases = rD;
Vyacheslav Egorov (Google) 2016/07/07 17:08:28 const
rmacnak 2016/07/08 00:54:21 Done.
+ for (intptr_t i = 0; i < num_cases; i++) {
+ ASSERT(Bytecode::DecodeOpcode(pc[i]) == Bytecode::kNop);
+ intptr_t test_target = Bytecode::DecodeA(pc[i]);
+ intptr_t test_cid = Bytecode::DecodeD(pc[i]);
+ if (cid == test_cid) {
+ if (test_target != 0) {
+ pc += num_cases + 1; // Match true.
Vyacheslav Egorov (Google) 2016/07/07 17:08:28 pc += 1
+ } else {
+ pc += num_cases + 2; // Match false.
Vyacheslav Egorov (Google) 2016/07/07 17:08:28 pc += 2
+ }
+ goto TestCidsOk;
Vyacheslav Egorov (Google) 2016/07/07 17:08:28 break then there is no need for goto.
rmacnak 2016/07/08 00:54:21 Yes, I like that better.
+ }
+ }
+ pc += num_cases; // No match.
+
+ TestCidsOk:
+ DISPATCH();
+ }
+
+ {
BYTECODE(CheckSmi, 0);
intptr_t obj = reinterpret_cast<intptr_t>(FP[rA]);
if ((obj & kSmiTagMask) == kSmiTag) {
« runtime/vm/intermediate_language_dbc.cc ('K') | « runtime/vm/intermediate_language_dbc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698