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

Unified Diff: runtime/vm/profiler_test.cc

Issue 2670843006: Encode inlining information in CodeSourceMap and remove inlining interval arrays. (Closed)
Patch Set: . Created 3 years, 10 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/profiler_service.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/profiler_test.cc
diff --git a/runtime/vm/profiler_test.cc b/runtime/vm/profiler_test.cc
index 8e3af78a2ef4f5a397754103f43dcd0f2a158ddb..647f87f9a3d65ddcf38c804231706398f06177a5 100644
--- a/runtime/vm/profiler_test.cc
+++ b/runtime/vm/profiler_test.cc
@@ -2449,13 +2449,13 @@ static void InsertFakeSample(SampleBuffer* sample_buffer, uword* pc_offsets) {
static uword FindPCForTokenPosition(const Code& code,
- const CodeSourceMap& code_source_map,
TokenPosition tp) {
- CodeSourceMap::Iterator it(code_source_map);
-
- while (it.MoveNext()) {
- if (it.TokenPos() == tp) {
- return it.PcOffset() + code.PayloadStart();
+ GrowableArray<const Function*> functions;
+ GrowableArray<TokenPosition> token_positions;
+ for (intptr_t pc_offset = 0; pc_offset < code.Size(); pc_offset++) {
+ code.GetInlinedFunctionsAt(pc_offset, &functions, &token_positions);
+ if (token_positions[0] == tp) {
+ return code.PayloadStart() + pc_offset;
}
}
@@ -2522,34 +2522,24 @@ TEST_CASE(Profiler_GetSourceReport) {
const Code& do_work_code = Code::Handle(do_work.CurrentCode());
EXPECT(!do_work_code.IsNull());
- const CodeSourceMap& main_code_source_map =
- CodeSourceMap::Handle(main_code.code_source_map());
- EXPECT(!main_code_source_map.IsNull());
-
- const CodeSourceMap& do_work_code_source_map =
- CodeSourceMap::Handle(do_work_code.code_source_map());
- EXPECT(!do_work_code_source_map.IsNull());
-
// Dump code source map.
- CodeSourceMap::Dump(do_work_code_source_map, do_work_code, main);
- CodeSourceMap::Dump(main_code_source_map, main_code, main);
+ do_work_code.DumpSourcePositions();
+ main_code.DumpSourcePositions();
// Look up some source token position's pc.
- uword squarePositionPc = FindPCForTokenPosition(
- do_work_code, do_work_code_source_map, squarePosition);
+ uword squarePositionPc = FindPCForTokenPosition(do_work_code, squarePosition);
EXPECT(squarePositionPc != 0);
- uword callPositionPc =
- FindPCForTokenPosition(main_code, main_code_source_map, callPosition);
+ uword callPositionPc = FindPCForTokenPosition(main_code, callPosition);
EXPECT(callPositionPc != 0);
// Look up some classifying token position's pc.
- uword controlFlowPc = FindPCForTokenPosition(
- do_work_code, do_work_code_source_map, TokenPosition::kControlFlow);
+ uword controlFlowPc =
+ FindPCForTokenPosition(do_work_code, TokenPosition::kControlFlow);
EXPECT(controlFlowPc != 0);
- uword tempMovePc = FindPCForTokenPosition(main_code, main_code_source_map,
- TokenPosition::kTempMove);
+ uword tempMovePc =
+ FindPCForTokenPosition(main_code, TokenPosition::kTempMove);
EXPECT(tempMovePc != 0);
// Insert fake samples.
« no previous file with comments | « runtime/vm/profiler_service.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698