[compiler] Move list of inlined functions to Crankshaft.

The data-structure in question is only used by Crankshaft, it can safely
be moved into the backend to avoid exposure through the CompilationInfo.

R=bmeurer@chromium.org

Review-Url: https://codereview.chromium.org/1977473002
Cr-Commit-Position: refs/heads/master@{#36232}
This commit is contained in:
mstarzinger 2016-05-13 03:33:27 -07:00 committed by Commit bot
parent b32f9599be
commit 7656970456
3 changed files with 17 additions and 19 deletions

View File

@ -120,13 +120,6 @@ class Compiler : public AllStatic {
JavaScriptFrame* osr_frame); JavaScriptFrame* osr_frame);
}; };
// TODO(mstarzinger): Move this into the "crankshaft" directory.
struct InlinedFunctionInfo {
explicit InlinedFunctionInfo(int start_position)
: start_position(start_position) {}
int start_position;
};
// CompilationInfo encapsulates some information known at compile time. It // CompilationInfo encapsulates some information known at compile time. It
// is constructed based on the resources available at compile-time. // is constructed based on the resources available at compile-time.
@ -386,10 +379,6 @@ class CompilationInfo final {
prologue_offset_ = prologue_offset; prologue_offset_ = prologue_offset;
} }
std::vector<InlinedFunctionInfo>& inlined_function_infos() {
return inlined_function_infos_;
}
CompilationDependencies* dependencies() { return &dependencies_; } CompilationDependencies* dependencies() { return &dependencies_; }
int optimization_id() const { return optimization_id_; } int optimization_id() const { return optimization_id_; }
@ -519,7 +508,6 @@ class CompilationInfo final {
int prologue_offset_; int prologue_offset_;
std::vector<InlinedFunctionInfo> inlined_function_infos_;
bool track_positions_; bool track_positions_;
InlinedFunctionList inlined_functions_; InlinedFunctionList inlined_functions_;

View File

@ -1373,8 +1373,8 @@ int HGraphBuilder::TraceInlinedFunction(Handle<SharedFunctionInfo> shared,
SourcePosition position) { SourcePosition position) {
DCHECK(info_->is_tracking_positions()); DCHECK(info_->is_tracking_positions());
int inline_id = static_cast<int>(info_->inlined_function_infos().size()); int inline_id = static_cast<int>(graph()->inlined_function_infos().size());
InlinedFunctionInfo info(shared->start_position()); HInlinedFunctionInfo info(shared->start_position());
if (!shared->script()->IsUndefined()) { if (!shared->script()->IsUndefined()) {
Handle<Script> script(Script::cast(shared->script())); Handle<Script> script(Script::cast(shared->script()));
@ -1403,7 +1403,7 @@ int HGraphBuilder::TraceInlinedFunction(Handle<SharedFunctionInfo> shared,
} }
} }
info_->inlined_function_infos().push_back(info); graph()->inlined_function_infos().push_back(info);
if (FLAG_hydrogen_track_positions && inline_id != 0) { if (FLAG_hydrogen_track_positions && inline_id != 0) {
CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer());
@ -3792,7 +3792,8 @@ HGraph::HGraph(CompilationInfo* info, CallInterfaceDescriptor descriptor)
type_change_checksum_(0), type_change_checksum_(0),
maximum_environment_size_(0), maximum_environment_size_(0),
no_side_effects_scope_count_(0), no_side_effects_scope_count_(0),
disallow_adding_new_values_(false) { disallow_adding_new_values_(false),
inlined_function_infos_(info->zone()) {
if (info->IsStub()) { if (info->IsStub()) {
// For stubs, explicitly add the context to the environment. // For stubs, explicitly add the context to the environment.
start_environment_ = new (zone_) start_environment_ = new (zone_)
@ -3826,9 +3827,7 @@ void HGraph::FinalizeUniqueness() {
int HGraph::SourcePositionToScriptPosition(SourcePosition pos) { int HGraph::SourcePositionToScriptPosition(SourcePosition pos) {
return (FLAG_hydrogen_track_positions && !pos.IsUnknown()) return (FLAG_hydrogen_track_positions && !pos.IsUnknown())
? info()->inlined_function_infos() ? inlined_function_infos_.at(pos.inlining_id()).start_position +
.at(pos.inlining_id())
.start_position +
pos.position() pos.position()
: pos.raw(); : pos.raw();
} }

View File

@ -317,6 +317,11 @@ class HLoopInformation final : public ZoneObject {
HStackCheck* stack_check_; HStackCheck* stack_check_;
}; };
struct HInlinedFunctionInfo {
explicit HInlinedFunctionInfo(int start_position)
: start_position(start_position) {}
int start_position;
};
class HGraph final : public ZoneObject { class HGraph final : public ZoneObject {
public: public:
@ -466,6 +471,10 @@ class HGraph final : public ZoneObject {
// the corresponding script. // the corresponding script.
int SourcePositionToScriptPosition(SourcePosition position); int SourcePositionToScriptPosition(SourcePosition position);
ZoneVector<HInlinedFunctionInfo>& inlined_function_infos() {
return inlined_function_infos_;
}
private: private:
HConstant* ReinsertConstantIfNecessary(HConstant* constant); HConstant* ReinsertConstantIfNecessary(HConstant* constant);
HConstant* GetConstant(SetOncePointer<HConstant>* pointer, HConstant* GetConstant(SetOncePointer<HConstant>* pointer,
@ -510,6 +519,8 @@ class HGraph final : public ZoneObject {
int no_side_effects_scope_count_; int no_side_effects_scope_count_;
bool disallow_adding_new_values_; bool disallow_adding_new_values_;
ZoneVector<HInlinedFunctionInfo> inlined_function_infos_;
DISALLOW_COPY_AND_ASSIGN(HGraph); DISALLOW_COPY_AND_ASSIGN(HGraph);
}; };