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}
This commit is contained in:
mstarzinger 2015-03-23 10:30:38 -07:00 committed by Commit bot
parent f42e09aef2
commit 7421c7f598
4 changed files with 10 additions and 16 deletions

View File

@ -35,7 +35,7 @@ static LChunk* OptimizeGraph(HGraph* graph) {
class CodeStubGraphBuilderBase : public HGraphBuilder {
public:
explicit CodeStubGraphBuilderBase(CompilationInfoWithZone* info)
explicit CodeStubGraphBuilderBase(CompilationInfo* info)
: HGraphBuilder(info),
arguments_length_(NULL),
info_(info),
@ -107,7 +107,7 @@ class CodeStubGraphBuilderBase : public HGraphBuilder {
SmartArrayPointer<HParameter*> parameters_;
HValue* arguments_length_;
CompilationInfoWithZone* info_;
CompilationInfo* info_;
CodeStubDescriptor descriptor_;
HContext* context_;
};
@ -190,7 +190,7 @@ bool CodeStubGraphBuilderBase::BuildGraph() {
template <class Stub>
class CodeStubGraphBuilder: public CodeStubGraphBuilderBase {
public:
explicit CodeStubGraphBuilder(CompilationInfoWithZone* info)
explicit CodeStubGraphBuilder(CompilationInfo* info)
: CodeStubGraphBuilderBase(info) {}
protected:
@ -272,7 +272,8 @@ static Handle<Code> DoGenerateCode(Stub* stub) {
if (FLAG_profile_hydrogen_code_stub_compilation) {
timer.Start();
}
CompilationInfoWithZone info(stub, isolate);
Zone zone;
CompilationInfo info(stub, isolate, &zone);
CodeStubGraphBuilder<Stub> builder(&info);
LChunk* chunk = OptimizeGraph(builder.CreateGraph());
Handle<Code> code = chunk->Codegen();
@ -1711,7 +1712,7 @@ template <>
class CodeStubGraphBuilder<KeyedLoadGenericStub>
: public CodeStubGraphBuilderBase {
public:
explicit CodeStubGraphBuilder(CompilationInfoWithZone* info)
explicit CodeStubGraphBuilder(CompilationInfo* info)
: CodeStubGraphBuilderBase(info) {}
protected:

View File

@ -494,8 +494,6 @@ class CompilationInfoWithZone: public CompilationInfo {
public:
explicit CompilationInfoWithZone(Handle<Script> script);
explicit CompilationInfoWithZone(Handle<JSFunction> closure);
CompilationInfoWithZone(CodeStub* stub, Isolate* isolate)
: CompilationInfo(stub, isolate, &zone_) {}
// Virtual destructor because a CompilationInfoWithZone has to exit the
// zone scope and get rid of dependent maps even when the destructor is

View File

@ -27,20 +27,14 @@ typedef v8::internal::compiler::InstructionSequence TestInstrSeq;
class InstructionTester : public HandleAndZoneScope {
public: // We're all friends here.
InstructionTester()
: isolate(main_isolate()),
graph(zone()),
: graph(zone()),
schedule(zone()),
fake_stub(main_isolate()),
info(&fake_stub, main_isolate()),
common(zone()),
machine(zone()),
code(NULL) {}
Isolate* isolate;
Graph graph;
Schedule schedule;
FakeStubForTesting fake_stub;
CompilationInfoWithZone info;
CommonOperatorBuilder common;
MachineOperatorBuilder machine;
TestInstrSeq* code;

View File

@ -74,9 +74,10 @@ TEST(TestLinkageJSFunctionIncoming) {
TEST(TestLinkageCodeStubIncoming) {
Isolate* isolate = CcTest::InitIsolateOnce();
Zone zone;
ToNumberStub stub(isolate);
CompilationInfoWithZone info(&stub, isolate);
CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info);
CompilationInfo info(&stub, isolate, &zone);
CallDescriptor* descriptor = Linkage::ComputeIncoming(&zone, &info);
CHECK(descriptor);
CHECK_EQ(1, static_cast<int>(descriptor->JSParameterCount()));
CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount()));