Bug 862921 - Generalize AssertSequentialIsOK logic and improve its message. r=nmatsakis
authorFelix S. Klock II <pnkfelix@pnkfx.org>
Wed, 17 Apr 2013 17:53:31 +0200
changeset 140562 8a391f846c42b04996367690a59d54d6eb210c28
parent 140561 13aa5e23f951ec57478751b0cf3649730cd4ea0f
child 140563 9dff432b752103947a83341d2ffaf346927a9e86
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnmatsakis
bugs862921
milestone23.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 862921 - Generalize AssertSequentialIsOK logic and improve its message. r=nmatsakis 1. If one passes a `mode` argument without a property named `mode`, the previous version will fall into the ThrowError branch (because mode.mode => undefined and undefined !== "seq") 2. The old error message used the strings "par" and "seq", which might make the reader think that the assertion is solely about the appropriate value for the `mode` property, which happens to take on the values "par" or "seq" in some cases. But the real condition being signalled here is not about the string values "par" or "seq"; it is instead about the dynamic behavior of the runtime system. This changes the error message to use longer phrases, which should hopefully make the intent clearer. There is a third change I want to make, changing the logic of the conditional guard further, but that change is not as important to me as the two above.
js/src/builtin/ParallelArray.js
--- a/js/src/builtin/ParallelArray.js
+++ b/js/src/builtin/ParallelArray.js
@@ -1242,18 +1242,18 @@ function ParallelArrayToString() {
   return result;
 }
 
 /**
  * Internal debugging tool: checks that the given `mode` permits
  * sequential execution
  */
 function AssertSequentialIsOK(mode) {
-  if (mode && mode.mode !== "seq" && ParallelTestsShouldPass())
-    ThrowError(JSMSG_WRONG_VALUE, "par", "seq");
+  if (mode && mode.mode && mode.mode !== "seq" && ParallelTestsShouldPass())
+    ThrowError(JSMSG_WRONG_VALUE, "parallel execution", "sequential was forced");
 }
 
 /**
  * Internal debugging tool: returns a function to be supplied to
  * ParallelDo() that will check that the parallel results
  * bailout/succeed as expected. Returns null if no mode is supplied
  * or we are building with some strange IF_DEF configuration such that
  * we don't expect parallel execution to work.