Merge V8 at branches/3.2 r8200: Initial merge by Git

Change-Id: I5c434306e98132997e9c5f6024b6ce200b255edf
diff --git a/tools/gyp/v8.gyp b/tools/gyp/v8.gyp
index a11d19a..77a6194 100644
--- a/tools/gyp/v8.gyp
+++ b/tools/gyp/v8.gyp
@@ -230,8 +230,7 @@
             '../../src',
           ],
           'sources': [
-            '<(SHARED_INTERMEDIATE_DIR)/libraries.cc',
-            '<(SHARED_INTERMEDIATE_DIR)/experimental-libraries.cc',
+            '<(SHARED_INTERMEDIATE_DIR)/libraries-empty.cc',
             '<(INTERMEDIATE_DIR)/snapshot.cc',
           ],
           'actions': [
@@ -260,7 +259,6 @@
           ],
           'sources': [
             '<(SHARED_INTERMEDIATE_DIR)/libraries.cc',
-            '<(SHARED_INTERMEDIATE_DIR)/experimental-libraries.cc',
             '../../src/snapshot-empty.cc',
           ],
           'conditions': [
@@ -724,10 +722,6 @@
               '../../src/regexp.js',
               '../../src/macros.py',
             ],
-	    'experimental_library_files': [
-	      '../../src/proxy.js',
-              '../../src/macros.py',
-	    ],
           },
           'actions': [
             {
@@ -738,6 +732,7 @@
               ],
               'outputs': [
                 '<(SHARED_INTERMEDIATE_DIR)/libraries.cc',
+                '<(SHARED_INTERMEDIATE_DIR)/libraries-empty.cc',
               ],
               'action': [
                 'python',
@@ -747,23 +742,6 @@
                 '<@(library_files)'
               ],
             },
-	    {
-              'action_name': 'js2c_experimental',
-              'inputs': [
-                '../../tools/js2c.py',
-                '<@(experimental_library_files)',
-              ],
-              'outputs': [
-                '<(SHARED_INTERMEDIATE_DIR)/experimental-libraries.cc',
-              ],
-              'action': [
-                'python',
-                '../../tools/js2c.py',
-                '<@(_outputs)',
-                'EXPERIMENTAL',
-                '<@(experimental_library_files)'
-              ],
-            },
           ],
         },
         {
diff --git a/tools/js2c.py b/tools/js2c.py
old mode 100644
new mode 100755
index 8211ec5..2da132f
--- a/tools/js2c.py
+++ b/tools/js2c.py
@@ -204,7 +204,7 @@
 
 
 HEADER_TEMPLATE = """\
-// Copyright 2011 Google Inc. All Rights Reserved.
+// Copyright 2008 Google Inc. All Rights Reserved.
 
 // This file was generated from .js source files by SCons.  If you
 // want to make changes to this file you should either change the
@@ -288,6 +288,7 @@
 
   minifier = jsmin.JavaScriptMinifier()
 
+  source_lines_empty = []
   for module in modules:
     filename = str(module)
     debugger = filename.endswith('-debugger.js')
@@ -304,6 +305,7 @@
     else:
       ids.append((id, len(lines)))
     source_lines.append(SOURCE_DECLARATION % { 'id': id, 'data': data })
+    source_lines_empty.append(SOURCE_DECLARATION % { 'id': id, 'data': data })
 
   # Build debugger support functions
   get_index_cases = [ ]
@@ -354,11 +356,25 @@
   })
   output.close()
 
+  if len(target) > 1:
+    output = open(str(target[1]), "w")
+    output.write(HEADER_TEMPLATE % {
+      'builtin_count': len(ids) + len(debugger_ids),
+      'debugger_count': len(debugger_ids),
+      'source_lines': "\n".join(source_lines_empty),
+      'get_index_cases': "".join(get_index_cases),
+      'get_script_source_cases': "".join(get_script_source_cases),
+      'get_script_name_cases': "".join(get_script_name_cases),
+      'type': env['TYPE']
+    })
+    output.close()
+
 def main():
   natives = sys.argv[1]
-  type = sys.argv[2]
-  source_files = sys.argv[3:]
-  JS2C(source_files, [natives], { 'TYPE': type })
+  natives_empty = sys.argv[2]
+  type = sys.argv[3]
+  source_files = sys.argv[4:]
+  JS2C(source_files, [natives, natives_empty], { 'TYPE': type })
 
 if __name__ == "__main__":
   main()
diff --git a/tools/test.py b/tools/test.py
index c1840bb..707e725 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -117,8 +117,6 @@
         start = time.time()
         output = case.Run()
         case.duration = (time.time() - start)
-      except BreakNowException:
-        self.terminate = True
       except IOError, e:
         assert self.terminate
         return
@@ -320,12 +318,6 @@
 # --- F r a m e w o r k ---
 # -------------------------
 
-class BreakNowException(Exception):
-  def __init__(self, value):
-    self.value = value
-  def __str__(self):
-    return repr(self.value)
-
 
 class CommandOutput(object):
 
@@ -387,12 +379,9 @@
 
   def Run(self):
     self.BeforeRun()
-    result = None
+    result = "exception"
     try:
       result = self.RunCommand(self.GetCommand())
-    except:
-      self.terminate = True
-      raise BreakNowException("Used pressed CTRL+C or IO went wrong")
     finally:
       self.AfterRun(result)
     return result
@@ -434,7 +423,7 @@
              self.output.exit_code != -signal.SIGABRT
 
   def HasTimedOut(self):
-    return self.output.timed_out
+    return self.output.timed_out;
 
   def HasFailed(self):
     execution_failed = self.test.DidFail(self.output)
@@ -462,7 +451,7 @@
   prev_error_mode = SEM_INVALID_VALUE
   try:
     import ctypes
-    prev_error_mode = ctypes.windll.kernel32.SetErrorMode(mode)
+    prev_error_mode = ctypes.windll.kernel32.SetErrorMode(mode);
   except ImportError:
     pass
   return prev_error_mode
@@ -470,16 +459,16 @@
 def RunProcess(context, timeout, args, **rest):
   if context.verbose: print "#", " ".join(args)
   popen_args = args
-  prev_error_mode = SEM_INVALID_VALUE
+  prev_error_mode = SEM_INVALID_VALUE;
   if utils.IsWindows():
     popen_args = '"' + subprocess.list2cmdline(args) + '"'
     if context.suppress_dialogs:
       # Try to change the error mode to avoid dialogs on fatal errors. Don't
       # touch any existing error mode flags by merging the existing error mode.
       # See http://blogs.msdn.com/oldnewthing/archive/2004/07/27/198410.aspx.
-      error_mode = SEM_NOGPFAULTERRORBOX
-      prev_error_mode = Win32SetErrorMode(error_mode)
-      Win32SetErrorMode(error_mode | prev_error_mode)
+      error_mode = SEM_NOGPFAULTERRORBOX;
+      prev_error_mode = Win32SetErrorMode(error_mode);
+      Win32SetErrorMode(error_mode | prev_error_mode);
   process = subprocess.Popen(
     shell = utils.IsWindows(),
     args = popen_args,
@@ -527,7 +516,7 @@
       os.unlink(name)
       return
     except OSError, e:
-      retry_count += 1
+      retry_count += 1;
       time.sleep(retry_count * 0.1)
   PrintError("os.unlink() " + str(e))
 
@@ -713,12 +702,7 @@
 
 def RunTestCases(cases_to_run, progress, tasks):
   progress = PROGRESS_INDICATORS[progress](cases_to_run)
-  result = 0
-  try:
-    result = progress.Run(tasks)
-  except Exception, e:
-    print "\n", e
-  return result
+  return progress.Run(tasks)
 
 
 def BuildRequirements(context, requirements, mode, scons_flags):
@@ -1355,11 +1339,11 @@
     print "shard-run not a valid number, should be in [1:shard-count]"
     print "defaulting back to running all tests"
     return tests
-  count = 0
+  count = 0;
   shard = []
   for test in tests:
     if count % options.shard_count == options.shard_run - 1:
-      shard.append(test)
+      shard.append(test);
     count += 1
   return shard