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

Unified Diff: runtime/vm/code_descriptors.cc

Issue 2768153002: When generating CodeSourceMaps, reassign function ids once per function instead of once per inlinin… (Closed)
Patch Set: Created 3 years, 9 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.h ('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/code_descriptors.cc
diff --git a/runtime/vm/code_descriptors.cc b/runtime/vm/code_descriptors.cc
index 5ab856d4469b194e862ba50bc9c5ff29e0bc3881..9400c40a54f48145b0b83cd2b70569cb13e6d965 100644
--- a/runtime/vm/code_descriptors.cc
+++ b/runtime/vm/code_descriptors.cc
@@ -240,6 +240,8 @@ CodeSourceMapBuilder::CodeSourceMapBuilder(
caller_inline_id_(caller_inline_id),
inline_id_to_token_pos_(inline_id_to_token_pos),
inline_id_to_function_(inline_id_to_function),
+ inlined_functions_(
+ GrowableObjectArray::Handle(GrowableObjectArray::New(Heap::kOld))),
buffer_(NULL),
stream_(&buffer_, zone_allocator, 64),
stack_traces_only_(stack_traces_only) {
@@ -388,17 +390,23 @@ void CodeSourceMapBuilder::NoteDescriptor(RawPcDescriptors::Kind kind,
}
+intptr_t CodeSourceMapBuilder::GetFunctionId(intptr_t inline_id) {
+ const Function& function = *inline_id_to_function_[inline_id];
+ for (intptr_t i = 0; i < inlined_functions_.Length(); i++) {
+ if (inlined_functions_.At(i) == function.raw()) {
+ return i;
+ }
+ }
+ inlined_functions_.Add(function, Heap::kOld);
+ return inlined_functions_.Length() - 1;
+}
+
+
RawArray* CodeSourceMapBuilder::InliningIdToFunction() {
- if (inline_id_to_function_.length() <= 1) {
- // Not optimizing, or optimizing and nothing inlined.
+ if (inlined_functions_.Length() == 0) {
return Object::empty_array().raw();
}
- const Array& res =
- Array::Handle(Array::New(inline_id_to_function_.length(), Heap::kOld));
- for (intptr_t i = 0; i < inline_id_to_function_.length(); i++) {
- res.SetAt(i, *inline_id_to_function_[i]);
- }
- return res.raw();
+ return Array::MakeArray(inlined_functions_);
}
« no previous file with comments | « runtime/vm/code_descriptors.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698