Merge m-c to inbound.
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 24 Jan 2013 22:47:56 -0500
changeset 119848 0b4168438bd72b05a93438585a397130b6d94a37
parent 119847 418c2f404d746f1298af414b391196fb8e231790 (current diff)
parent 119809 a207f33adc1a12ef7e83183d557a34dcac7a8f01 (diff)
child 119849 3ea6e1d489f3b09840ac906eab55fbeaaa0783a4
push id24231
push userryanvm@gmail.com
push dateSun, 27 Jan 2013 00:13:14 +0000
treeherdermozilla-central@d802d6faa080 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge m-c to inbound.
js/src/vm/RegExpObject.cpp
--- a/build/virtualenv/packages.txt
+++ b/build/virtualenv/packages.txt
@@ -1,15 +1,25 @@
 simplejson.pth:python/simplejson-2.1.1
+manifestdestiny.pth:testing/mozbase/manifestdestiny
+mozcrash.pth:testing/mozbase/mozcrash
+mozdevice.pth:testing/mozbase/mozdevice
+mozfile.pth:testing/mozbase/mozfile
+mozhttpd.pth:testing/mozbase/mozhttpd
+mozinfo.pth:testing/mozbase/mozinfo
+mozinstall.pth:testing/mozbase/mozinstall
+mozlog.pth:testing/mozbase/mozlog
+mozprocess.pth:testing/mozbase/mozprocess
+mozprofile.pth:testing/mozbase/mozprofile
+mozrunner.pth:testing/mozbase/mozrunner
 marionette.pth:testing/marionette/client
 blessings.pth:python/blessings
 mach.pth:python/mach
 mozbuild.pth:python/mozbuild
 pymake.pth:build/pymake
 optional:setup.py:python/psutil:build_ext:--inplace
 optional:psutil.pth:python/psutil
 which.pth:python/which
 mock.pth:python/mock-1.0.0
 mozilla.pth:build
 mozilla.pth:config
 mozilla.pth:xpcom/typelib/xpt/tools
 copy:build/buildconfig.py
-packages.txt:testing/mozbase/packages.txt
--- a/build/virtualenv/populate_virtualenv.py
+++ b/build/virtualenv/populate_virtualenv.py
@@ -17,118 +17,100 @@ import sys
 # Minimum version of Python required to build.
 MINIMUM_PYTHON_MAJOR = 2
 MINIMUM_PYTHON_MINOR = 7
 
 
 class VirtualenvManager(object):
     """Contains logic for managing virtualenvs for building the tree."""
 
-    def __init__(self, topsrcdir, virtualenv_path, log_handle, manifest_path):
+    def __init__(self, topsrcdir, virtualenv_path, log_handle):
         """Create a new manager.
 
         Each manager is associated with a source directory, a path where you
         want the virtualenv to be created, and a handle to write output to.
         """
         self.topsrcdir = topsrcdir
         self.virtualenv_root = virtualenv_path
         self.log_handle = log_handle
-        self.manifest_path = manifest_path
 
     @property
     def virtualenv_script_path(self):
         """Path to virtualenv's own populator script."""
         return os.path.join(self.topsrcdir, 'python', 'virtualenv',
             'virtualenv.py')
 
     @property
+    def manifest_path(self):
+        return os.path.join(self.topsrcdir, 'build', 'virtualenv',
+            'packages.txt')
+
+    @property
     def python_path(self):
         if sys.platform in ('win32', 'cygwin'):
             return os.path.join(self.virtualenv_root, 'Scripts', 'python.exe')
 
         return os.path.join(self.virtualenv_root, 'bin', 'python')
 
     @property
     def activate_path(self):
         if sys.platform in ('win32', 'cygwin'):
             return os.path.join(self.virtualenv_root, 'Scripts',
                 'activate_this.py')
 
         return os.path.join(self.virtualenv_root, 'bin', 'activate_this.py')
 
-    def up_to_date(self):
-        """Returns whether the virtualenv is present and up to date."""
-
-        deps = [self.manifest_path, __file__]
-
-        # check if virtualenv exists
-        if not os.path.exists(self.virtualenv_root) or \
-            not os.path.exists(self.activate_path):
-
-            return False
-
-        # check modification times
-        activate_mtime = os.path.getmtime(self.activate_path)
-        dep_mtime = max(os.path.getmtime(p) for p in deps)
-        if dep_mtime > activate_mtime:
-            return False
-
-        # recursively check sub packages.txt files
-        submanifests = [i for i in self.packages()
-                        if i[0] == 'packages.txt']
-        for submanifest in submanifests:
-            submanager = VirtualenvManager(self.topsrcdir,
-                                           self.virtualenv_root,
-                                           self.log_handle,
-                                           src)
-            if not submanager.up_to_date():
-                return False
-
-        return True
-
     def ensure(self):
         """Ensure the virtualenv is present and up to date.
 
         If the virtualenv is up to date, this does nothing. Otherwise, it
         creates and populates the virtualenv as necessary.
 
         This should be the main API used from this class as it is the
         highest-level.
         """
-        if self.up_to_date():
-            return self.virtualenv_root
-        return self.build()
+        deps = [self.manifest_path, __file__]
+
+        if not os.path.exists(self.virtualenv_root) or \
+            not os.path.exists(self.activate_path):
+
+            return self.build()
+
+        activate_mtime = os.path.getmtime(self.activate_path)
+        dep_mtime = max(os.path.getmtime(p) for p in deps)
+
+        if dep_mtime > activate_mtime:
+            return self.build()
+
+        return self.virtualenv_root
 
     def create(self):
         """Create a new, empty virtualenv.
 
         Receives the path to virtualenv's virtualenv.py script (which will be
         called out to), the path to create the virtualenv in, and a handle to
         write output to.
         """
         env = dict(os.environ)
-        env.pop('PYTHONDONTWRITEBYTECODE', None)
+        try:
+            del env['PYTHONDONTWRITEBYTECODE']
+        except KeyError:
+            pass
 
         args = [sys.executable, self.virtualenv_script_path,
             '--system-site-packages', self.virtualenv_root]
 
         result = subprocess.call(args, stdout=self.log_handle,
             stderr=subprocess.STDOUT, env=env)
 
-        if result:
+        if result != 0:
             raise Exception('Error creating virtualenv.')
 
         return self.virtualenv_root
 
-    def packages(self):
-        with file(self.manifest_path, 'rU') as fh:
-            packages = [line.rstrip().split(':')
-                        for line in fh]
-        return packages
-
     def populate(self):
         """Populate the virtualenv.
 
         The manifest file consists of colon-delimited fields. The first field
         specifies the action. The remaining fields are arguments to that
         action. The following actions are supported:
 
         setup.py -- Invoke setup.py for a package. Expects the arguments:
@@ -149,18 +131,21 @@ class VirtualenvManager(object):
         copy -- Copies the given file in the virtualenv site packages
             directory.
 
         Note that the Python interpreter running this function should be the
         one from the virtualenv. If it is the system Python or if the
         environment is not configured properly, packages could be installed
         into the wrong place. This is how virtualenv's work.
         """
-
-        packages = self.packages()
+        packages = []
+        fh = open(self.manifest_path, 'rU')
+        for line in fh:
+            packages.append(line.rstrip().split(':'))
+        fh.close()
 
         def handle_package(package):
             python_lib = distutils.sysconfig.get_python_lib()
             if package[0] == 'setup.py':
                 assert len(package) >= 2
 
                 self.call_setup(os.path.join(self.topsrcdir, package[1]),
                     package[2:])
@@ -172,29 +157,16 @@ class VirtualenvManager(object):
 
                 src = os.path.join(self.topsrcdir, package[1])
                 dst = os.path.join(python_lib, os.path.basename(package[1]))
 
                 shutil.copy(src, dst)
 
                 return True
 
-            if package[0] == 'packages.txt':
-                assert len(package) == 2
-
-                src = os.path.join(self.topsrcdir, package[1])
-                assert os.path.isfile(src), "'%s' does not exist" % src
-                submanager = VirtualenvManager(self.topsrcdir,
-                                               self.virtualenv_root,
-                                               self.log_handle,
-                                               src)
-                submanager.populate()
-
-                return True
-
             if package[0].endswith('.pth'):
                 assert len(package) == 2
 
                 path = os.path.join(self.topsrcdir, package[1])
 
                 with open(os.path.join(python_lib, package[0]), 'a') as f:
                     f.write("%s\n" % path)
 
@@ -244,22 +216,27 @@ class VirtualenvManager(object):
                     continue
 
                 old_env_variables[k] = os.environ[k]
                 del os.environ[k]
 
             for package in packages:
                 handle_package(package)
         finally:
-            os.environ.pop('MACOSX_DEPLOYMENT_TARGET', None)
+            try:
+                del os.environ['MACOSX_DEPLOYMENT_TARGET']
+            except KeyError:
+                pass
 
             if old_target is not None:
                 os.environ['MACOSX_DEPLOYMENT_TARGET'] = old_target
 
-            os.environ.update(old_env_variables)
+            for k in old_env_variables:
+                os.environ[k] = old_env_variables[k]
+
 
     def call_setup(self, directory, arguments):
         """Calls setup.py in a directory."""
         setup = os.path.join(directory, 'setup.py')
 
         program = [sys.executable, setup]
         program.extend(arguments)
 
@@ -338,18 +315,15 @@ if __name__ == '__main__':
     populate = False
 
     # This should only be called internally.
     if sys.argv[1] == 'populate':
         populate = True
         topsrcdir = sys.argv[2]
         virtualenv_path = sys.argv[3]
 
-    # path to default packages.txt
-    manifest_path = os.path.join(topsrcdir, 'build', 'virtualenv', 'packages.txt')
-
-    manager = VirtualenvManager(topsrcdir, virtualenv_path, sys.stdout, manifest_path)
+    manager = VirtualenvManager(topsrcdir, virtualenv_path, sys.stdout)
 
     if populate:
         manager.populate()
     else:
         manager.ensure()
 
--- a/js/src/assembler/assembler/MacroAssemblerX86_64.h
+++ b/js/src/assembler/assembler/MacroAssemblerX86_64.h
@@ -363,16 +363,22 @@ public:
     }
 
     DataLabel32 storePtrWithAddressOffsetPatch(RegisterID src, Address address)
     {
         m_assembler.movq_rm_disp32(src, address.offset, address.base);
         return DataLabel32(this);
     }
 
+    void move32(RegisterID src, RegisterID dest)
+    {
+        // upper 32bit will be 0
+        m_assembler.movl_rr(src, dest);
+    }
+
     void movePtrToDouble(RegisterID src, FPRegisterID dest)
     {
         m_assembler.movq_rr(src, dest);
     }
 
     void moveDoubleToPtr(FPRegisterID src, RegisterID dest)
     {
         m_assembler.movq_rr(src, dest);
--- a/js/src/vm/RegExpObject.cpp
+++ b/js/src/vm/RegExpObject.cpp
@@ -594,30 +594,28 @@ RegExpShared::executeMatchOnly(JSContext
 
     if (sticky()) {
         displacement = start;
         chars += displacement;
         length -= displacement;
         start = 0;
     }
 
-#ifndef _WIN64 /* Temporary stopgap: see Bug 831884 */
 #if ENABLE_YARR_JIT
     if (!codeBlock.isFallBack()) {
         MatchResult result = codeBlock.execute(chars.get(), start, length);
         if (!result)
             return RegExpRunStatus_Success_NotFound;
 
         match = MatchPair(result.start, result.end);
         match.displace(displacement);
         *lastIndex = match.limit;
         return RegExpRunStatus_Success;
     }
 #endif
-#endif /* _WIN64 */
 
     /*
      * The JIT could not be used, so fall back to the Yarr interpreter.
      * Unfortunately, the interpreter does not have a MatchOnly mode, so a
      * temporary output vector must be provided.
      */
     JS_ASSERT(hasBytecode());
     ScopedMatchPairs matches(&cx->tempLifoAlloc());
--- a/js/src/yarr/MatchResult.h
+++ b/js/src/yarr/MatchResult.h
@@ -26,48 +26,51 @@
 #ifndef MatchResult_h
 #define MatchResult_h
 
 #include "wtfbridge.h"
 
 typedef uint64_t EncodedMatchResult;
 
 struct MatchResult {
-    MatchResult(size_t start, size_t end)
+    MatchResult(int start, int end)
         : start(start)
         , end(end)
     {
     }
 
+#if !WTF_CPU_X86_64 || WTF_PLATFORM_WIN
     explicit MatchResult(EncodedMatchResult encoded)
     {
         union u {
             uint64_t encoded;
             struct s {
-                size_t start;
-                size_t end;
+                int start;
+                int end;
             } split;
         } value;
         value.encoded = encoded;
         start = value.split.start;
         end = value.split.end;
     }
+#endif
 
     static MatchResult failed()
     {
         return MatchResult(WTF::notFound, 0);
     }
 
     operator bool()
     {
-        return start != WTF::notFound;
+        return start != int(WTF::notFound);
     }
 
     bool empty()
     {
         return start == end;
     }
 
-    size_t start;
-    size_t end;
+    // strings are limited to a length of 2^28. So this is safe
+    int start;
+    int end;
 };
 
 #endif
--- a/js/src/yarr/YarrJIT.cpp
+++ b/js/src/yarr/YarrJIT.cpp
@@ -106,17 +106,21 @@ class YarrGenerator : private MacroAssem
     static const RegisterID length = X86Registers::edx;
     static const RegisterID output = X86Registers::ecx;
 # endif
 
     static const RegisterID regT0 = X86Registers::eax;
     static const RegisterID regT1 = X86Registers::ebx;
 
     static const RegisterID returnRegister = X86Registers::eax;
+
+# if !WTF_PLATFORM_WIN
+    // no way to use int128_t as return value on Win64 ABI
     static const RegisterID returnRegister2 = X86Registers::edx;
+# endif
 #endif
 
     void optimizeAlternative(PatternAlternative* alternative)
     {
         if (!alternative->m_terms.size())
             return;
 
         for (unsigned i = 0; i < alternative->m_terms.size() - 1; ++i) {
@@ -1406,17 +1410,24 @@ class YarrGenerator : private MacroAssem
                     if (priorAlternative->m_minimumSize)
                         sub32(Imm32(priorAlternative->m_minimumSize), returnRegister);
                     if (compileMode == IncludeSubpatterns)
                         store32(returnRegister, output);
                 } else
                     getMatchStart(returnRegister);
                 if (compileMode == IncludeSubpatterns)
                     store32(index, Address(output, 4));
+#if WTF_CPU_X86_64
+                // upper 32bit to 0
+                move32(returnRegister, returnRegister);
+                lshiftPtr(Imm32(32), index);
+                orPtr(index, returnRegister);
+#else
                 move(index, returnRegister2);
+#endif
 
                 generateReturn();
 
                 // This is the divide between the tail of the prior alternative, above, and
                 // the head of the subsequent alternative, below.
 
                 if (op.m_op == OpBodyAlternativeNext) {
                     // This is the reentry point for the Next alternative. We expect any code
@@ -1725,18 +1736,22 @@ class YarrGenerator : private MacroAssem
                 m_checked += lastOp.m_checkAdjust;
                 break;
             }
 
             case OpMatchFailed:
 #if !WTF_CPU_SPARC
                 removeCallFrame();
 #endif
+#if WTF_CPU_X86_64
+                move(TrustedImm32(WTF::notFound), returnRegister);
+#else
                 move(TrustedImmPtr((void*)WTF::notFound), returnRegister);
                 move(TrustedImm32(0), returnRegister2);
+#endif
                 generateReturn();
                 break;
             }
 
             ++opIndex;
         } while (opIndex < m_ops.size());
     }
 
@@ -1967,18 +1982,22 @@ class YarrGenerator : private MacroAssem
 
                 // We jump to here if we iterate to the point that there is insufficient input to
                 // run any matches, and need to return a failure state from JIT code.
                 matchFailed.link(this);
 
 #if !WTF_CPU_SPARC
                 removeCallFrame();
 #endif
+#if WTF_CPU_X86_64
+                move(TrustedImm32(WTF::notFound), returnRegister);
+#else
                 move(TrustedImmPtr((void*)WTF::notFound), returnRegister);
                 move(TrustedImm32(0), returnRegister2);
+#endif
                 generateReturn();
                 break;
             }
             case OpBodyAlternativeEnd: {
                 // We should never backtrack back into a body disjunction.
                 ASSERT(m_backtrackingState.isEmpty());
 
                 PatternAlternative* priorAlternative = m_ops[op.m_previousOp].m_alternative;
@@ -2615,18 +2634,22 @@ public:
     {
     }
 
     void compile(JSGlobalData* globalData, YarrCodeBlock& jitObject)
     {
         generateEnter();
 
         Jump hasInput = checkInput();
+#if WTF_CPU_X86_64
+        move(TrustedImm32(WTF::notFound), returnRegister);
+#else
         move(TrustedImmPtr((void*)WTF::notFound), returnRegister);
         move(TrustedImm32(0), returnRegister2);
+#endif
         generateReturn();
         hasInput.link(this);
 
         if (compileMode == IncludeSubpatterns) {
             for (unsigned i = 0; i < m_pattern.m_numSubpatterns + 1; ++i)
                 store32(TrustedImm32(-1), Address(output, (i << 1) * sizeof(int)));
         }