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

Unified Diff: runtime/vm/object.cc

Issue 1758653003: Add source position information to profile (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 11de55fb370d6ae092d04b3d981a094e0e1b0343..37f707a095b1ec08bda63b32767c57c4566135b3 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -12759,6 +12759,15 @@ bool Code::HasBreakpoint() const {
}
+TokenPosition Code::GetTokenPositionAt(intptr_t offset) const {
+ const CodeSourceMap& map = CodeSourceMap::Handle(code_source_map());
+ if (map.IsNull()) {
+ return TokenPosition::kNoSource;
+ }
+ return map.TokenPositionForPCOffset(offset);
+}
+
+
RawTypedData* Code::GetDeoptInfoAtPc(uword pc,
ICData::DeoptReasonId* deopt_reason,
uint32_t* deopt_flags) const {
@@ -13363,8 +13372,13 @@ intptr_t Code::GetCallerId(intptr_t inlined_id) const {
void Code::GetInlinedFunctionsAt(
- intptr_t offset, GrowableArray<Function*>* fs) const {
+ intptr_t offset,
+ GrowableArray<Function*>* fs,
+ GrowableArray<TokenPosition>* token_positions) const {
fs->Clear();
+ if (token_positions != NULL) {
+ token_positions->Clear();
+ }
const Array& intervals = Array::Handle(GetInlinedIntervals());
if (intervals.IsNull() || (intervals.Length() == 0)) {
// E.g., for code stubs.
@@ -13389,6 +13403,7 @@ void Code::GetInlinedFunctionsAt(
// Find all functions.
const Array& id_map = Array::Handle(GetInlinedIdToFunction());
+ const Array& token_pos_map = Array::Handle(GetInlinedIdToTokenPos());
Smi& temp_smi = Smi::Handle();
temp_smi ^= intervals.At(found_interval_ix + Code::kInlIntInliningId);
intptr_t inlining_id = temp_smi.Value();
@@ -13396,8 +13411,12 @@ void Code::GetInlinedFunctionsAt(
intptr_t caller_id = GetCallerId(inlining_id);
while (inlining_id >= 0) {
Function& function = Function::ZoneHandle();
- function ^= id_map.At(inlining_id);
+ function ^= id_map.At(inlining_id);
fs->Add(&function);
+ if ((token_positions != NULL) && (inlining_id < token_pos_map.Length())) {
+ temp_smi ^= token_pos_map.At(inlining_id);
+ token_positions->Add(TokenPosition(temp_smi.Value()));
+ }
inlining_id = caller_id;
caller_id = GetCallerId(inlining_id);
}

Powered by Google App Engine
This is Rietveld 408576698