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

Unified Diff: runtime/vm/profiler_service.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/precompiler.cc ('k') | runtime/vm/profiler_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/profiler_service.cc
diff --git a/runtime/vm/profiler_service.cc b/runtime/vm/profiler_service.cc
index 679847aebe65df02c0df3a1ccd59f71c0362ac79..10b2e9727b29aaf7ba7353f50bc2848696a0eebe 100644
--- a/runtime/vm/profiler_service.cc
+++ b/runtime/vm/profiler_service.cc
@@ -1049,7 +1049,7 @@ class ProfileCodeInlinedFunctionsCache : public ValueObject {
ProcessedSample* sample,
intptr_t frame_index,
// Outputs:
- GrowableArray<Function*>** inlined_functions,
+ GrowableArray<const Function*>** inlined_functions,
GrowableArray<TokenPosition>** inlined_token_positions,
TokenPosition* token_position) {
const intptr_t offset = OffsetForPC(pc, code, sample, frame_index);
@@ -1065,7 +1065,7 @@ class ProfileCodeInlinedFunctionsCache : public ValueObject {
private:
bool FindInCache(uword pc,
intptr_t offset,
- GrowableArray<Function*>** inlined_functions,
+ GrowableArray<const Function*>** inlined_functions,
GrowableArray<TokenPosition>** inlined_token_positions,
TokenPosition* token_position) {
// Simple linear scan.
@@ -1096,7 +1096,7 @@ class ProfileCodeInlinedFunctionsCache : public ValueObject {
ProcessedSample* sample,
intptr_t frame_index,
// Outputs:
- GrowableArray<Function*>** inlined_functions,
+ GrowableArray<const Function*>** inlined_functions,
GrowableArray<TokenPosition>** inlined_token_positions,
TokenPosition* token_position) {
const intptr_t offset = OffsetForPC(pc, code, sample, frame_index);
@@ -1105,22 +1105,18 @@ class ProfileCodeInlinedFunctionsCache : public ValueObject {
cache_entry->offset = offset;
code.GetInlinedFunctionsAt(offset, &(cache_entry->inlined_functions),
&(cache_entry->inlined_token_positions));
- cache_entry->token_position = code.GetTokenPositionAt(offset);
- *token_position = (cache_entry->token_position);
if (cache_entry->inlined_functions.length() == 0) {
*inlined_functions = NULL;
*inlined_token_positions = NULL;
+ *token_position = cache_entry->token_position = TokenPosition();
return;
}
- // The inlined token position table does not include the token position
- // of the final call. Insert it at the beginning because the table.
- // is reversed.
- cache_entry->inlined_token_positions.InsertAt(0,
- cache_entry->token_position);
// Write outputs.
*inlined_functions = &(cache_entry->inlined_functions);
*inlined_token_positions = &(cache_entry->inlined_token_positions);
+ *token_position = cache_entry->token_position =
+ cache_entry->inlined_token_positions[0];
}
intptr_t NextFreeIndex() {
@@ -1157,7 +1153,7 @@ class ProfileCodeInlinedFunctionsCache : public ValueObject {
}
uword pc;
intptr_t offset;
- GrowableArray<Function*> inlined_functions;
+ GrowableArray<const Function*> inlined_functions;
GrowableArray<TokenPosition> inlined_token_positions;
TokenPosition token_position;
};
@@ -1592,7 +1588,7 @@ class ProfileBuilder : public ValueObject {
const intptr_t code_index = profile_code->code_table_index();
ASSERT(profile_code != NULL);
const Code& code = Code::ZoneHandle(profile_code->code());
- GrowableArray<Function*>* inlined_functions = NULL;
+ GrowableArray<const Function*>* inlined_functions = NULL;
GrowableArray<TokenPosition>* inlined_token_positions = NULL;
TokenPosition token_position = TokenPosition::kNoSource;
if (!code.IsNull()) {
@@ -1609,8 +1605,9 @@ class ProfileBuilder : public ValueObject {
}
}
}
+
if (code.IsNull() || (inlined_functions == NULL) ||
- (inlined_functions->length() == 0)) {
+ (inlined_functions->length() <= 1)) {
// No inlined functions.
if (inclusive_tree_) {
current = AppendKind(code, current);
@@ -1626,12 +1623,12 @@ class ProfileBuilder : public ValueObject {
ASSERT(code.is_optimized());
if (inclusive_tree_) {
- for (intptr_t i = inlined_functions->length() - 1; i >= 0; i--) {
- Function* inlined_function = (*inlined_functions)[i];
+ for (intptr_t i = 0; i < inlined_functions->length(); i++) {
+ const Function* inlined_function = (*inlined_functions)[i];
ASSERT(inlined_function != NULL);
ASSERT(!inlined_function->IsNull());
TokenPosition inlined_token_position = (*inlined_token_positions)[i];
- const bool inliner = i == (inlined_functions->length() - 1);
+ const bool inliner = i == 0;
if (inliner) {
current = AppendKind(code, current);
}
@@ -1646,12 +1643,12 @@ class ProfileBuilder : public ValueObject {
} else {
// Append the inlined children.
current = AppendKind(kInlineFinish, current);
- for (intptr_t i = 0; i < inlined_functions->length(); i++) {
- Function* inlined_function = (*inlined_functions)[i];
+ for (intptr_t i = inlined_functions->length() - 1; i >= 0; i--) {
+ const Function* inlined_function = (*inlined_functions)[i];
ASSERT(inlined_function != NULL);
ASSERT(!inlined_function->IsNull());
TokenPosition inlined_token_position = (*inlined_token_positions)[i];
- const bool inliner = i == (inlined_functions->length() - 1);
+ const bool inliner = i == 0;
if (inliner) {
current = AppendKind(kInlineStart, current);
}
@@ -1672,7 +1669,7 @@ class ProfileBuilder : public ValueObject {
intptr_t sample_index,
ProcessedSample* sample,
intptr_t frame_index,
- Function* inlined_function,
+ const Function* inlined_function,
TokenPosition inlined_token_position,
intptr_t code_index) {
ProfileFunctionTable* function_table = profile_->functions_;
« no previous file with comments | « runtime/vm/precompiler.cc ('k') | runtime/vm/profiler_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698