mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 10:33:33 +00:00
Bug 945596 - Define getJitCompilerOption to confirm jit-compiler-options. r=nbp
This commit is contained in:
parent
56335cf6a5
commit
fbf5f9b668
@ -271,7 +271,7 @@ static const struct ParamPair {
|
||||
|
||||
// Keep this in sync with above params.
|
||||
#define GC_PARAMETER_ARGS_LIST "maxBytes, maxMallocBytes, gcBytes, gcNumber, sliceTimeBudget, or markStackLimit"
|
||||
|
||||
|
||||
static bool
|
||||
GCParameter(JSContext *cx, unsigned argc, Value *vp)
|
||||
{
|
||||
@ -1127,6 +1127,30 @@ SetJitCompilerOption(JSContext *cx, unsigned argc, jsval *vp)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
GetJitCompilerOptions(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
RootedObject info(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
|
||||
if (!info)
|
||||
return false;
|
||||
|
||||
RootedValue value(cx);
|
||||
|
||||
#define JIT_COMPILER_MATCH(key, string) \
|
||||
opt = JSJITCOMPILER_ ## key; \
|
||||
value.setInt32(JS_GetGlobalJitCompilerOption(cx, opt)); \
|
||||
if (!JS_SetProperty(cx, info, string, value)) \
|
||||
return false;
|
||||
|
||||
JSJitCompilerOption opt = JSJITCOMPILER_NOT_AN_OPTION;
|
||||
JIT_COMPILER_OPTIONS(JIT_COMPILER_MATCH);
|
||||
#undef JIT_COMPILER_MATCH
|
||||
|
||||
*vp = ObjectValue(*info);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
SetIonCheckGraphCoherency(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
@ -1546,6 +1570,10 @@ static const JSFunctionSpecWithHelp TestingFunctions[] = {
|
||||
" Returns whether asm.js compilation is currently available or whether it is disabled\n"
|
||||
" (e.g., by the debugger)."),
|
||||
|
||||
JS_FN_HELP("getJitCompilerOptions", GetJitCompilerOptions, 0, 0,
|
||||
"getCompilerOptions()",
|
||||
"Return an object describing some of the JIT compiler options.\n"),
|
||||
|
||||
JS_FN_HELP("isAsmJSModule", IsAsmJSModule, 1, 0,
|
||||
"isAsmJSModule(fn)",
|
||||
" Returns whether the given value is a function containing \"use asm\" that has been\n"
|
||||
|
@ -21,6 +21,9 @@ var func = [method_A, method_B, method_C, method_D]
|
||||
for (var n = 0; n < 4; ++n) {
|
||||
setJitCompilerOption("baseline.enable", n & 1);
|
||||
setJitCompilerOption("ion.enable", n & 2 ? 1: 0);
|
||||
var opt = getJitCompilerOptions();
|
||||
assertEq(opt["baseline.enable"], n & 1);
|
||||
assertEq(opt["ion.enable"], n & 2 ? 1 : 0);
|
||||
for (var i = 0; i < 1001; ++i)
|
||||
func[n]();
|
||||
}
|
@ -6040,6 +6040,26 @@ JS_SetGlobalJitCompilerOption(JSContext *cx, JSJitCompilerOption opt, uint32_t v
|
||||
#endif
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(int)
|
||||
JS_GetGlobalJitCompilerOption(JSContext *cx, JSJitCompilerOption opt)
|
||||
{
|
||||
#ifdef JS_ION
|
||||
switch (opt) {
|
||||
case JSJITCOMPILER_BASELINE_USECOUNT_TRIGGER:
|
||||
return jit::js_IonOptions.baselineUsesBeforeCompile;
|
||||
case JSJITCOMPILER_ION_USECOUNT_TRIGGER:
|
||||
return jit::js_IonOptions.usesBeforeCompile;
|
||||
case JSJITCOMPILER_ION_ENABLE:
|
||||
return JS::ContextOptionsRef(cx).ion();
|
||||
case JSJITCOMPILER_BASELINE_ENABLE:
|
||||
return JS::ContextOptionsRef(cx).baseline();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
#if !defined(STATIC_EXPORTABLE_JS_API) && !defined(STATIC_JS_API) && defined(XP_WIN)
|
||||
|
@ -4544,6 +4544,8 @@ typedef enum JSJitCompilerOption {
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_SetGlobalJitCompilerOption(JSContext *cx, JSJitCompilerOption opt, uint32_t value);
|
||||
extern JS_PUBLIC_API(int)
|
||||
JS_GetGlobalJitCompilerOption(JSContext *cx, JSJitCompilerOption opt);
|
||||
|
||||
/*
|
||||
* Convert a uint32_t index into a jsid.
|
||||
|
Loading…
Reference in New Issue
Block a user