Index: test/cctest/test-parsing.cc |
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc |
index 8f217e6cde9438000c45d7cc8ecb5dfc0cc258dd..8d51f8caa5f9d2b5b92784f2c92a24c8a477f197 100755 |
--- a/test/cctest/test-parsing.cc |
+++ b/test/cctest/test-parsing.cc |
@@ -260,10 +260,11 @@ TEST(StandAlonePreParser) { |
i::JavaScriptScanner scanner(i::Isolate::Current()->unicode_cache()); |
scanner.Initialize(&stream); |
+ int flags = i::kAllowLazy | i::kAllowNativesSyntax; |
v8::preparser::PreParser::PreParseResult result = |
v8::preparser::PreParser::PreParseProgram(&scanner, |
&log, |
- true, |
+ flags, |
stack_limit); |
CHECK_EQ(v8::preparser::PreParser::kPreParseSuccess, result); |
i::ScriptDataImpl data(log.ExtractData()); |
@@ -272,6 +273,43 @@ TEST(StandAlonePreParser) { |
} |
+TEST(StandAlonePreParserNoNatives) { |
+ v8::V8::Initialize(); |
+ |
+ int marker; |
+ i::Isolate::Current()->stack_guard()->SetStackLimit( |
+ reinterpret_cast<uintptr_t>(&marker) - 128 * 1024); |
+ |
+ const char* programs[] = { |
+ "%ArgleBargle(glop);", |
+ "var x = %_IsSmi(42);", |
+ NULL |
+ }; |
+ |
+ uintptr_t stack_limit = i::Isolate::Current()->stack_guard()->real_climit(); |
+ for (int i = 0; programs[i]; i++) { |
+ const char* program = programs[i]; |
+ i::Utf8ToUC16CharacterStream stream( |
+ reinterpret_cast<const i::byte*>(program), |
+ static_cast<unsigned>(strlen(program))); |
+ i::CompleteParserRecorder log; |
+ i::JavaScriptScanner scanner(i::Isolate::Current()->unicode_cache()); |
+ scanner.Initialize(&stream); |
+ |
+ // Flags don't allow natives syntax. |
+ v8::preparser::PreParser::PreParseResult result = |
+ v8::preparser::PreParser::PreParseProgram(&scanner, |
+ &log, |
+ i::kAllowLazy, |
+ stack_limit); |
+ CHECK_EQ(v8::preparser::PreParser::kPreParseSuccess, result); |
+ i::ScriptDataImpl data(log.ExtractData()); |
+ // Data contains syntax error. |
+ CHECK(data.has_error()); |
+ } |
+} |
+ |
+ |
TEST(RegressChromium62639) { |
v8::V8::Initialize(); |