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

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

Issue 8306024: Make native syntax an early error in the preparser. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Unified enums Created 9 years, 2 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 | « src/scanner.h ('k') | 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 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();
« no previous file with comments | « src/scanner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698