Bug 977287, part 2 - Stylistic changes. r=luke.
authorJason Orendorff <jorendorff@mozilla.com>
Mon, 10 Mar 2014 16:28:43 -0500
changeset 190045 02400c717fa61b09b91b5f08326d50404eaad3b8
parent 190044 53139214dcf3fc3b886bb913a2b4b301e5e70bf4
child 190046 236e257bf505324d68fe3552677c981672001848
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs977287
milestone30.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
Bug 977287, part 2 - Stylistic changes. r=luke.
js/src/jit/VMFunctions.cpp
js/src/shell/js.cpp
js/src/vm/ForkJoin.cpp
js/src/vm/Interpreter.cpp
--- a/js/src/jit/VMFunctions.cpp
+++ b/js/src/jit/VMFunctions.cpp
@@ -501,17 +501,17 @@ InterruptCheck(JSContext *cx)
     // and end up with a state where some fraction of the backedges point to
     // the interrupt handler and some don't. This is ok since the interrupt
     // is definitely about to be handled; if there are still backedges
     // afterwards which point to the interrupt handler, the next time they are
     // taken the backedges will just be reset again.
     cx->runtime()->jitRuntime()->patchIonBackedges(cx->runtime(),
                                                    JitRuntime::BackedgeLoopHeader);
 
-    return !!HandleExecutionInterrupt(cx);
+    return CheckForInterrupt(cx);
 }
 
 HeapSlot *
 NewSlots(JSRuntime *rt, unsigned nslots)
 {
     JS_STATIC_ASSERT(sizeof(Value) == sizeof(HeapSlot));
 
     Value *slots = reinterpret_cast<Value *>(rt->malloc_(nslots * sizeof(Value)));
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -323,26 +323,20 @@ JSStringToUTF8(JSContext *cx, JSString *
 {
     JSLinearString *linear = str->ensureLinear(cx);
     if (!linear)
         return nullptr;
 
     return TwoByteCharsToNewUTF8CharsZ(cx, linear->range()).c_str();
 }
 
-/*
- * State to store as JSContext private.
- *
- * We declare such timestamp as volatile as they are updated in the interrupt
- * callback without taking any locks. Any possible race can only lead to more
- * frequent callback calls. This is safe as the callback does everything based
- * on timing.
- */
+/* State to store as JSContext private. */
 struct JSShellContextData {
-    volatile int64_t startTime;
+    /* Creation timestamp, used by the elapsed() shell builtin. */
+    int64_t startTime;
 };
 
 static JSShellContextData *
 NewContextData()
 {
     /* Prevent creation of new contexts after we have been canceled. */
     if (gTimedOut)
         return nullptr;
--- a/js/src/vm/ForkJoin.cpp
+++ b/js/src/vm/ForkJoin.cpp
@@ -1141,17 +1141,17 @@ ForkJoinOperation::warmupExecution(bool 
             *status = ExecutionWarmup;
             return RedLight;
         }
 
         // If we finished all slices in warmup, be sure check the
         // interrupt flag. This is because we won't be running more JS
         // code, and thus no more automatic checking of the interrupt
         // flag.
-        if (!HandleExecutionInterrupt(cx_)) {
+        if (!CheckForInterrupt(cx_)) {
             *status = ExecutionFatal;
             return RedLight;
         }
 
         return GreenLight;
     }
 
     Spew(SpewOps, "Executing warmup.");
--- a/js/src/vm/Interpreter.cpp
+++ b/js/src/vm/Interpreter.cpp
@@ -1412,17 +1412,17 @@ Interpret(JSContext *cx, RunState &state
 #define END_CASE(OP)              ADVANCE_AND_DISPATCH(OP##_LENGTH);
 
     /*
      * Prepare to call a user-supplied branch handler, and abort the script
      * if it returns false.
      */
 #define CHECK_BRANCH()                                                        \
     JS_BEGIN_MACRO                                                            \
-        if (cx->runtime()->interrupt && !HandleExecutionInterrupt(cx))        \
+        if (!CheckForInterrupt(cx))                                           \
             goto error;                                                       \
     JS_END_MACRO
 
     /*
      * This is a simple wrapper around ADVANCE_AND_DISPATCH which also does
      * a CHECK_BRANCH() if n is not positive, which possibly indicates that it
      * is the backedge of a loop.
      */
@@ -3715,21 +3715,18 @@ js::SetCallOperation(JSContext *cx)
 bool
 js::GetAndClearException(JSContext *cx, MutableHandleValue res)
 {
     bool status = cx->getPendingException(res);
     cx->clearPendingException();
     if (!status)
         return false;
 
-    // Check the interrupt flag to allow interrupting deeply nested exception
-    // handling.
-    if (cx->runtime()->interrupt)
-        return HandleExecutionInterrupt(cx);
-    return true;
+    // Allow interrupting deeply nested exception handling.
+    return CheckForInterrupt(cx);
 }
 
 template <bool strict>
 bool
 js::SetProperty(JSContext *cx, HandleObject obj, HandleId id, const Value &value)
 {
     RootedValue v(cx, value);
     return JSObject::setGeneric(cx, obj, obj, id, &v, strict);