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

Unified Diff: runtime/vm/code_descriptors_test.cc

Issue 1634863002: Introduce CodeSourceMap object to hold pc -> token position mappings (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/code_descriptors.cc ('k') | runtime/vm/object.h » ('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 776d73ca354fbe3820b92714d98f1c951262de3e..30cedd4b73a91e4c42658cbb97fd93d17c795ac3 100644
--- a/runtime/vm/code_descriptors_test.cc
+++ b/runtime/vm/code_descriptors_test.cc
@@ -316,4 +316,52 @@ TEST_CASE(DescriptorList_TokenPositions) {
}
}
+
+TEST_CASE(CodeSourceMap_TokenPositions) {
+ 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]);
+
+ CodeSourceMapBuilder* builder = new CodeSourceMapBuilder();
+ ASSERT(builder != NULL);
+
+ for (intptr_t i = 0; i < num_token_positions; i++) {
+ builder->AddEntry(i, token_positions[i]);
+ }
+
+ const CodeSourceMap& code_Source_map =
+ CodeSourceMap::Handle(builder->Finalize());
+
+ ASSERT(!code_Source_map.IsNull());
+ CodeSourceMap::Iterator it(code_Source_map);
+
+ uintptr_t i = 0;
+ while (it.MoveNext()) {
+ EXPECT(it.PcOffset() == i);
+ 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/code_descriptors.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698