From c99172b952666b9ed0344e48486fbd9086afba9e Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Mon, 28 Nov 2011 14:57:31 -0800 Subject: [PATCH] Bug 705356 - Remove JSOPTION_JIT and JSOPTION_PROFILING. r=dvander --- .../base/src/nsInProcessTabChildGlobal.cpp | 2 +- dom/base/nsJSEnvironment.cpp | 11 ---- dom/ipc/TabChild.cpp | 2 +- dom/workers/RuntimeService.cpp | 5 -- js/jetpack/JetpackChild.cpp | 3 +- js/src/jsapi-tests/testDebugger.cpp | 1 - js/src/jsapi-tests/testFuncCallback.cpp | 11 ++-- js/src/jsapi-tests/testGCOutOfMemory.cpp | 7 --- js/src/jsapi-tests/testTrap.cpp | 3 - js/src/jsapi-tests/tests.h | 2 +- js/src/jsapi.h | 6 +- js/src/shell/js.cpp | 14 +---- js/src/tests/browser.js | 1 - js/src/tests/shell.js | 1 - js/src/tests/user.js | 2 - js/xpconnect/idl/xpccomponents.idl | 3 +- js/xpconnect/shell/xpcshell.cpp | 7 --- js/xpconnect/src/XPCComponents.cpp | 57 +++++++++---------- modules/libpref/src/init/all.js | 2 - 19 files changed, 42 insertions(+), 98 deletions(-) diff --git a/content/base/src/nsInProcessTabChildGlobal.cpp b/content/base/src/nsInProcessTabChildGlobal.cpp index 354e3409aac..ec113ada7aa 100644 --- a/content/base/src/nsInProcessTabChildGlobal.cpp +++ b/content/base/src/nsInProcessTabChildGlobal.cpp @@ -311,7 +311,7 @@ nsInProcessTabChildGlobal::InitTabChildGlobal() JS_SetNativeStackQuota(cx, 128 * sizeof(size_t) * 1024); - JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_JIT | JSOPTION_PRIVATE_IS_NSISUPPORTS); + JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_PRIVATE_IS_NSISUPPORTS); JS_SetVersion(cx, JSVERSION_LATEST); JS_SetErrorReporter(cx, ContentScriptErrorReporter); diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 6709371e5fb..f1ec5e39312 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -929,8 +929,6 @@ static const char js_zeal_compartment_str[] = JS_OPTIONS_DOT_STR "gczeal.compa #endif static const char js_methodjit_content_str[] = JS_OPTIONS_DOT_STR "methodjit.content"; static const char js_methodjit_chrome_str[] = JS_OPTIONS_DOT_STR "methodjit.chrome"; -static const char js_profiling_content_str[] = JS_OPTIONS_DOT_STR "jitprofiling.content"; -static const char js_profiling_chrome_str[] = JS_OPTIONS_DOT_STR "jitprofiling.chrome"; static const char js_methodjit_always_str[] = JS_OPTIONS_DOT_STR "methodjit_always"; static const char js_typeinfer_str[] = JS_OPTIONS_DOT_STR "typeinference"; static const char js_pccounts_content_str[] = JS_OPTIONS_DOT_STR "pccounts.content"; @@ -961,9 +959,6 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data) bool useMethodJIT = Preferences::GetBool(chromeWindow ? js_methodjit_chrome_str : js_methodjit_content_str); - bool useProfiling = Preferences::GetBool(chromeWindow ? - js_profiling_chrome_str : - js_profiling_content_str); bool usePCCounts = Preferences::GetBool(chromeWindow ? js_pccounts_chrome_str : js_pccounts_content_str); @@ -976,7 +971,6 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data) xr->GetInSafeMode(&safeMode); if (safeMode) { useMethodJIT = false; - useProfiling = false; usePCCounts = false; useTypeInference = false; useMethodJITAlways = true; @@ -989,11 +983,6 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data) else newDefaultJSOptions &= ~JSOPTION_METHODJIT; - if (useProfiling) - newDefaultJSOptions |= JSOPTION_PROFILING; - else - newDefaultJSOptions &= ~JSOPTION_PROFILING; - if (usePCCounts) newDefaultJSOptions |= JSOPTION_PCCOUNT; else diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 398e0d5ed16..bfa483aa805 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -915,7 +915,7 @@ TabChild::InitTabChildGlobal() JS_SetNativeStackQuota(cx, 128 * sizeof(size_t) * 1024); - JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_JIT | JSOPTION_PRIVATE_IS_NSISUPPORTS); + JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_PRIVATE_IS_NSISUPPORTS); JS_SetVersion(cx, JSVERSION_LATEST); JS_SetErrorReporter(cx, ContentScriptErrorReporter); diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index 05c76b2a56b..cf7f8db3583 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -151,7 +151,6 @@ enum { PREF_werror, PREF_relimit, PREF_methodjit, - PREF_jitprofiling, PREF_methodjit_always, #ifdef JS_GC_ZEAL @@ -168,7 +167,6 @@ const char* gPrefsToWatch[] = { JS_OPTIONS_DOT_STR "werror", JS_OPTIONS_DOT_STR "relimit", JS_OPTIONS_DOT_STR "methodjit.content", - JS_OPTIONS_DOT_STR "jitprofiling.content", JS_OPTIONS_DOT_STR "methodjit_always" #ifdef JS_GC_ZEAL @@ -202,9 +200,6 @@ PrefCallback(const char* aPrefName, void* aClosure) if (Preferences::GetBool(gPrefsToWatch[PREF_methodjit])) { newOptions |= JSOPTION_METHODJIT; } - if (Preferences::GetBool(gPrefsToWatch[PREF_jitprofiling])) { - newOptions |= JSOPTION_PROFILING; - } if (Preferences::GetBool(gPrefsToWatch[PREF_methodjit_always])) { newOptions |= JSOPTION_METHODJIT_ALWAYS; } diff --git a/js/jetpack/JetpackChild.cpp b/js/jetpack/JetpackChild.cpp index 5771973c2ce..039584e7bb3 100644 --- a/js/jetpack/JetpackChild.cpp +++ b/js/jetpack/JetpackChild.cpp @@ -130,8 +130,7 @@ JetpackChild::Init(base::ProcessHandle aParentProcessHandle, JS_SetVersion(mCx, JSVERSION_LATEST); JS_SetOptions(mCx, JS_GetOptions(mCx) | JSOPTION_DONT_REPORT_UNCAUGHT | - JSOPTION_ATLINE | - JSOPTION_JIT); + JSOPTION_ATLINE); JS_SetErrorReporter(mCx, ReportError); { diff --git a/js/src/jsapi-tests/testDebugger.cpp b/js/src/jsapi-tests/testDebugger.cpp index 8328cecf004..4feca74ab3f 100644 --- a/js/src/jsapi-tests/testDebugger.cpp +++ b/js/src/jsapi-tests/testDebugger.cpp @@ -261,7 +261,6 @@ BEGIN_TEST(testDebugger_singleStepThrow) uint32 opts = JS_GetOptions(cx); opts |= JSOPTION_METHODJIT | JSOPTION_METHODJIT_ALWAYS; - opts &= ~JSOPTION_JIT; JS_SetOptions(cx, opts); CHECK(JS_DefineFunction(cx, global, "setStepMode", setStepMode, 0, 0)); diff --git a/js/src/jsapi-tests/testFuncCallback.cpp b/js/src/jsapi-tests/testFuncCallback.cpp index 435c840006e..1f7d885006c 100644 --- a/js/src/jsapi-tests/testFuncCallback.cpp +++ b/js/src/jsapi-tests/testFuncCallback.cpp @@ -118,24 +118,21 @@ BEGIN_TEST(testFuncCallback_bug507012) #endif // Uncomment this to validate whether you're hitting all runmodes (interp, - // tjit, mjit, ...?) Unfortunately, that still doesn't cover all + // mjit, ...?) Unfortunately, that still doesn't cover all // transitions between the various runmodes, but it's a start. //JS_DumpAllProfiles(cx); return true; } -// Not strictly necessary, but part of the test attempts to check -// whether these callbacks still trigger when traced, so force -// JSOPTION_JIT just to be sure. Once the method jit and tracing jit -// are integrated, this'll probably have to change (and we'll probably -// want to test in all modes.) +// Make sure that the method jit is enabled. +// We'll probably want to test in all modes. virtual JSContext *createContext() { JSContext *cx = JSAPITest::createContext(); if (cx) - JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_JIT | JSOPTION_METHODJIT | JSOPTION_PCCOUNT); + JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_METHODJIT | JSOPTION_PCCOUNT); return cx; } diff --git a/js/src/jsapi-tests/testGCOutOfMemory.cpp b/js/src/jsapi-tests/testGCOutOfMemory.cpp index 02708aade82..13a3c8a8eae 100644 --- a/js/src/jsapi-tests/testGCOutOfMemory.cpp +++ b/js/src/jsapi-tests/testGCOutOfMemory.cpp @@ -24,12 +24,6 @@ BEGIN_TEST(testGCOutOfMemory) jsvalRoot root(cx); - /* - * We loop until we get out-of-memory. We have to disable the jit since it - * ignores the runtime allocation limits during execution. - */ - JS_ToggleOptions(cx, JSOPTION_JIT); - static const char source[] = "var max = 0; (function() {" " var array = [];" @@ -45,7 +39,6 @@ BEGIN_TEST(testGCOutOfMemory) CHECK(!JS_IsExceptionPending(cx)); CHECK_EQUAL(errorCount, 1); JS_GC(cx); - JS_ToggleOptions(cx, JSOPTION_JIT); EVAL("(function() {" " var array = [];" " for (var i = max >> 2; i != 0;) {" diff --git a/js/src/jsapi-tests/testTrap.cpp b/js/src/jsapi-tests/testTrap.cpp index 065abe447fb..24cd3bda35f 100644 --- a/js/src/jsapi-tests/testTrap.cpp +++ b/js/src/jsapi-tests/testTrap.cpp @@ -39,9 +39,6 @@ BEGIN_TEST(testTrap_gc) CHECK(JSVAL_IS_OBJECT(v2)); CHECK_EQUAL(emptyTrapCallCount, 0); - // Disable JIT for debugging - JS_SetOptions(cx, JS_GetOptions(cx) & ~JSOPTION_JIT); - // Enable debug mode CHECK(JS_SetDebugMode(cx, JS_TRUE)); diff --git a/js/src/jsapi-tests/tests.h b/js/src/jsapi-tests/tests.h index 8dbefbbd1a1..b6ebb6d5a0c 100644 --- a/js/src/jsapi-tests/tests.h +++ b/js/src/jsapi-tests/tests.h @@ -374,7 +374,7 @@ class JSAPITest JS_SetNativeStackQuota(cx, MAX_STACK_SIZE); - JS_SetOptions(cx, JSOPTION_VAROBJFIX | JSOPTION_JIT); + JS_SetOptions(cx, JSOPTION_VAROBJFIX); JS_SetVersion(cx, JSVERSION_LATEST); JS_SetErrorReporter(cx, &reportError); return cx; diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 7694c4a6c78..6e6ce5677ad 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -2157,7 +2157,7 @@ JS_StringToVersion(const char *string); of the input string */ /* JS_BIT(10) is currently unused. */ -#define JSOPTION_JIT JS_BIT(11) /* Deprecated; does nothing */ +/* JS_BIT(11) is currently unused. */ #define JSOPTION_NO_SCRIPT_RVAL JS_BIT(12) /* A promise to the compiler that a null rval out-param @@ -2170,7 +2170,9 @@ JS_StringToVersion(const char *string); embedding. */ #define JSOPTION_METHODJIT JS_BIT(14) /* Whole-method JIT. */ -#define JSOPTION_PROFILING JS_BIT(15) /* Profiler to make tracer/methodjit choices. */ + +/* JS_BIT(15) is currently unused. */ + #define JSOPTION_METHODJIT_ALWAYS \ JS_BIT(16) /* Always whole-method JIT, don't tune at run-time. */ diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index bf92b18080d..8178bc4a80f 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -156,7 +156,6 @@ static jsdouble gTimeoutInterval = -1.0; static volatile bool gCanceled = false; static bool enableMethodJit = false; -static bool enableProfiling = false; static bool enableTypeInference = false; static bool enableDisassemblyDumps = false; @@ -613,8 +612,6 @@ static const struct JSOption { uint32 flag; } js_options[] = { {"atline", JSOPTION_ATLINE}, - {"jitprofiling", JSOPTION_PROFILING}, - {"tracejit", JSOPTION_JIT}, {"methodjit", JSOPTION_METHODJIT}, {"methodjit_always",JSOPTION_METHODJIT_ALWAYS}, {"relimit", JSOPTION_RELIMIT}, @@ -5062,11 +5059,6 @@ ProcessArgs(JSContext *cx, JSObject *obj, OptionParser *op) ParseZealArg(cx, zeal); #endif - if (op->getBoolOption('p')) { - enableProfiling = true; - JS_ToggleOptions(cx, JSOPTION_PROFILING); - } - if (op->getBoolOption('d')) { JS_SetRuntimeDebugMode(JS_GetRuntime(cx), true); JS_SetDebugMode(cx, true); @@ -5322,14 +5314,10 @@ main(int argc, char **argv, char **envp) || !op.addMultiStringOption('e', "execute", "CODE", "Inline code to run") || !op.addBoolOption('i', "shell", "Enter prompt after running code") || !op.addBoolOption('m', "methodjit", "Enable the JaegerMonkey method JIT") - || !op.addBoolOption('j', "tracejit", "Deprecated; does nothing") - || !op.addBoolOption('p', "profiling", "Enable runtime profiling select JIT mode") || !op.addBoolOption('n', "typeinfer", "Enable type inference") || !op.addBoolOption('d', "debugjit", "Enable runtime debug mode for method JIT code") || !op.addBoolOption('a', "always-mjit", - "Do not try to run in the interpreter before " - "method jitting. Note that this has no particular effect on the " - "tracer; it still kicks in if enabled.") + "Do not try to run in the interpreter before method jitting.") || !op.addBoolOption('D', "dump-bytecode", "Dump bytecode with exec count for all scripts") || !op.addBoolOption('b', "print-timing", "Print sub-ms runtime for each file that's run") #ifdef DEBUG diff --git a/js/src/tests/browser.js b/js/src/tests/browser.js index 66af768c94d..bbd312ba99d 100644 --- a/js/src/tests/browser.js +++ b/js/src/tests/browser.js @@ -224,7 +224,6 @@ function optionsInit() { xml: true, relimit: true, methodjit: true, - jitprofiling: true, methodjit_always: true }; diff --git a/js/src/tests/shell.js b/js/src/tests/shell.js index 2c68d1eb374..13018bee411 100644 --- a/js/src/tests/shell.js +++ b/js/src/tests/shell.js @@ -649,7 +649,6 @@ function optionsClear() { var optionName = optionNames[i]; if (optionName && optionName != "methodjit" && - optionName != "jitprofiling" && optionName != "methodjit_always") { options(optionName); diff --git a/js/src/tests/user.js b/js/src/tests/user.js index 0fb860ccc4d..6bcaebcebb7 100755 --- a/js/src/tests/user.js +++ b/js/src/tests/user.js @@ -30,8 +30,6 @@ user_pref("extensions.checkUpdateSecurity", false); user_pref("browser.EULA.override", true); user_pref("javascript.options.methodjit.chrome", true); user_pref("javascript.options.methodjit.content", true); -user_pref("javascript.options.jitprofiling.chrome", true); -user_pref("javascript.options.jitprofiling.content", true); user_pref("javascript.options.methodjit_always", false); user_pref("javascript.options.strict", false); user_pref("javascript.options.werror", false); diff --git a/js/xpconnect/idl/xpccomponents.idl b/js/xpconnect/idl/xpccomponents.idl index 5fb45695cd7..9ee3b58e626 100644 --- a/js/xpconnect/idl/xpccomponents.idl +++ b/js/xpconnect/idl/xpccomponents.idl @@ -153,7 +153,7 @@ interface ScheduledGCCallback : nsISupports /** * interface of Components.utils */ -[scriptable, uuid(11785c1f-346f-475c-950e-fe1bacce70f1)] +[scriptable, uuid(d6916b9e-0947-400f-8552-81fd96312c9d)] interface nsIXPCComponents_Utils : nsISupports { @@ -324,7 +324,6 @@ interface nsIXPCComponents_Utils : nsISupports attribute boolean xml; attribute boolean relimit; attribute boolean methodjit; - attribute boolean jitprofiling; attribute boolean methodjit_always; [implicit_jscontext] void setGCZeal(in long zeal); diff --git a/js/xpconnect/shell/xpcshell.cpp b/js/xpconnect/shell/xpcshell.cpp index 3891229bde9..7c8e65b513f 100644 --- a/js/xpconnect/shell/xpcshell.cpp +++ b/js/xpconnect/shell/xpcshell.cpp @@ -726,7 +726,6 @@ static const struct JSOption { uint32 flag; } js_options[] = { {"atline", JSOPTION_ATLINE}, - {"jit", JSOPTION_JIT}, {"relimit", JSOPTION_RELIMIT}, {"strict", JSOPTION_STRICT}, {"werror", JSOPTION_WERROR}, @@ -1283,15 +1282,9 @@ ProcessArgs(JSContext *cx, JSObject *obj, char **argv, int argc) compileOnly = true; isInteractive = false; break; - case 'j': - JS_ToggleOptions(cx, JSOPTION_JIT); - break; case 'm': JS_ToggleOptions(cx, JSOPTION_METHODJIT); break; - case 'p': - JS_ToggleOptions(cx, JSOPTION_PROFILING); - break; case 'n': JS_ToggleOptions(cx, JSOPTION_TYPE_INFERENCE); break; diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp index f01a5e04637..46d80a4b3b4 100644 --- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -56,8 +56,8 @@ #include "nsJSUtils.h" #include "mozJSComponentLoader.h" #include "nsContentUtils.h" -#include "jsgc.h" - +#include "jsgc.h" + using namespace js; /***************************************************************************/ // stuff used by all @@ -3102,13 +3102,13 @@ xpc_CreateSandboxObject(JSContext * cx, jsval * vp, nsISupports *prinOrSop, JSOb JSCompartment *compartment; JSObject *sandbox; - nsRefPtr identity; - if (!identityPtr) { - identity = new Identity(); - identityPtr = identity; - } - - rv = xpc_CreateGlobalObject(cx, &SandboxClass, principal, identityPtr, + nsRefPtr identity; + if (!identityPtr) { + identity = new Identity(); + identityPtr = identity; + } + + rv = xpc_CreateGlobalObject(cx, &SandboxClass, principal, identityPtr, wantXrays, &sandbox, &compartment); NS_ENSURE_SUCCESS(rv, rv); @@ -3324,25 +3324,25 @@ nsXPCComponents_utils_Sandbox::CallOrConstruct(nsIXPConnectWrappedNative *wrappe sandboxName.Adopt(tmp, strlen(tmp)); } - // see Bug 677294: - if (!JS_HasProperty(cx, optionsObject, "sameGroupAs", &found)) - return NS_ERROR_INVALID_ARG; - - if (found) { - if (!JS_GetProperty(cx, optionsObject, "sameGroupAs", &option) || - JSVAL_IS_PRIMITIVE(option)) { - return ThrowAndFail(NS_ERROR_INVALID_ARG, cx, _retval); - } - - void* privateValue = - JS_GetCompartmentPrivate(cx,GetObjectCompartment(JSVAL_TO_OBJECT(option))); - xpc::CompartmentPrivate *compartmentPrivate = - static_cast(privateValue); - - if (!compartmentPrivate || !compartmentPrivate->key) - return ThrowAndFail(NS_ERROR_INVALID_ARG, cx, _retval); - - identity = compartmentPrivate->key->GetPtr(); + // see Bug 677294: + if (!JS_HasProperty(cx, optionsObject, "sameGroupAs", &found)) + return NS_ERROR_INVALID_ARG; + + if (found) { + if (!JS_GetProperty(cx, optionsObject, "sameGroupAs", &option) || + JSVAL_IS_PRIMITIVE(option)) { + return ThrowAndFail(NS_ERROR_INVALID_ARG, cx, _retval); + } + + void* privateValue = + JS_GetCompartmentPrivate(cx,GetObjectCompartment(JSVAL_TO_OBJECT(option))); + xpc::CompartmentPrivate *compartmentPrivate = + static_cast(privateValue); + + if (!compartmentPrivate || !compartmentPrivate->key) + return ThrowAndFail(NS_ERROR_INVALID_ARG, cx, _retval); + + identity = compartmentPrivate->key->GetPtr(); } } @@ -4070,7 +4070,6 @@ GENERATE_JSOPTION_GETTER_SETTER(Atline, JSOPTION_ATLINE) GENERATE_JSOPTION_GETTER_SETTER(Xml, JSOPTION_XML) GENERATE_JSOPTION_GETTER_SETTER(Relimit, JSOPTION_RELIMIT) GENERATE_JSOPTION_GETTER_SETTER(Methodjit, JSOPTION_METHODJIT) -GENERATE_JSOPTION_GETTER_SETTER(Jitprofiling, JSOPTION_PROFILING) GENERATE_JSOPTION_GETTER_SETTER(Methodjit_always, JSOPTION_METHODJIT_ALWAYS) #undef GENERATE_JSOPTION_GETTER_SETTER diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index 68b9654e27c..dc5e4570796 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -628,8 +628,6 @@ pref("javascript.options.strict.debug", true); pref("javascript.options.relimit", true); pref("javascript.options.methodjit.content", true); pref("javascript.options.methodjit.chrome", true); -pref("javascript.options.jitprofiling.content", true); -pref("javascript.options.jitprofiling.chrome", true); pref("javascript.options.pccounts.content", false); pref("javascript.options.pccounts.chrome", false); pref("javascript.options.methodjit_always", false);