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

Unified Diff: src/compiler.cc

Issue 996153003: CpuProfiler: simplify inlined function info magic. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: comments addressed Created 5 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 | « src/compiler.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 2e07a671d892ecdfca81564f3686906da3e7ef29..2aceedbd95de7822011d2444e3f9af6b9c995c24 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -118,10 +118,8 @@ void CompilationInfo::Initialize(Isolate* isolate,
? new List<OffsetRange>(2) : NULL;
if (FLAG_hydrogen_track_positions) {
inlined_function_infos_ = new List<InlinedFunctionInfo>(5);
- inlining_id_to_function_id_ = new List<int>(5);
} else {
inlined_function_infos_ = NULL;
- inlining_id_to_function_id_ = NULL;
}
for (int i = 0; i < DependentCode::kGroupCount; i++) {
@@ -163,7 +161,6 @@ CompilationInfo::~CompilationInfo() {
delete deferred_handles_;
delete no_frame_ranges_;
delete inlined_function_infos_;
- delete inlining_id_to_function_id_;
#ifdef DEBUG
// Check that no dependent maps have been added or added dependent maps have
// been rolled back or committed.
@@ -277,52 +274,46 @@ bool CompilationInfo::is_simple_parameter_list() {
int CompilationInfo::TraceInlinedFunction(Handle<SharedFunctionInfo> shared,
- SourcePosition position) {
+ SourcePosition position,
+ int parent_id) {
DCHECK(FLAG_hydrogen_track_positions);
-
DCHECK(inlined_function_infos_);
- DCHECK(inlining_id_to_function_id_);
- int id = 0;
- for (; id < inlined_function_infos_->length(); id++) {
- if (inlined_function_infos_->at(id).shared().is_identical_to(shared)) {
- break;
- }
- }
- if (id == inlined_function_infos_->length()) {
- inlined_function_infos_->Add(InlinedFunctionInfo(shared));
-
- if (!shared->script()->IsUndefined()) {
- Handle<Script> script(Script::cast(shared->script()));
- if (!script->source()->IsUndefined()) {
- CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer());
- OFStream os(tracing_scope.file());
- os << "--- FUNCTION SOURCE (" << shared->DebugName()->ToCString().get()
- << ") id{" << optimization_id() << "," << id << "} ---\n";
- {
- DisallowHeapAllocation no_allocation;
- int start = shared->start_position();
- int len = shared->end_position() - start;
- String::SubStringRange source(String::cast(script->source()), start,
- len);
- for (const auto& c : source) {
- os << AsReversiblyEscapedUC16(c);
- }
- }
- os << "\n--- END ---\n";
+ int inline_id = inlined_function_infos_->length();
+ InlinedFunctionInfo info(parent_id, position, UnboundScript::kNoScriptId,
+ shared->start_position());
+ if (!shared->script()->IsUndefined()) {
+ Handle<Script> script(Script::cast(shared->script()));
+ info.script_id = script->id()->value();
+
+ if (!script->source()->IsUndefined()) {
+ CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer());
+ OFStream os(tracing_scope.file());
+ os << "--- FUNCTION SOURCE (" << shared->DebugName()->ToCString().get()
+ << ") id{" << optimization_id() << "," << inline_id << "} ---\n";
+ {
+ DisallowHeapAllocation no_allocation;
+ int start = shared->start_position();
+ int len = shared->end_position() - start;
+ String::SubStringRange source(String::cast(script->source()), start,
+ len);
+ for (const auto& c : source) {
+ os << AsReversiblyEscapedUC16(c);
+ }
}
+
+ os << "\n--- END ---\n";
}
}
- int inline_id = inlining_id_to_function_id_->length();
- inlining_id_to_function_id_->Add(id);
+ inlined_function_infos_->Add(info);
if (inline_id != 0) {
CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer());
OFStream os(tracing_scope.file());
os << "INLINE (" << shared->DebugName()->ToCString().get() << ") id{"
- << optimization_id() << "," << id << "} AS " << inline_id << " AT "
- << position << std::endl;
+ << optimization_id() << "," << inline_id << "} AS " << inline_id
+ << " AT " << position << std::endl;
}
return inline_id;
« no previous file with comments | « src/compiler.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698