Fix the Windows non-threadsafe build by exposing/using a thread-aware symbol only in threadsafe builds. No bug, r=terrence
authorJeff Walden <jwalden@mit.edu>
Thu, 23 Jan 2014 16:09:07 -0800
changeset 181006 609fa13b17d06493ead2a86acf08450ab99bfcfa
parent 181005 70a04464772f2ec40d4b17b72f4409dbe5aaf64c
child 181007 23061213bdd13cc89fd115d172c5340291617110
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
milestone29.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
Fix the Windows non-threadsafe build by exposing/using a thread-aware symbol only in threadsafe builds. No bug, r=terrence
js/src/jsapi.cpp
js/src/jsworkers.h
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -4477,32 +4477,34 @@ JS::Compile(JSContext *cx, HandleObject 
     options.setFileAndLine(filename, 1);
     JSScript *script = Compile(cx, obj, options, file.fp());
     return script;
 }
 
 JS_PUBLIC_API(bool)
 JS::CanCompileOffThread(JSContext *cx, const ReadOnlyCompileOptions &options, size_t length)
 {
-    static const unsigned TINY_LENGTH = 1000;
-    static const unsigned HUGE_LENGTH = 100*1000;
+    static const size_t TINY_LENGTH = 1000;
+    static const size_t HUGE_LENGTH = 100 * 1000;
 
     // These are heuristics which the caller may choose to ignore (e.g., for
     // testing purposes).
     if (!options.forceAsync) {
         // Compiling off the main thread inolves creating a new Zone and other
         // significant overheads.  Don't bother if the script is tiny.
         if (length < TINY_LENGTH)
             return false;
 
+#ifdef JS_THREADSAFE
         // If the parsing task would have to wait for GC to complete, it'll probably
         // be faster to just start it synchronously on the main thread unless the
         // script is huge.
         if (OffThreadParsingMustWaitForGC(cx->runtime()) && length < HUGE_LENGTH)
             return false;
+#endif // JS_THREADSAFE
     }
 
     return cx->runtime()->canUseParallelParsing();
 }
 
 JS_PUBLIC_API(bool)
 JS::CompileOffThread(JSContext *cx, Handle<JSObject*> obj, const ReadOnlyCompileOptions &options,
                      const jschar *chars, size_t length,
--- a/js/src/jsworkers.h
+++ b/js/src/jsworkers.h
@@ -374,20 +374,22 @@ struct ParseTask
     bool init(JSContext *cx, const ReadOnlyCompileOptions &options);
 
     void activate(JSRuntime *rt);
     void finish();
 
     ~ParseTask();
 };
 
+#ifdef JS_THREADSAFE
 // Return whether, if a new parse task was started, it would need to wait for
 // an in-progress GC to complete before starting.
 extern bool
 OffThreadParsingMustWaitForGC(JSRuntime *rt);
+#endif
 
 // Compression tasks are allocated on the stack by their triggering thread,
 // which will block on the compression completing as the task goes out of scope
 // to ensure it completes at the required time.
 struct SourceCompressionTask
 {
     friend class ScriptSource;