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

Side by Side 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 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 2040 matching lines...) Expand 10 before | Expand all | Expand 10 after
2051 BYTECODE(TestSmi, A_D); 2051 BYTECODE(TestSmi, A_D);
2052 intptr_t left = reinterpret_cast<intptr_t>(RAW_CAST(Smi, FP[rA])); 2052 intptr_t left = reinterpret_cast<intptr_t>(RAW_CAST(Smi, FP[rA]));
2053 intptr_t right = reinterpret_cast<intptr_t>(RAW_CAST(Smi, FP[rD])); 2053 intptr_t right = reinterpret_cast<intptr_t>(RAW_CAST(Smi, FP[rD]));
2054 if ((left & right) != 0) { 2054 if ((left & right) != 0) {
2055 pc++; 2055 pc++;
2056 } 2056 }
2057 DISPATCH(); 2057 DISPATCH();
2058 } 2058 }
2059 2059
2060 { 2060 {
2061 BYTECODE(TestCids, A_D);
2062 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.
2063 intptr_t num_cases = rD;
Vyacheslav Egorov (Google) 2016/07/07 17:08:28 const
rmacnak 2016/07/08 00:54:21 Done.
2064 for (intptr_t i = 0; i < num_cases; i++) {
2065 ASSERT(Bytecode::DecodeOpcode(pc[i]) == Bytecode::kNop);
2066 intptr_t test_target = Bytecode::DecodeA(pc[i]);
2067 intptr_t test_cid = Bytecode::DecodeD(pc[i]);
2068 if (cid == test_cid) {
2069 if (test_target != 0) {
2070 pc += num_cases + 1; // Match true.
Vyacheslav Egorov (Google) 2016/07/07 17:08:28 pc += 1
2071 } else {
2072 pc += num_cases + 2; // Match false.
Vyacheslav Egorov (Google) 2016/07/07 17:08:28 pc += 2
2073 }
2074 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.
2075 }
2076 }
2077 pc += num_cases; // No match.
2078
2079 TestCidsOk:
2080 DISPATCH();
2081 }
2082
2083 {
2061 BYTECODE(CheckSmi, 0); 2084 BYTECODE(CheckSmi, 0);
2062 intptr_t obj = reinterpret_cast<intptr_t>(FP[rA]); 2085 intptr_t obj = reinterpret_cast<intptr_t>(FP[rA]);
2063 if ((obj & kSmiTagMask) == kSmiTag) { 2086 if ((obj & kSmiTagMask) == kSmiTag) {
2064 pc++; 2087 pc++;
2065 } 2088 }
2066 DISPATCH(); 2089 DISPATCH();
2067 } 2090 }
2068 2091
2069 { 2092 {
2070 BYTECODE(CheckClassId, A_D); 2093 BYTECODE(CheckClassId, A_D);
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
2454 special_[kExceptionSpecialIndex] = raw_exception; 2477 special_[kExceptionSpecialIndex] = raw_exception;
2455 special_[kStacktraceSpecialIndex] = raw_stacktrace; 2478 special_[kStacktraceSpecialIndex] = raw_stacktrace;
2456 buf->Longjmp(); 2479 buf->Longjmp();
2457 UNREACHABLE(); 2480 UNREACHABLE();
2458 } 2481 }
2459 2482
2460 } // namespace dart 2483 } // namespace dart
2461 2484
2462 2485
2463 #endif // defined TARGET_ARCH_DBC 2486 #endif // defined TARGET_ARCH_DBC
OLDNEW
« 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