Bug 890636 - Remove JSOPTION_PCCOUNT, r=jandem.

This commit is contained in:
Brian Hackett 2013-07-08 09:17:35 -06:00
parent ea330c7bd6
commit 6a7df7aaf3
12 changed files with 15 additions and 62 deletions

View File

@ -961,8 +961,6 @@ static const char js_zeal_option_str[] = JS_OPTIONS_DOT_STR "gczeal";
static const char js_zeal_frequency_str[] = JS_OPTIONS_DOT_STR "gczeal.frequency";
#endif
static const char js_typeinfer_str[] = JS_OPTIONS_DOT_STR "typeinference";
static const char js_pccounts_content_str[] = JS_OPTIONS_DOT_STR "pccounts.content";
static const char js_pccounts_chrome_str[] = JS_OPTIONS_DOT_STR "pccounts.chrome";
static const char js_jit_hardening_str[] = JS_OPTIONS_DOT_STR "jit_hardening";
static const char js_memlog_option_str[] = JS_OPTIONS_DOT_STR "mem.log";
static const char js_memnotify_option_str[] = JS_OPTIONS_DOT_STR "mem.notify";
@ -1004,9 +1002,6 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
nsCOMPtr<nsIDOMWindow> contentWindow(do_QueryInterface(global));
nsCOMPtr<nsIDOMChromeWindow> chromeWindow(do_QueryInterface(global));
bool usePCCounts = Preferences::GetBool(chromeWindow || !contentWindow ?
js_pccounts_chrome_str :
js_pccounts_content_str);
bool useTypeInference = !chromeWindow && contentWindow && Preferences::GetBool(js_typeinfer_str);
bool useHardening = Preferences::GetBool(js_jit_hardening_str);
bool useBaselineJIT = Preferences::GetBool(chromeWindow || !contentWindow ?
@ -1022,7 +1017,6 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
bool safeMode = false;
xr->GetInSafeMode(&safeMode);
if (safeMode) {
usePCCounts = false;
useTypeInference = false;
useHardening = false;
useBaselineJIT = false;
@ -1033,11 +1027,6 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
}
}
if (usePCCounts)
newDefaultJSOptions |= JSOPTION_PCCOUNT;
else
newDefaultJSOptions &= ~JSOPTION_PCCOUNT;
if (useTypeInference)
newDefaultJSOptions |= JSOPTION_TYPE_INFERENCE;
else

View File

@ -299,9 +299,6 @@ LoadJSContextOptions(const char* aPrefName, void* /* aClosure */)
// Content options.
uint32_t contentOptions = commonOptions;
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("pccounts.content"))) {
contentOptions |= JSOPTION_PCCOUNT;
}
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("baselinejit.content"))) {
contentOptions |= JSOPTION_BASELINE;
}
@ -311,9 +308,6 @@ LoadJSContextOptions(const char* aPrefName, void* /* aClosure */)
// Chrome options.
uint32_t chromeOptions = commonOptions;
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("pccounts.chrome"))) {
chromeOptions |= JSOPTION_PCCOUNT;
}
if (GetWorkerPref<bool>(NS_LITERAL_CSTRING("baselinejit.chrome"))) {
chromeOptions |= JSOPTION_BASELINE;
}

View File

@ -4799,7 +4799,7 @@ CheckFunctionBodiesSequential(ModuleCompiler &m)
IonSpewNewFunction(&mirGen->graph(), NullPtr());
IonContext icx(m.cx()->compartment(), &mirGen->temp());
IonContext icx(m.cx(), &mirGen->temp());
int64_t before = PRMJ_Now();

View File

@ -2465,7 +2465,7 @@ CodeGenerator::maybeCreateScriptCounts()
// If scripts are being profiled, create a new IonScriptCounts and attach
// it to the script. This must be done on the main thread.
JSContext *cx = GetIonContext()->cx;
if (!cx)
if (!cx || !cx->runtime()->profilingScripts)
return NULL;
IonScriptCounts *counts = NULL;
@ -2473,14 +2473,7 @@ CodeGenerator::maybeCreateScriptCounts()
CompileInfo *outerInfo = &gen->info();
JSScript *script = outerInfo->script();
if (cx->runtime()->profilingScripts) {
if (script && !script->hasScriptCounts && !script->initScriptCounts(cx))
return NULL;
} else if (!script) {
return NULL;
}
if (script && !script->hasScriptCounts)
if (script && !script->hasScriptCounts && !script->initScriptCounts(cx))
return NULL;
counts = js_new<IonScriptCounts>();

View File

@ -134,7 +134,7 @@ JSContext *createContext()
{
JSContext *cx = JSAPITest::createContext();
if (cx)
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_BASELINE | JSOPTION_ION | JSOPTION_PCCOUNT);
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_BASELINE | JSOPTION_ION);
return cx;
}

View File

@ -1962,8 +1962,6 @@ JS_StringToVersion(const char *string);
#define JSOPTION_BASELINE JS_BIT(14) /* Baseline compiler. */
#define JSOPTION_PCCOUNT JS_BIT(15) /* Collect per-op execution counts */
#define JSOPTION_TYPE_INFERENCE JS_BIT(16) /* Perform type inference. */
#define JSOPTION_STRICT_MODE JS_BIT(17) /* Provides a way to force
strict mode for all code

View File

@ -856,7 +856,6 @@ JS_DumpBytecode(JSContext *cx, JSScript *scriptArg)
extern JS_PUBLIC_API(void)
JS_DumpPCCounts(JSContext *cx, JSScript *scriptArg)
{
#if defined(DEBUG)
Rooted<JSScript*> script(cx, scriptArg);
JS_ASSERT(script->hasScriptCounts);
@ -868,7 +867,6 @@ JS_DumpPCCounts(JSContext *cx, JSScript *scriptArg)
js_DumpPCCounts(cx, script, &sprinter);
fputs(sprinter.string(), stdout);
fprintf(stdout, "--- END SCRIPT %s:%d ---\n", script->filename(), script->lineno);
#endif
}
namespace {
@ -907,7 +905,7 @@ JS_DumpCompartmentPCCounts(JSContext *cx)
JS_DumpPCCounts(cx, script);
}
#if defined(JS_ION) && defined(DEBUG)
#if defined(JS_ION)
for (unsigned thingKind = FINALIZE_OBJECT0; thingKind < FINALIZE_OBJECT_LIMIT; thingKind++) {
for (CellIter i(cx->zone(), (AllocKind) thingKind); !i.done(); i.next()) {
JSObject *obj = i.get<JSObject>();

View File

@ -258,8 +258,6 @@ PCCounts::countName(JSOp op, size_t which)
MOZ_ASSUME_UNREACHABLE("bad op");
}
#ifdef DEBUG
#ifdef JS_ION
void
js::DumpIonScriptCounts(Sprinter *sp, ion::IonScriptCounts *ionCounts)
@ -284,6 +282,7 @@ js_DumpPCCounts(JSContext *cx, HandleScript script, js::Sprinter *sp)
{
JS_ASSERT(script->hasScriptCounts);
#ifdef DEBUG
jsbytecode *pc = script->code;
while (pc < script->code + script->length) {
JSOp op = JSOp(*pc);
@ -312,6 +311,7 @@ js_DumpPCCounts(JSContext *cx, HandleScript script, js::Sprinter *sp)
pc = next;
}
#endif
#ifdef JS_ION
ion::IonScriptCounts *ionCounts = script->getIonCounts();
@ -323,6 +323,8 @@ js_DumpPCCounts(JSContext *cx, HandleScript script, js::Sprinter *sp)
#endif
}
#ifdef DEBUG
/*
* If pc != NULL, include a prefix indicating whether the PC is at the current line.
* If showAll is true, include the source note type and the entry stack depth.

View File

@ -782,6 +782,8 @@ unsigned
js_Disassemble1(JSContext *cx, JS::Handle<JSScript*> script, jsbytecode *pc, unsigned loc,
JSBool lines, js::Sprinter *sp);
#endif
void
js_DumpPCCounts(JSContext *cx, JS::Handle<JSScript*> script, js::Sprinter *sp);
@ -793,6 +795,4 @@ DumpIonScriptCounts(js::Sprinter *sp, ion::IonScriptCounts *ionCounts);
}
#endif
#endif
#endif /* jsopcode_h */

View File

@ -772,11 +772,8 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
}
}
if (mode == XDR_DECODE) {
if (cx->hasOption(JSOPTION_PCCOUNT))
(void) script->initScriptCounts(cx);
if (mode == XDR_DECODE)
scriptp.set(script);
}
return true;
}
@ -1929,13 +1926,6 @@ JSScript::fullyInitFromEmitter(JSContext *cx, Handle<JSScript*> script, Bytecode
script->setFunction(funbox->function());
}
/*
* initScriptCounts updates scriptCountsMap if necessary. The other script
* maps in JSCompartment are populated lazily.
*/
if (cx->hasOption(JSOPTION_PCCOUNT))
(void) script->initScriptCounts(cx);
for (unsigned i = 0, n = script->bindings.numArgs(); i < n; ++i) {
if (script->formalIsAliased(i)) {
script->funHasAnyAliasedFormal = true;
@ -2445,13 +2435,6 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
dst->shouldCloneAtCallsite = src->shouldCloneAtCallsite;
dst->isCallsiteClone = src->isCallsiteClone;
/*
* initScriptCounts updates scriptCountsMap if necessary. The other script
* maps in JSCompartment are populated lazily.
*/
if (cx->hasOption(JSOPTION_PCCOUNT))
(void) dst->initScriptCounts(cx);
if (nconsts != 0) {
HeapValue *vector = Rebase<HeapValue>(dst, src, src->consts()->vector);
dst->consts()->vector = vector;

View File

@ -4934,8 +4934,10 @@ ProcessArgs(JSContext *cx, JSObject *obj_, OptionParser *op)
if (op->getBoolOption('b'))
printTiming = true;
if (op->getBoolOption('D'))
if (op->getBoolOption('D')) {
cx->runtime()->profilingScripts = true;
enableDisassemblyDumps = true;
}
#ifdef JS_THREADSAFE
int32_t threadCount = op->getIntOption("thread-count");
@ -5370,10 +5372,6 @@ main(int argc, char **argv, char **envp)
js::SetPreserveWrapperCallback(rt, DummyPreserveWrapperCallback);
/* Must be done before creating the global object */
if (op.getBoolOption('D'))
JS_ToggleOptions(cx, JSOPTION_PCCOUNT);
result = Shell(cx, &op, envp);
#ifdef DEBUG

View File

@ -814,8 +814,6 @@ pref("javascript.options.baselinejit.chrome", true);
pref("javascript.options.ion.content", true);
pref("javascript.options.asmjs", true);
pref("javascript.options.ion.parallel_compilation", true);
pref("javascript.options.pccounts.content", false);
pref("javascript.options.pccounts.chrome", false);
pref("javascript.options.jit_hardening", true);
pref("javascript.options.typeinference", true);
// This preference limits the memory usage of javascript.