Commit 7421c7f5 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

Remove dangerous constructor from CompilationInfoWithZone.

This removes the stub-based constructor from CompilationInfoWithZone
as this class is more than a pure convenience class and only by chance
doesn't have an effect in the destructor.

R=titzer@chromium.org

Review URL: https://codereview.chromium.org/1026513004

Cr-Commit-Position: refs/heads/master@{#27376}
parent f42e09ae
...@@ -35,7 +35,7 @@ static LChunk* OptimizeGraph(HGraph* graph) { ...@@ -35,7 +35,7 @@ static LChunk* OptimizeGraph(HGraph* graph) {
class CodeStubGraphBuilderBase : public HGraphBuilder { class CodeStubGraphBuilderBase : public HGraphBuilder {
public: public:
explicit CodeStubGraphBuilderBase(CompilationInfoWithZone* info) explicit CodeStubGraphBuilderBase(CompilationInfo* info)
: HGraphBuilder(info), : HGraphBuilder(info),
arguments_length_(NULL), arguments_length_(NULL),
info_(info), info_(info),
...@@ -107,7 +107,7 @@ class CodeStubGraphBuilderBase : public HGraphBuilder { ...@@ -107,7 +107,7 @@ class CodeStubGraphBuilderBase : public HGraphBuilder {
SmartArrayPointer<HParameter*> parameters_; SmartArrayPointer<HParameter*> parameters_;
HValue* arguments_length_; HValue* arguments_length_;
CompilationInfoWithZone* info_; CompilationInfo* info_;
CodeStubDescriptor descriptor_; CodeStubDescriptor descriptor_;
HContext* context_; HContext* context_;
}; };
...@@ -190,7 +190,7 @@ bool CodeStubGraphBuilderBase::BuildGraph() { ...@@ -190,7 +190,7 @@ bool CodeStubGraphBuilderBase::BuildGraph() {
template <class Stub> template <class Stub>
class CodeStubGraphBuilder: public CodeStubGraphBuilderBase { class CodeStubGraphBuilder: public CodeStubGraphBuilderBase {
public: public:
explicit CodeStubGraphBuilder(CompilationInfoWithZone* info) explicit CodeStubGraphBuilder(CompilationInfo* info)
: CodeStubGraphBuilderBase(info) {} : CodeStubGraphBuilderBase(info) {}
protected: protected:
...@@ -272,7 +272,8 @@ static Handle<Code> DoGenerateCode(Stub* stub) { ...@@ -272,7 +272,8 @@ static Handle<Code> DoGenerateCode(Stub* stub) {
if (FLAG_profile_hydrogen_code_stub_compilation) { if (FLAG_profile_hydrogen_code_stub_compilation) {
timer.Start(); timer.Start();
} }
CompilationInfoWithZone info(stub, isolate); Zone zone;
CompilationInfo info(stub, isolate, &zone);
CodeStubGraphBuilder<Stub> builder(&info); CodeStubGraphBuilder<Stub> builder(&info);
LChunk* chunk = OptimizeGraph(builder.CreateGraph()); LChunk* chunk = OptimizeGraph(builder.CreateGraph());
Handle<Code> code = chunk->Codegen(); Handle<Code> code = chunk->Codegen();
...@@ -1711,7 +1712,7 @@ template <> ...@@ -1711,7 +1712,7 @@ template <>
class CodeStubGraphBuilder<KeyedLoadGenericStub> class CodeStubGraphBuilder<KeyedLoadGenericStub>
: public CodeStubGraphBuilderBase { : public CodeStubGraphBuilderBase {
public: public:
explicit CodeStubGraphBuilder(CompilationInfoWithZone* info) explicit CodeStubGraphBuilder(CompilationInfo* info)
: CodeStubGraphBuilderBase(info) {} : CodeStubGraphBuilderBase(info) {}
protected: protected:
......
...@@ -494,8 +494,6 @@ class CompilationInfoWithZone: public CompilationInfo { ...@@ -494,8 +494,6 @@ class CompilationInfoWithZone: public CompilationInfo {
public: public:
explicit CompilationInfoWithZone(Handle<Script> script); explicit CompilationInfoWithZone(Handle<Script> script);
explicit CompilationInfoWithZone(Handle<JSFunction> closure); explicit CompilationInfoWithZone(Handle<JSFunction> closure);
CompilationInfoWithZone(CodeStub* stub, Isolate* isolate)
: CompilationInfo(stub, isolate, &zone_) {}
// Virtual destructor because a CompilationInfoWithZone has to exit the // Virtual destructor because a CompilationInfoWithZone has to exit the
// zone scope and get rid of dependent maps even when the destructor is // zone scope and get rid of dependent maps even when the destructor is
......
...@@ -27,20 +27,14 @@ typedef v8::internal::compiler::InstructionSequence TestInstrSeq; ...@@ -27,20 +27,14 @@ typedef v8::internal::compiler::InstructionSequence TestInstrSeq;
class InstructionTester : public HandleAndZoneScope { class InstructionTester : public HandleAndZoneScope {
public: // We're all friends here. public: // We're all friends here.
InstructionTester() InstructionTester()
: isolate(main_isolate()), : graph(zone()),
graph(zone()),
schedule(zone()), schedule(zone()),
fake_stub(main_isolate()),
info(&fake_stub, main_isolate()),
common(zone()), common(zone()),
machine(zone()), machine(zone()),
code(NULL) {} code(NULL) {}
Isolate* isolate;
Graph graph; Graph graph;
Schedule schedule; Schedule schedule;
FakeStubForTesting fake_stub;
CompilationInfoWithZone info;
CommonOperatorBuilder common; CommonOperatorBuilder common;
MachineOperatorBuilder machine; MachineOperatorBuilder machine;
TestInstrSeq* code; TestInstrSeq* code;
......
...@@ -74,9 +74,10 @@ TEST(TestLinkageJSFunctionIncoming) { ...@@ -74,9 +74,10 @@ TEST(TestLinkageJSFunctionIncoming) {
TEST(TestLinkageCodeStubIncoming) { TEST(TestLinkageCodeStubIncoming) {
Isolate* isolate = CcTest::InitIsolateOnce(); Isolate* isolate = CcTest::InitIsolateOnce();
Zone zone;
ToNumberStub stub(isolate); ToNumberStub stub(isolate);
CompilationInfoWithZone info(&stub, isolate); CompilationInfo info(&stub, isolate, &zone);
CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info); CallDescriptor* descriptor = Linkage::ComputeIncoming(&zone, &info);
CHECK(descriptor); CHECK(descriptor);
CHECK_EQ(1, static_cast<int>(descriptor->JSParameterCount())); CHECK_EQ(1, static_cast<int>(descriptor->JSParameterCount()));
CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount())); CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment