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

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

Issue 1952473003: Add support for disabling the preparser when testing modules (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | no next file » | 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 7f297b3d67a58b260ce1359c0722b398c5cfce96..5095710a67b84df2b27a79737537965b664206c2 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -1535,7 +1535,8 @@ void SetParserFlags(i::ParserBase<Traits>* parser,
void TestParserSyncWithFlags(i::Handle<i::String> source,
i::EnumSet<ParserFlag> flags,
ParserSyncTestResult result,
- bool is_module = false) {
+ bool is_module = false,
+ bool test_preparser = true) {
i::Isolate* isolate = CcTest::i_isolate();
i::Factory* factory = isolate->factory();
@@ -1545,7 +1546,7 @@ void TestParserSyncWithFlags(i::Handle<i::String> source,
// Preparse the data.
i::CompleteParserRecorder log;
- {
+ if (test_preparser) {
i::Scanner scanner(isolate->unicode_cache());
i::GenericStringUtf16CharacterStream stream(source, 0, source->length());
i::Zone zone(CcTest::i_isolate()->allocator());
@@ -1602,7 +1603,7 @@ void TestParserSyncWithFlags(i::Handle<i::String> source,
CHECK(false);
}
- if (!preparse_error) {
+ if (test_preparser && !preparse_error) {
v8::base::OS::Print(
"Parser failed on:\n"
"\t%s\n"
@@ -1613,7 +1614,7 @@ void TestParserSyncWithFlags(i::Handle<i::String> source,
CHECK(false);
}
// Check that preparser and parser produce the same error.
- {
+ if (test_preparser) {
i::Handle<i::String> preparser_message =
FormatMessage(log.ErrorMessageData());
if (!i::String::Equals(message_string, preparser_message)) {
@@ -1628,7 +1629,7 @@ void TestParserSyncWithFlags(i::Handle<i::String> source,
CHECK(false);
}
}
- } else if (preparse_error) {
+ } else if (test_preparser && preparse_error) {
v8::base::OS::Print(
"Preparser failed on:\n"
"\t%s\n"
@@ -1645,7 +1646,8 @@ void TestParserSyncWithFlags(i::Handle<i::String> source,
"However, parser and preparser succeeded",
source->ToCString().get());
CHECK(false);
- } else if (preparser_materialized_literals != parser_materialized_literals) {
+ } else if (test_preparser &&
+ preparser_materialized_literals != parser_materialized_literals) {
v8::base::OS::Print(
"Preparser materialized literals (%d) differ from Parser materialized "
"literals (%d) on:\n"
@@ -1665,7 +1667,7 @@ void TestParserSync(const char* source, const ParserFlag* varying_flags,
size_t always_true_flags_length = 0,
const ParserFlag* always_false_flags = NULL,
size_t always_false_flags_length = 0,
- bool is_module = false) {
+ bool is_module = false, bool test_preparser = true) {
i::Handle<i::String> str =
CcTest::i_isolate()->factory()->NewStringFromAsciiChecked(source);
for (int bits = 0; bits < (1 << varying_flags_length); bits++) {
@@ -1682,7 +1684,7 @@ void TestParserSync(const char* source, const ParserFlag* varying_flags,
++flag_index) {
flags.Remove(always_false_flags[flag_index]);
}
- TestParserSyncWithFlags(str, flags, result, is_module);
+ TestParserSyncWithFlags(str, flags, result, is_module, test_preparser);
}
}
@@ -1830,7 +1832,8 @@ void RunParserSyncTest(const char* context_data[][2],
const ParserFlag* always_true_flags = NULL,
int always_true_len = 0,
const ParserFlag* always_false_flags = NULL,
- int always_false_len = 0, bool is_module = false) {
+ int always_false_len = 0, bool is_module = false,
+ bool test_preparser = true) {
v8::HandleScope handles(CcTest::isolate());
v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate());
v8::Context::Scope context_scope(context);
@@ -1885,7 +1888,7 @@ void RunParserSyncTest(const char* context_data[][2],
CHECK(length == kProgramSize);
TestParserSync(program.start(), flags, flags_len, result,
always_true_flags, always_true_len, always_false_flags,
- always_false_len, is_module);
+ always_false_len, is_module, test_preparser);
}
}
delete[] generated_flags;
@@ -1899,10 +1902,11 @@ void RunModuleParserSyncTest(const char* context_data[][2],
const ParserFlag* always_true_flags = NULL,
int always_true_len = 0,
const ParserFlag* always_false_flags = NULL,
- int always_false_len = 0) {
+ int always_false_len = 0,
+ bool test_preparser = true) {
RunParserSyncTest(context_data, statement_data, result, flags, flags_len,
always_true_flags, always_true_len, always_false_flags,
- always_false_len, true);
+ always_false_len, true, test_preparser);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698