Bug 1231338 - SAB gating test cases. r=luke

--HG--
extra : rebase_source : 5948da017a822fff46caa9fd3bb739349a037444
This commit is contained in:
Lars T Hansen 2015-12-15 15:40:59 +01:00
parent 4436f1c1d9
commit 6428bbee66
5 changed files with 35 additions and 2 deletions

View File

@ -2108,6 +2108,18 @@ DumpObject(JSContext* cx, unsigned argc, Value* vp)
}
#endif
static bool
SharedMemoryEnabled(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
#ifdef ENABLE_SHARED_ARRAY_BUFFER
args.rval().setBoolean(true);
#else
args.rval().setBoolean(false);
#endif
return true;
}
#ifdef NIGHTLY_BUILD
static bool
ObjectAddress(JSContext* cx, unsigned argc, Value* vp)
@ -3508,6 +3520,10 @@ gc::ZealModeHelpText),
" Dump an internal representation of an object."),
#endif
JS_FN_HELP("sharedMemoryEnabled", SharedMemoryEnabled, 0, 0,
"sharedMemoryEnabled()",
" Return true if SharedArrayBuffer and Atomics are enabled"),
#ifdef NIGHTLY_BUILD
JS_FN_HELP("objectAddress", ObjectAddress, 1, 0,
"objectAddress(obj)",

View File

@ -1,5 +1,5 @@
// Check gating of shared memory features in asm.js (bug 1171540,
// bug 1231624).
// bug 1231624, bug 1231338).
//
// In asm.js, importing any atomic is a signal that shared memory is
// being used. If an atomic is imported, and if shared memory is
@ -7,7 +7,9 @@
// signaled for the module at the end of the declaration section and
// the module should not be an asm.js module.
if (!this.SharedArrayBuffer || !isAsmJSCompilationAvailable())
// Do not guard on the presence of SharedArrayBuffer, we test that later.
if (!isAsmJSCompilationAvailable())
quit(0);
// This code is not run, we only care whether it compiles as asm.js.

View File

@ -0,0 +1,8 @@
// Check gating of shared memory features in plain js (bug 1231338).
// Need this testing function to continue.
if (!this.sharedMemoryEnabled)
quit(0);
assertEq(sharedMemoryEnabled(), !!this.SharedArrayBuffer);
assertEq(sharedMemoryEnabled(), !!this.Atomics);

View File

@ -613,6 +613,9 @@ if CONFIG['MOZ_ETW']:
if CONFIG['NIGHTLY_BUILD']:
DEFINES['ENABLE_BINARYDATA'] = True
# Also in shell/moz.build
if CONFIG['NIGHTLY_BUILD']:
DEFINES['ENABLE_SHARED_ARRAY_BUFFER'] = True
DEFINES['ENABLE_SIMD'] = True

View File

@ -18,6 +18,10 @@ UNIFIED_SOURCES += [
DEFINES['EXPORT_JS_API'] = True
# Also in ../moz.build
if CONFIG['NIGHTLY_BUILD']:
DEFINES['ENABLE_SHARED_ARRAY_BUFFER'] = True
if CONFIG['_MSC_VER']:
# unnecessary PGO for js shell. But gcc cannot turn off pgo because it is
# necessary to link PGO lib on gcc when a object/static lib are compiled