? 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++) {
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.
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;
std::ostream& operator<<(std::ostream& os, const SourcePosition& p);
-class InlinedFunctionInfo {
- public:
- explicit InlinedFunctionInfo(Handle<SharedFunctionInfo> shared)
- : shared_(shared), start_position_(shared->start_position()) {}
-
- Handle<SharedFunctionInfo> shared() const { return shared_; }
- int start_position() const { return start_position_; }
-
- private:
- Handle<SharedFunctionInfo> shared_;
- int start_position_;
+struct InlinedFunctionInfo {
+ InlinedFunctionInfo(int parent_id, SourcePosition inline_position,
+ int script_id, int start_position)
+ : parent_id(parent_id),
+ inline_position(inline_position),
+ script_id(script_id),
+ start_position(start_position) {}
+ int parent_id;
+ SourcePosition inline_position;
+ int script_id;
+ int start_position;
+
+ static const int kNoParentId = -1;
};
List<InlinedFunctionInfo>* inlined_function_infos() {
return inlined_function_infos_;
}
- List<int>* inlining_id_to_function_id() {
- return inlining_id_to_function_id_;
- }
int TraceInlinedFunction(Handle<SharedFunctionInfo> shared,
- SourcePosition position);
+ SourcePosition position, int pareint_id);
Handle<Foreign> object_wrapper() {
if (object_wrapper_.is_null()) {
List<OffsetRange>* no_frame_ranges_;
List<InlinedFunctionInfo>* inlined_function_infos_;
- List<int>* inlining_id_to_function_id_;
// A copy of shared_info()->opt_count() to avoid handle deref
// during graph optimization.
HEnvironment(zone_, descriptor.GetEnvironmentParameterCount());
} else {
if (FLAG_hydrogen_track_positions) {
- info->TraceInlinedFunction(info->shared_info(),
- SourcePosition::Unknown());
+ info->TraceInlinedFunction(info->shared_info(), SourcePosition::Unknown(),
+ InlinedFunctionInfo::kNoParentId);
}
start_environment_ =
new(zone_) HEnvironment(NULL, info->scope(), info->closure(), zone_);
return pos.raw();
}
- const int id = info()->inlining_id_to_function_id()->at(pos.inlining_id());
- return info()->inlined_function_infos()->at(id).start_position() +
- pos.position();
+ return info()->inlined_function_infos()->at(pos.inlining_id())
+ .start_position + pos.position();
}
int function_id = 0;
if (FLAG_hydrogen_track_positions) {
- function_id =
- top_info()->TraceInlinedFunction(target_shared, source_position());
+ function_id = top_info()->TraceInlinedFunction(
+ target_shared, source_position(), function_state()->inlining_id());
}
// Save the pending call context. Set up new one for the inlined function.