Bug 1411302 - Don't try and OOM test worker threads r=jandem

This commit is contained in:
Jon Coppeard 2017-10-27 15:52:43 +01:00
Родитель 269479133e
Коммит 0f32c9b07b
3 изменённых файлов: 39 добавлений и 9 удалений

Просмотреть файл

@ -54,6 +54,9 @@ namespace js {
* Thread types are used to tag threads for certain kinds of testing (see
* below), and also used to characterize threads in the thread scheduler (see
* js/src/vm/HelperThreads.cpp).
*
* Please update oom::FirstThreadTypeToTest and oom::LastThreadTypeToTest when
* adding new thread types.
*/
enum ThreadType {
THREAD_TYPE_NONE = 0, // 0
@ -83,13 +86,22 @@ namespace oom {
* is in jsutil.cpp.
*/
# if defined(DEBUG) || defined(JS_OOM_BREAKPOINT)
// Define the range of threads tested by simulated OOM testing and the
// like. Testing worker threads is not supported.
const ThreadType FirstThreadTypeToTest = THREAD_TYPE_COOPERATING;
const ThreadType LastThreadTypeToTest = THREAD_TYPE_WASM_TIER2;
extern bool InitThreadType(void);
extern void SetThreadType(ThreadType);
extern JS_FRIEND_API(uint32_t) GetThreadType(void);
# else
inline bool InitThreadType(void) { return true; }
inline void SetThreadType(ThreadType t) {};
inline uint32_t GetThreadType(void) { return 0; }
# endif
} /* namespace oom */

Просмотреть файл

@ -1600,13 +1600,13 @@ OOMTest(JSContext* cx, unsigned argc, Value* vp)
bool verbose = EnvVarIsDefined("OOM_VERBOSE");
unsigned threadStart = THREAD_TYPE_COOPERATING;
unsigned threadEnd = THREAD_TYPE_MAX;
unsigned threadStart = oom::FirstThreadTypeToTest;
unsigned threadEnd = oom::LastThreadTypeToTest;
// Test a single thread type if specified by the OOM_THREAD environment variable.
int threadOption = 0;
if (EnvVarAsInt("OOM_THREAD", &threadOption)) {
if (threadOption < THREAD_TYPE_COOPERATING || threadOption > THREAD_TYPE_MAX) {
if (threadOption < oom::FirstThreadTypeToTest || threadOption > oom::LastThreadTypeToTest) {
JS_ReportErrorASCII(cx, "OOM_THREAD value out of range.");
return false;
}
@ -1743,13 +1743,13 @@ StackTest(JSContext* cx, unsigned argc, Value* vp)
bool verbose = EnvVarIsDefined("OOM_VERBOSE");
unsigned threadStart = THREAD_TYPE_COOPERATING;
unsigned threadEnd = THREAD_TYPE_MAX;
unsigned threadStart = oom::FirstThreadTypeToTest;
unsigned threadEnd = oom::LastThreadTypeToTest;
// Test a single thread type if specified by the OOM_THREAD environment variable.
int threadOption = 0;
if (EnvVarAsInt("OOM_THREAD", &threadOption)) {
if (threadOption < THREAD_TYPE_COOPERATING || threadOption > THREAD_TYPE_MAX) {
if (threadOption < oom::FirstThreadTypeToTest || threadOption > oom::LastThreadTypeToTest) {
JS_ReportErrorASCII(cx, "OOM_THREAD value out of range.");
return false;
}
@ -1875,13 +1875,13 @@ InterruptTest(JSContext* cx, unsigned argc, Value* vp)
bool verbose = EnvVarIsDefined("OOM_VERBOSE");
unsigned threadStart = THREAD_TYPE_COOPERATING;
unsigned threadEnd = THREAD_TYPE_MAX;
unsigned threadStart = oom::FirstThreadTypeToTest;
unsigned threadEnd = oom::LastThreadTypeToTest;
// Test a single thread type if specified by the OOM_THREAD environment variable.
int threadOption = 0;
if (EnvVarAsInt("OOM_THREAD", &threadOption)) {
if (threadOption < THREAD_TYPE_COOPERATING || threadOption > THREAD_TYPE_MAX) {
if (threadOption < oom::FirstThreadTypeToTest || threadOption > oom::LastThreadTypeToTest) {
JS_ReportErrorASCII(cx, "OOM_THREAD value out of range.");
return false;
}

Просмотреть файл

@ -0,0 +1,18 @@
if (!('oomTest' in this))
quit();
let lfPreamble = `
value:{
`;
try {
evaluate("");
evalInWorker("");
} catch (exc) {}
try {
evalInWorker("");
} catch (exc) {}
try {
oomTest(function() {
eval("function testDeepBail1() {");
});
} catch (exc) {}