Reviewers: titzer,

Description:
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.

[email protected]

Please review this at https://codereview.chromium.org/1026513004/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+11, -11 lines):
  M src/code-stubs-hydrogen.cc
  M src/compiler.h
  M test/cctest/compiler/test-instruction.cc
  M test/cctest/compiler/test-linkage.cc


Index: src/code-stubs-hydrogen.cc
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index 599e3c6412e2fad6171b4f09b3e5ab0f23d3f24b..8168aac4b861f804be40bd3857c066b380d6a851 100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -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:
Index: src/compiler.h
diff --git a/src/compiler.h b/src/compiler.h
index e58562664732af04b5fb4fa589440ec30b5482bc..73cfe499bfac0bc9db99b268b00c1a4c65343113 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -490,8 +490,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
Index: test/cctest/compiler/test-instruction.cc
diff --git a/test/cctest/compiler/test-instruction.cc b/test/cctest/compiler/test-instruction.cc index 03d8660deb593541f9ae8693a219333e0ce2e607..92db31e2eb0874e14a75c0b885c0b5277ae9d0f3 100644
--- a/test/cctest/compiler/test-instruction.cc
+++ b/test/cctest/compiler/test-instruction.cc
@@ -31,7 +31,7 @@ class InstructionTester : public HandleAndZoneScope {
         graph(zone()),
         schedule(zone()),
         fake_stub(main_isolate()),
-        info(&fake_stub, main_isolate()),
+        info(&fake_stub, main_isolate(), zone()),
         common(zone()),
         machine(zone()),
         code(NULL) {}
@@ -40,7 +40,7 @@ class InstructionTester : public HandleAndZoneScope {
   Graph graph;
   Schedule schedule;
   FakeStubForTesting fake_stub;
-  CompilationInfoWithZone info;
+  CompilationInfo info;
   CommonOperatorBuilder common;
   MachineOperatorBuilder machine;
   TestInstrSeq* code;
Index: test/cctest/compiler/test-linkage.cc
diff --git a/test/cctest/compiler/test-linkage.cc b/test/cctest/compiler/test-linkage.cc index fbf9237249b7911e42d8e910d30b62b815b41ac9..0c8e961166da6ba15cd9b6016c7203e2bb5f8764 100644
--- a/test/cctest/compiler/test-linkage.cc
+++ b/test/cctest/compiler/test-linkage.cc
@@ -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()));


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to