Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(595)

Unified Diff: test/cctest/test-parsing.cc

Issue 2683733002: Revert of Reland: [Parse] ParseInfo owns the parsing Zone. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/parsing/test-preparser.cc ('k') | test/fuzzer/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 290b3e39b3c6c88ba475d2dc9f29f7de8a0e1079..00b07328e588e2e19847022cb92cf4e9c6015c87 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -804,7 +804,8 @@
factory->NewStringFromUtf8(i::CStrVector(program.start()))
.ToHandleChecked();
i::Handle<i::Script> script = factory->NewScript(source);
- i::ParseInfo info(script);
+ i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
+ i::ParseInfo info(&zone, script);
// The information we're checking is only produced when eager parsing.
info.set_allow_lazy_parsing(false);
CHECK(i::parsing::ParseProgram(&info));
@@ -860,7 +861,7 @@
i::Handle<i::Script> script = factory->NewScript(source_code);
- i::ParseInfo info(script);
+ i::ParseInfo info(handles.main_zone(), script);
i::Parser parser(&info);
info.set_allow_lazy_parsing(false);
info.set_toplevel(true);
@@ -1158,7 +1159,8 @@
i::CStrVector(program.start())).ToHandleChecked();
CHECK_EQ(source->length(), kProgramSize);
i::Handle<i::Script> script = factory->NewScript(source);
- i::ParseInfo info(script);
+ i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
+ i::ParseInfo info(&zone, script);
info.set_language_mode(source_data[i].language_mode);
i::parsing::ParseProgram(&info);
CHECK_NOT_NULL(info.literal());
@@ -1204,7 +1206,8 @@
i::Handle<i::String> source_code =
factory->NewStringFromUtf8(i::CStrVector(source)).ToHandleChecked();
i::Handle<i::Script> script = factory->NewScript(source_code);
- i::ParseInfo info(script);
+ i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
+ i::ParseInfo info(&zone, script);
i::parsing::ParseProgram(&info);
function = info.literal();
CHECK_NOT_NULL(function);
@@ -1334,7 +1337,8 @@
i::FunctionLiteral* function;
{
i::Handle<i::Script> script = factory->NewScript(source);
- i::ParseInfo info(script);
+ i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
+ i::ParseInfo info(&zone, script);
info.set_allow_lazy_parsing(flags.Contains(kAllowLazy));
SetGlobalFlags(flags);
if (is_module) info.set_module();
@@ -2461,7 +2465,8 @@
i::Handle<i::String> source =
factory->NewStringFromUtf8(i::CStrVector(program)).ToHandleChecked();
i::Handle<i::Script> script = factory->NewScript(source);
- i::ParseInfo info(script);
+ i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
+ i::ParseInfo info(&zone, script);
i::ScriptData* sd = NULL;
info.set_cached_data(&sd);
info.set_compile_options(v8::ScriptCompiler::kProduceParserCache);
@@ -3348,6 +3353,7 @@
i::SNPrintF(program, "%s%s%s%s%s", prefix, outer, midfix, inner,
suffix);
+ i::Zone zone(isolate->allocator(), ZONE_NAME);
std::unique_ptr<i::ParseInfo> info;
if (lazy) {
printf("%s\n", program.start());
@@ -3355,7 +3361,7 @@
i::Handle<i::Object> o = v8::Utils::OpenHandle(*v);
i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
i::Handle<i::SharedFunctionInfo> shared = i::handle(f->shared());
- info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(shared));
+ info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(&zone, shared));
CHECK(i::parsing::ParseFunction(info.get()));
} else {
i::Handle<i::String> source =
@@ -3363,7 +3369,7 @@
source->PrintOn(stdout);
printf("\n");
i::Handle<i::Script> script = factory->NewScript(source);
- info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(script));
+ info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(&zone, script));
info->set_allow_lazy_parsing(false);
CHECK(i::parsing::ParseProgram(info.get()));
}
@@ -3462,13 +3468,14 @@
i::ScopedVector<char> program(Utf8LengthHelper(source) +
Utf8LengthHelper(suffix) + 1);
i::SNPrintF(program, "%s%s", source, suffix);
+ i::Zone zone(isolate->allocator(), ZONE_NAME);
std::unique_ptr<i::ParseInfo> info;
printf("%s\n", program.start());
v8::Local<v8::Value> v = CompileRun(program.start());
i::Handle<i::Object> o = v8::Utils::OpenHandle(*v);
i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
i::Handle<i::SharedFunctionInfo> shared = i::handle(f->shared());
- info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(shared));
+ info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(&zone, shared));
info->set_allow_lazy_parsing(allow_lazy);
CHECK(i::parsing::ParseFunction(info.get()));
CHECK(i::Compiler::Analyze(info.get()));
@@ -3494,8 +3501,8 @@
std::vector<unsigned> location; // "Directions" to the relevant scope.
};
-static void TestMaybeAssigned(Input input, const char* variable, bool module,
- bool allow_lazy_parsing) {
+static void TestMaybeAssigned(i::Zone* zone, Input input, const char* variable,
+ bool module, bool allow_lazy_parsing) {
i::Factory* factory = CcTest::i_isolate()->factory();
i::Handle<i::String> string =
factory->InternalizeUtf8String(input.source.c_str());
@@ -3504,7 +3511,7 @@
i::Handle<i::Script> script = factory->NewScript(string);
std::unique_ptr<i::ParseInfo> info;
- info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(script));
+ info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(zone, script));
info->set_module(module);
info->set_allow_lazy_parsing(allow_lazy_parsing);
@@ -3553,6 +3560,7 @@
i::Isolate* isolate = CcTest::i_isolate();
i::HandleScope scope(isolate);
LocalContext env;
+ i::Zone zone(isolate->allocator(), ZONE_NAME);
std::vector<unsigned> top; // Can't use {} in initializers below.
@@ -3830,9 +3838,9 @@
for (unsigned module = 0; module <= 1; ++module) {
for (unsigned allow_lazy_parsing = 0; allow_lazy_parsing <= 1;
++allow_lazy_parsing) {
- TestMaybeAssigned(input, "foo", module, allow_lazy_parsing);
+ TestMaybeAssigned(&zone, input, "foo", module, allow_lazy_parsing);
}
- TestMaybeAssigned(wrap(input), "foo", module, false);
+ TestMaybeAssigned(&zone, wrap(input), "foo", module, false);
}
}
@@ -3840,9 +3848,9 @@
Input input = script_only_tests[i];
for (unsigned allow_lazy_parsing = 0; allow_lazy_parsing <= 1;
++allow_lazy_parsing) {
- TestMaybeAssigned(input, "foo", false, allow_lazy_parsing);
+ TestMaybeAssigned(&zone, input, "foo", false, allow_lazy_parsing);
}
- TestMaybeAssigned(wrap(input), "foo", false, false);
+ TestMaybeAssigned(&zone, wrap(input), "foo", false, false);
}
}
@@ -3874,6 +3882,7 @@
i::ScopedVector<char> program(Utf8LengthHelper(prefix) +
Utf8LengthHelper(source) + 1);
i::SNPrintF(program, "%s%s", prefix, source);
+ i::Zone zone(isolate->allocator(), ZONE_NAME);
i::Handle<i::String> string =
factory->InternalizeUtf8String(program.start());
@@ -3884,7 +3893,7 @@
for (unsigned allow_lazy = 0; allow_lazy < 2; ++allow_lazy) {
for (unsigned module = 0; module < 2; ++module) {
std::unique_ptr<i::ParseInfo> info;
- info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(script));
+ info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(&zone, script));
info->set_module(module);
info->set_allow_lazy_parsing(allow_lazy);
@@ -6337,7 +6346,8 @@
// Show that parsing as a module works
{
i::Handle<i::Script> script = factory->NewScript(source);
- i::ParseInfo info(script);
+ i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
+ i::ParseInfo info(&zone, script);
info.set_module();
if (!i::parsing::ParseProgram(&info)) {
i::Handle<i::JSObject> exception_handle(
@@ -6361,7 +6371,8 @@
// And that parsing a script does not.
{
i::Handle<i::Script> script = factory->NewScript(source);
- i::ParseInfo info(script);
+ i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
+ i::ParseInfo info(&zone, script);
CHECK(!i::parsing::ParseProgram(&info));
isolate->clear_pending_exception();
}
@@ -6451,7 +6462,8 @@
factory->NewStringFromAsciiChecked(kErrorSources[i]);
i::Handle<i::Script> script = factory->NewScript(source);
- i::ParseInfo info(script);
+ i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
+ i::ParseInfo info(&zone, script);
info.set_module();
CHECK(!i::parsing::ParseProgram(&info));
isolate->clear_pending_exception();
@@ -6487,7 +6499,8 @@
factory->NewStringFromAsciiChecked(kErrorSources[i]);
i::Handle<i::Script> script = factory->NewScript(source);
- i::ParseInfo info(script);
+ i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
+ i::ParseInfo info(&zone, script);
info.set_module();
CHECK(!i::parsing::ParseProgram(&info));
isolate->clear_pending_exception();
@@ -6684,7 +6697,8 @@
"export {foob};";
i::Handle<i::String> source = factory->NewStringFromAsciiChecked(kSource);
i::Handle<i::Script> script = factory->NewScript(source);
- i::ParseInfo info(script);
+ i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
+ i::ParseInfo info(&zone, script);
info.set_module();
CHECK(i::parsing::ParseProgram(&info));
CHECK(i::Compiler::Analyze(&info));
@@ -6943,7 +6957,8 @@
i::Handle<i::Script> script =
factory->NewScript(factory->NewStringFromAsciiChecked(source));
- i::ParseInfo info(script);
+ i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
+ i::ParseInfo info(&zone, script);
i::parsing::ParseProgram(&info);
CHECK(info.literal() != NULL);
CHECK_EQ(expected_language_mode, info.literal()->language_mode());
@@ -9417,7 +9432,8 @@
printf("\n");
i::Handle<i::Script> script = factory->NewScript(source);
- i::ParseInfo info(script);
+ i::Zone zone(isolate->allocator(), ZONE_NAME);
+ i::ParseInfo info(&zone, script);
CHECK(i::parsing::ParseProgram(&info));
CHECK(i::Compiler::Analyze(&info));
« no previous file with comments | « test/cctest/parsing/test-preparser.cc ('k') | test/fuzzer/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698