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

Unified Diff: runtime/vm/code_descriptors_test.cc

Issue 1589643002: Source positions for constructors and lots of async machinery (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « runtime/vm/class_finalizer_test.cc ('k') | runtime/vm/code_patcher_arm64_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_descriptors_test.cc
diff --git a/runtime/vm/code_descriptors_test.cc b/runtime/vm/code_descriptors_test.cc
index 2586a978c37e2cb4e381f4509a85c56c28b55d9f..776d73ca354fbe3820b92714d98f1c951262de3e 100644
--- a/runtime/vm/code_descriptors_test.cc
+++ b/runtime/vm/code_descriptors_test.cc
@@ -18,7 +18,7 @@
namespace dart {
-static const intptr_t kPos = Scanner::kNoSourcePos;
+static const intptr_t kPos = Token::kNoSourcePos;
CODEGEN_TEST_GENERATE(StackmapCodegen, test) {
@@ -268,4 +268,52 @@ TEST_CASE(StackmapGC) {
EXPECT(!result.IsError());
}
+
+TEST_CASE(DescriptorList_TokenPositions) {
+ DescriptorList* descriptors = new DescriptorList(64);
+ ASSERT(descriptors != NULL);
+ const intptr_t token_positions[] = {
+ kMinInt32,
+ 5,
+ 13,
+ 13,
+ 13,
+ 13,
+ 31,
+ 23,
+ 23,
+ 23,
+ 33,
+ 33,
+ 5,
+ 5,
+ Token::kMinSourcePos,
+ Token::kMaxSourcePos,
+ };
+ const intptr_t num_token_positions =
+ sizeof(token_positions) / sizeof(token_positions[0]);
+
+ for (intptr_t i = 0; i < num_token_positions; i++) {
+ descriptors->AddDescriptor(RawPcDescriptors::kRuntimeCall, 0, 0,
+ token_positions[i], 0);
+ }
+
+ const PcDescriptors& finalized_descriptors =
+ PcDescriptors::Handle(descriptors->FinalizePcDescriptors(0));
+
+ ASSERT(!finalized_descriptors.IsNull());
+ PcDescriptors::Iterator it(finalized_descriptors,
+ RawPcDescriptors::kRuntimeCall);
+
+ intptr_t i = 0;
+ while (it.MoveNext()) {
+ if (token_positions[i] != it.TokenPos()) {
+ OS::Print("[%" Pd "]: Expected: %" Pd " != %" Pd "\n",
+ i, token_positions[i], it.TokenPos());
+ }
+ EXPECT(token_positions[i] == it.TokenPos());
+ i++;
+ }
+}
+
} // namespace dart
« no previous file with comments | « runtime/vm/class_finalizer_test.cc ('k') | runtime/vm/code_patcher_arm64_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698