Revision: 7452
Author:   [email protected]
Date:     Thu Mar 31 01:12:17 2011
Log:      Reapply changelist r7436.

Remove test for existence of VM. Not all tests need the VM.

Review URL: http://codereview.chromium.org/6783011
http://code.google.com/p/v8/source/detail?r=7452

Added:
 /branches/bleeding_edge/test/preparser/empty.js
 /branches/bleeding_edge/test/preparser/functions-only.js
 /branches/bleeding_edge/test/preparser/non-alphanum.js
 /branches/bleeding_edge/test/preparser/symbols-only.js
 /branches/bleeding_edge/test/preparser/testcfg.py
Modified:
 /branches/bleeding_edge/SConstruct
 /branches/bleeding_edge/preparser/preparser-process.cc
 /branches/bleeding_edge/tools/test.py

=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/preparser/empty.js     Thu Mar 31 01:12:17 2011
@@ -0,0 +1,28 @@
+// Copyright 2011 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// This file contains no JavaScript code.
=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/preparser/functions-only.js Thu Mar 31 01:12:17 2011
@@ -0,0 +1,38 @@
+// Copyright 2011 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// This file contains no identifiers or string literals, but does contain
+// symbols.
+
+(function () {
+  if (this != null) {
+    return this;
+  }
+  while (true) {
+    if ([][2]) return false;
+  }
+})({}, function() { return [true]; } );
=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/preparser/non-alphanum.js Thu Mar 31 01:12:17 2011
@@ -0,0 +1,34 @@
+// Copyright 2011 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// This file contains no symbols or function declarations, and only
+// non-alphanumeric characters, but does contain valid code.
+
+// Created using http://discogscounter.getfreehosting.co.uk/js-noalnum_com.php
+// Probably only works in Firefox, but should parse fine.
+
+([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]])([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[+!+[]]]((![]+[])[+!+[]])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+[]]+(+[![]]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+[][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]]((![]+[])[+!+[]]+(+[![]]+[])[+[]])[+[]]+(![]+[])[+!+[]]+(+[]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+!+[]+[+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(+[![]]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+([]+([]+[])[([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[!+[]+!+[]+!+[]+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]]((![]+[])[+!+[]]+[+[]])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+([][[]]+[])[!+[]+!+[]]+[][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]]((+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+[+!+[]]+[+[]]+[+[]]+[+[]])+[])[+[]]+(![]+[])[+[]])[+[]])
=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/preparser/symbols-only.js Thu Mar 31 01:12:17 2011
@@ -0,0 +1,49 @@
+// Copyright 2011 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+//       notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+//       copyright notice, this list of conditions and the following
+//       disclaimer in the documentation and/or other materials provided
+//       with the distribution.
+//     * Neither the name of Google Inc. nor the names of its
+//       contributors may be used to endorse or promote products derived
+//       from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// This file contains no function declarations.
+
+var x = 42;
+var y = "hello world";
+if (x == y) {
+  with ({ x: 10, y: "20", z: 42 }) {
+    print(z);
+  }
+}
+try {
+  x = 2;
+  throw y;
+  y = 4;
+} catch (e) {
+  y = e;
+} finally {
+  x = y;
+}
+for (var i = 0; i < 10; i++) {
+  x += x;
+}
+print(y);
=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/preparser/testcfg.py Thu Mar 31 01:12:17 2011
@@ -0,0 +1,90 @@
+# Copyright 2011 the V8 project authors. All rights reserved.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+#       copyright notice, this list of conditions and the following
+#       disclaimer in the documentation and/or other materials provided
+#       with the distribution.
+#     * Neither the name of Google Inc. nor the names of its
+#       contributors may be used to endorse or promote products derived
+#       from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import test
+import os
+from os.path import join, dirname, exists
+import platform
+import utils
+
+
+class PreparserTestCase(test.TestCase):
+
+  def __init__(self, root, path, executable, mode, context):
+    super(PreparserTestCase, self).__init__(context, path, mode)
+    self.executable = executable
+    self.root = root
+
+  def GetLabel(self):
+    return "%s %s %s" % (self.mode, self.path[-2], self.path[-1])
+
+  def GetName(self):
+    return self.path[-1]
+
+  def BuildCommand(self, path):
+    testfile = join(self.root, self.GetName()) + ".js"
+    result = [self.executable, testfile]
+    return result
+
+  def GetCommand(self):
+    return self.BuildCommand(self.path)
+
+  def Run(self):
+    return test.TestCase.Run(self)
+
+
+class PreparserTestConfiguration(test.TestConfiguration):
+
+  def __init__(self, context, root):
+    super(PreparserTestConfiguration, self).__init__(context, root)
+
+  def GetBuildRequirements(self):
+    return ['preparser']
+
+  def ListTests(self, current_path, path, mode, variant_flags):
+    executable = join('obj', 'preparser', mode, 'preparser')
+    if utils.IsWindows():
+      executable += '.exe'
+    executable = join(self.context.buildspace, executable)
+    # Find all .js files in tests/preparser directory.
+ filenames = [f[:-3] for f in os.listdir(self.root) if f.endswith(".js")]
+    filenames.sort()
+    result = []
+    for file in filenames:
+      result.append(PreparserTestCase(self.root,
+                                      current_path + [file], executable,
+                                      mode, self.context))
+    return result
+
+  def GetTestStatus(self, sections, defs):
+    status_file = join(self.root, 'preparser.status')
+    if exists(status_file):
+      test.ReadConfigurationInto(status_file, sections, defs)
+
+
+def GetConfiguration(context, root):
+  return PreparserTestConfiguration(context, root)
=======================================
--- /branches/bleeding_edge/SConstruct  Wed Mar 30 10:33:18 2011
+++ /branches/bleeding_edge/SConstruct  Thu Mar 31 01:12:17 2011
@@ -1409,7 +1409,7 @@
     exports='context',
     duplicate=False
   )
- preparser_name = join('obj', 'preparser', target_id, 'preparser' + suffix)
+  preparser_name = join('obj', 'preparser', target_id, 'preparser')
preparser_program = preparser_env.Program(preparser_name, preparser_object);
   preparser_env.Depends(preparser_program, preparser_library)
   context.preparser_targets.append(preparser_program)
=======================================
--- /branches/bleeding_edge/preparser/preparser-process.cc Wed Mar 30 07:42:47 2011 +++ /branches/bleeding_edge/preparser/preparser-process.cc Thu Mar 31 01:12:17 2011
@@ -27,103 +27,62 @@

 #include <stdlib.h>
 #include <stdarg.h>
+#include <stdio.h>
+
 #include "../include/v8stdint.h"
 #include "../include/v8-preparser.h"
-#include "unicode-inl.h"
-
-enum ResultCode { kSuccess = 0, kErrorReading = 1, kErrorWriting = 2 };
-
-namespace v8 {
-namespace internal {
-
-// THIS FILE IS PROOF-OF-CONCEPT ONLY.
-// The final goal is a stand-alone preparser library.
-
-
-class UTF8InputStream : public v8::UnicodeInputStream {
+
+// This file is only used for testing the stand-alone preparser
+// library.
+// The first (and only) argument must be the path of a JavaScript file.
+// This file is preparsed and the resulting preparser data is written
+// to stdout. Diagnostic output is output on stderr.
+// The file must contain only ASCII characters (UTF-8 isn't supported).
+// The file is read into memory, so it should have a reasonable size.
+
+
+// Adapts an ASCII string to the UnicodeInputStream interface.
+class AsciiInputStream : public v8::UnicodeInputStream {
  public:
-  UTF8InputStream(uint8_t* buffer, size_t length)
+  AsciiInputStream(uint8_t* buffer, size_t length)
       : buffer_(buffer),
-        offset_(0),
-        pos_(0),
-        end_offset_(static_cast<int>(length)) { }
-
-  virtual ~UTF8InputStream() { }
+        end_offset_(static_cast<int>(length)),
+        offset_(0) { }
+
+  virtual ~AsciiInputStream() { }

   virtual void PushBack(int32_t ch) {
-    // Pushback assumes that the character pushed back is the
-    // one that was most recently read, and jumps back in the
-    // UTF-8 stream by the length of that character's encoding.
-    offset_ -= unibrow::Utf8::Length(ch);
-    pos_--;
+    offset_--;
 #ifdef DEBUG
-    if (static_cast<unsigned>(ch) <= unibrow::Utf8::kMaxOneByteChar) {
-      if (ch != buffer_[offset_]) {
-        fprintf(stderr, "Invalid pushback: '%c'.", ch);
-        exit(1);
-      }
-    } else {
-      unsigned tmp = 0;
-      if (static_cast<unibrow::uchar>(ch) !=
-          unibrow::Utf8::CalculateValue(buffer_ + offset_,
-                                        end_offset_ - offset_,
-                                        &tmp)) {
-        fprintf(stderr, "Invalid pushback: 0x%x.", ch);
-        exit(1);
-      }
+    if (offset_ < 0 ||
+        (ch != ((offset_ >= end_offset_) ? -1 : buffer_[offset_]))) {
+      fprintf(stderr, "Invalid pushback: '%c' at offset %d.", ch, offset_);
+      exit(1);
     }
 #endif
   }

   virtual int32_t Next() {
-    if (offset_ == end_offset_) return -1;
-    uint8_t first_char = buffer_[offset_];
-    if (first_char <= unibrow::Utf8::kMaxOneByteChar) {
-      pos_++;
-      offset_++;
-      return static_cast<int32_t>(first_char);
-    }
-    unibrow::uchar codepoint =
-        unibrow::Utf8::CalculateValue(buffer_ + offset_,
-                                      end_offset_ - offset_,
-                                      &offset_);
-    pos_++;
-    return static_cast<int32_t>(codepoint);
+    if (offset_ >= end_offset_) {
+      offset_++;  // Increment anyway to allow symmetric pushbacks.
+      return -1;
+    }
+    uint8_t next_char = buffer_[offset_];
+#ifdef DEBUG
+    if (next_char > 0x7fu) {
+      fprintf(stderr, "Non-ASCII character in input: '%c'.", next_char);
+      exit(1);
+    }
+#endif
+    offset_++;
+    return static_cast<int32_t>(next_char);
   }

  private:
   const uint8_t* buffer_;
-  unsigned offset_;
-  unsigned pos_;
-  unsigned end_offset_;
+  const int end_offset_;
+  int offset_;
 };
-
-
-// Write a number to dest in network byte order.
-void WriteUInt32(FILE* dest, uint32_t value, bool* ok) {
-  for (int i = 3; i >= 0; i--) {
-    uint8_t byte = static_cast<uint8_t>(value >> (i << 3));
-    int result = fputc(byte, dest);
-    if (result == EOF) {
-      *ok = false;
-      return;
-    }
-  }
-}
-
-// Read number from FILE* in network byte order.
-uint32_t ReadUInt32(FILE* source, bool* ok) {
-  uint32_t n = 0;
-  for (int i = 0; i < 4; i++) {
-    int c = fgetc(source);
-    if (c == EOF) {
-      *ok = false;
-      return 0;
-    }
-    n = (n << 8) + static_cast<uint32_t>(c);
-  }
-  return n;
-}


 bool ReadBuffer(FILE* source, void* buffer, size_t length) {
@@ -150,57 +109,61 @@
 };


-// Preparse input and output result on stdout.
-int PreParseIO(FILE* input) {
-  fprintf(stderr, "LOG: Enter parsing loop\n");
-  bool ok = true;
-  uint32_t length = ReadUInt32(input, &ok);
-  fprintf(stderr, "LOG: Input length: %d\n", length);
-  if (!ok) return kErrorReading;
-  ScopedPointer<uint8_t> buffer(new uint8_t[length]);
-
+int main(int argc, char* argv[]) {
+  // Check for filename argument.
+  if (argc < 2) {
+    fprintf(stderr, "ERROR: No filename on command line.\n");
+    fflush(stderr);
+    return EXIT_FAILURE;
+  }
+  const char* filename = argv[1];
+
+  // Open JS file.
+  FILE* input = fopen(filename, "rb");
+  if (input == NULL) {
+    perror("ERROR: Error opening file");
+    fflush(stderr);
+    return EXIT_FAILURE;
+  }
+
+  // Find length of JS file.
+  if (fseek(input, 0, SEEK_END) != 0) {
+    perror("ERROR: Error during seek");
+    fflush(stderr);
+    return EXIT_FAILURE;
+  }
+  size_t length = static_cast<size_t>(ftell(input));
+  rewind(input);
+
+  // Read JS file into memory buffer.
+  ScopedPointer<uint8_t> buffer(new uint8_t[length]);
   if (!ReadBuffer(input, *buffer, length)) {
-    return kErrorReading;
-  }
-  UTF8InputStream input_buffer(*buffer, static_cast<size_t>(length));
-
-  v8::PreParserData data =
-      v8::Preparse(&input_buffer, 64 * 1024 * sizeof(void*));  // NOLINT
+    perror("ERROR: Reading file");
+    fflush(stderr);
+    return EXIT_FAILURE;
+  }
+  fclose(input);
+
+  // Preparse input file.
+  AsciiInputStream input_buffer(*buffer, length);
+  size_t kMaxStackSize = 64 * 1024 * sizeof(void*);  // NOLINT
+  v8::PreParserData data = v8::Preparse(&input_buffer, kMaxStackSize);
+
+  // Fail if stack overflow.
   if (data.stack_overflow()) {
-    fprintf(stderr, "LOG: Stack overflow\n");
+    fprintf(stderr, "ERROR: Stack overflow\n");
     fflush(stderr);
-    // Report stack overflow error/no-preparser-data.
-    WriteUInt32(stdout, 0, &ok);
-    if (!ok) return kErrorWriting;
-    return 0;
+    return EXIT_FAILURE;
   }

+  // Print preparser data to stdout.
   uint32_t size = data.size();
   fprintf(stderr, "LOG: Success, data size: %u\n", size);
   fflush(stderr);
-  WriteUInt32(stdout, size, &ok);
-  if (!ok) return kErrorWriting;
   if (!WriteBuffer(stdout, data.data(), size)) {
-    return kErrorWriting;
-  }
-  return 0;
-}
-
-} }  // namespace v8::internal
-
-
-int main(int argc, char* argv[]) {
-  FILE* input = stdin;
-  if (argc > 1) {
-    char* arg = argv[1];
-    input = fopen(arg, "rb");
-    if (input == NULL) return EXIT_FAILURE;
-  }
-  int status = 0;
-  do {
-    status = v8::internal::PreParseIO(input);
-  } while (status == 0);
-  fprintf(stderr, "EXIT: Failure %d\n", status);
-  fflush(stderr);
-  return EXIT_FAILURE;
-}
+    perror("ERROR: Writing data");
+    return EXIT_FAILURE;
+  }
+
+  return EXIT_SUCCESS;
+}
=======================================
--- /branches/bleeding_edge/tools/test.py       Wed Mar 30 07:42:47 2011
+++ /branches/bleeding_edge/tools/test.py       Thu Mar 31 01:12:17 2011
@@ -379,6 +379,7 @@

   def Run(self):
     self.BeforeRun()
+    result = "exception"
     try:
       result = self.RunCommand(self.GetCommand())
     finally:
@@ -1316,7 +1317,7 @@
     return ExpandCommand


-BUILT_IN_TESTS = ['mjsunit', 'cctest', 'message']
+BUILT_IN_TESTS = ['mjsunit', 'cctest', 'message', 'preparser']


 def GetSuites(test_root):
@@ -1409,9 +1410,6 @@
   globally_unused_rules = None
   for path in paths:
     for mode in options.mode:
-      if not exists(context.GetVm(mode)):
-        print "Can't find shell executable: '%s'" % context.GetVm(mode)
-        continue
       env = {
         'mode': mode,
         'system': utils.GuessOS(),

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to