Reviewers: titzer,
Description:
Remove CompilationInfoWithZone from public API.
This removes the CompilationInfoWithZone class from the header file
because it is more than a pure convenience class and shouldn't be used
outside of the compiler at all.
[email protected]
Please review this at https://codereview.chromium.org/1000353004/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+42, -31 lines):
M src/compiler.h
M src/compiler.cc
M src/compiler/js-inlining.cc
M test/cctest/compiler/function-tester.h
M test/cctest/compiler/test-linkage.cc
M test/cctest/compiler/test-pipeline.cc
M test/cctest/compiler/test-run-stubs.cc
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index
4f0ddd997694faef7b3cf689a1c577f3daa88bed..9d27783964eb54f87c33ffcde98745ba8c04457a
100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -74,6 +74,23 @@ PARSE_INFO_GETTER(Handle<SharedFunctionInfo>,
shared_info)
#undef PARSE_INFO_GETTER_WITH_DEFAULT
+// Exactly like a CompilationInfo, except also creates and enters a
+// Zone on construction and deallocates it on exit.
+class CompilationInfoWithZone : public CompilationInfo {
+ public:
+ explicit CompilationInfoWithZone(Handle<Script> script);
+ explicit CompilationInfoWithZone(Handle<JSFunction> closure);
+
+ // Virtual destructor because a CompilationInfoWithZone has to exit the
+ // zone scope and get rid of dependent maps even when the destructor is
+ // called when cast as a CompilationInfo.
+ virtual ~CompilationInfoWithZone();
+
+ private:
+ Zone zone_;
+};
+
+
bool CompilationInfo::has_shared_info() const {
return parse_info_ && !parse_info_->shared_info().is_null();
}
Index: src/compiler.h
diff --git a/src/compiler.h b/src/compiler.h
index
37c1184004e8c4bb96423cd49f90c3cd88eacbef..18c1327c8eefd5f388a33983cb194f041fd62f93
100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -488,22 +488,6 @@ class CompilationInfo {
};
-// Exactly like a CompilationInfo, except also creates and enters a
-// Zone on construction and deallocates it on exit.
-class CompilationInfoWithZone: public CompilationInfo {
- public:
- explicit CompilationInfoWithZone(Handle<Script> script);
- explicit CompilationInfoWithZone(Handle<JSFunction> closure);
-
- // Virtual destructor because a CompilationInfoWithZone has to exit the
- // zone scope and get rid of dependent maps even when the destructor is
- // called when cast as a CompilationInfo.
- virtual ~CompilationInfoWithZone();
-
- private:
- Zone zone_;
-};
-
// A wrapper around a CompilationInfo that detaches the Handles from
// the underlying DeferredHandleScope and stores them in info_ on
// destruction.
Index: src/compiler/js-inlining.cc
diff --git a/src/compiler/js-inlining.cc b/src/compiler/js-inlining.cc
index
5f67eb7bfe7bf3aa750e07ef241697465ac1f3a6..5144afe1c78d3b47e5c0b04e353bd4adbcc2755a
100644
--- a/src/compiler/js-inlining.cc
+++ b/src/compiler/js-inlining.cc
@@ -320,7 +320,9 @@ Reduction JSInliner::Reduce(Node* node) {
return NoChange();
}
- CompilationInfoWithZone info(function);
+ Zone zone;
+ ParseInfo parse_info(&zone, function);
+ CompilationInfo info(&parse_info);
if (!Compiler::ParseAndAnalyze(info.parse_info())) return NoChange();
if (!Compiler::EnsureDeoptimizationSupport(&info)) return NoChange();
Index: test/cctest/compiler/function-tester.h
diff --git a/test/cctest/compiler/function-tester.h
b/test/cctest/compiler/function-tester.h
index
56dc0a9e732beb1b68f74e6aa3d25e1985a05c3f..20efd1e304ad26096d2c94c4daf3b57c186b0b50
100644
--- a/test/cctest/compiler/function-tester.h
+++ b/test/cctest/compiler/function-tester.h
@@ -150,7 +150,9 @@ class FunctionTester : public InitializedHandleScope {
Handle<JSFunction> Compile(Handle<JSFunction> function) {
// TODO(titzer): make this method private.
#if V8_TURBOFAN_TARGET
- CompilationInfoWithZone info(function);
+ Zone zone;
+ ParseInfo parse_info(&zone, function);
+ CompilationInfo info(&parse_info);
CHECK(Parser::ParseStatic(info.parse_info()));
info.SetOptimizing(BailoutId::None(), Handle<Code>(function->code()));
@@ -206,7 +208,9 @@ class FunctionTester : public InitializedHandleScope {
// and replace the JSFunction's code with the result.
Handle<JSFunction> CompileGraph(Graph* graph) {
CHECK(Pipeline::SupportedTarget());
- CompilationInfoWithZone info(function);
+ Zone zone;
+ ParseInfo parse_info(&zone, function);
+ CompilationInfo info(&parse_info);
CHECK(Parser::ParseStatic(info.parse_info()));
info.SetOptimizing(BailoutId::None(),
Index: test/cctest/compiler/test-linkage.cc
diff --git a/test/cctest/compiler/test-linkage.cc
b/test/cctest/compiler/test-linkage.cc
index
0c8e961166da6ba15cd9b6016c7203e2bb5f8764..212ff3a8f20c7f8bf17a951505a92dc1c713fad4
100644
--- a/test/cctest/compiler/test-linkage.cc
+++ b/test/cctest/compiler/test-linkage.cc
@@ -6,6 +6,7 @@
#include "src/code-stubs.h"
#include "src/compiler.h"
+#include "src/parser.h"
#include "src/zone.h"
#include "src/compiler/common-operator.h"
@@ -42,25 +43,25 @@ static Handle<JSFunction> Compile(const char* source) {
TEST(TestLinkageCreate) {
- InitializedHandleScope handles;
+ HandleAndZoneScope handles;
Handle<JSFunction> function = Compile("a + b");
- CompilationInfoWithZone info(function);
+ ParseInfo parse_info(handles.main_zone(), function);
+ CompilationInfo info(&parse_info);
CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(),
&info);
CHECK(descriptor);
}
TEST(TestLinkageJSFunctionIncoming) {
- InitializedHandleScope handles;
-
const char* sources[] = {"(function() { })", "(function(a) { })",
"(function(a,b) { })", "(function(a,b,c) { })"};
for (int i = 0; i < 3; i++) {
- i::HandleScope handles(CcTest::i_isolate());
+ HandleAndZoneScope handles;
Handle<JSFunction> function = v8::Utils::OpenHandle(
*v8::Handle<v8::Function>::Cast(CompileRun(sources[i])));
- CompilationInfoWithZone info(function);
+ ParseInfo parse_info(handles.main_zone(), function);
+ CompilationInfo info(&parse_info);
CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(),
&info);
CHECK(descriptor);
@@ -89,7 +90,8 @@ TEST(TestLinkageCodeStubIncoming) {
TEST(TestLinkageJSCall) {
HandleAndZoneScope handles;
Handle<JSFunction> function = Compile("a + c");
- CompilationInfoWithZone info(function);
+ ParseInfo parse_info(handles.main_zone(), function);
+ CompilationInfo info(&parse_info);
for (int i = 0; i < 32; i++) {
CallDescriptor* descriptor = Linkage::GetJSCallDescriptor(
Index: test/cctest/compiler/test-pipeline.cc
diff --git a/test/cctest/compiler/test-pipeline.cc
b/test/cctest/compiler/test-pipeline.cc
index
e3710f77b48dabd50104fccd5b6f7661db50f0a8..b67af6ecf7d0047f45b1d689b3c3b1ca6fc02e9b
100644
--- a/test/cctest/compiler/test-pipeline.cc
+++ b/test/cctest/compiler/test-pipeline.cc
@@ -17,13 +17,13 @@ using namespace v8::internal;
using namespace v8::internal::compiler;
TEST(PipelineAdd) {
- InitializedHandleScope handles;
+ HandleAndZoneScope handles;
const char* source = "(function(a,b) { return a + b; })";
Handle<JSFunction> function = v8::Utils::OpenHandle(
*v8::Handle<v8::Function>::Cast(CompileRun(source)));
- CompilationInfoWithZone info(function);
-
- CHECK(Compiler::ParseAndAnalyze(info.parse_info()));
+ ParseInfo parse_info(handles.main_zone(), function);
+ CHECK(Compiler::ParseAndAnalyze(&parse_info));
+ CompilationInfo info(&parse_info);
Pipeline pipeline(&info);
#if V8_TURBOFAN_TARGET
Index: test/cctest/compiler/test-run-stubs.cc
diff --git a/test/cctest/compiler/test-run-stubs.cc
b/test/cctest/compiler/test-run-stubs.cc
index
67c08b08d6452ae13eaff3d32e8cd5d48fcf3597..daf9a461b1d28959f033565cec349ed75c649a72
100644
--- a/test/cctest/compiler/test-run-stubs.cc
+++ b/test/cctest/compiler/test-run-stubs.cc
@@ -42,8 +42,10 @@ class StringLengthStubTF : public CodeStub {
};
Handle<Code> GenerateCode() OVERRIDE {
+ Zone zone;
// Build a "hybrid" CompilationInfo for a JSFunction/CodeStub pair.
- CompilationInfoWithZone
info(GetFunction(isolate(), "STRING_LENGTH_STUB"));
+ ParseInfo parse_info(&zone,
GetFunction(isolate(), "STRING_LENGTH_STUB"));
+ CompilationInfo info(&parse_info);
info.SetStub(this);
// Run a "mini pipeline", extracted from compiler.cc.
CHECK(Parser::ParseStatic(info.parse_info()));
--
--
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.