Bug 857845 part 3 - Remove JM JSAPI flags, memory reporters and browser prefs. r=djvj

--HG--
extra : rebase_source : 8b2ed85801fcd8c8fd0fc16a89b1a275add1a310
This commit is contained in:
Jan de Mooij 2013-05-22 14:50:45 +02:00
Родитель ca8b7e143c
Коммит 162bdc21e4
20 изменённых файлов: 20 добавлений и 122 удалений

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

@ -959,9 +959,6 @@ static const char js_werror_option_str[] = JS_OPTIONS_DOT_STR "werror";
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_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_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";
static const char js_pccounts_chrome_str[] = JS_OPTIONS_DOT_STR "pccounts.chrome";
@ -1004,13 +1001,9 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
nsCOMPtr<nsIDOMWindow> contentWindow(do_QueryInterface(global));
nsCOMPtr<nsIDOMChromeWindow> chromeWindow(do_QueryInterface(global));
bool useMethodJIT = Preferences::GetBool(chromeWindow || !contentWindow ?
js_methodjit_chrome_str :
js_methodjit_content_str);
bool usePCCounts = Preferences::GetBool(chromeWindow || !contentWindow ?
js_pccounts_chrome_str :
js_pccounts_content_str);
bool useMethodJITAlways = Preferences::GetBool(js_methodjit_always_str);
bool useTypeInference = !chromeWindow && contentWindow && Preferences::GetBool(js_typeinfer_str);
bool useHardening = Preferences::GetBool(js_jit_hardening_str);
bool useBaselineJIT = Preferences::GetBool(chromeWindow || !contentWindow ?
@ -1024,10 +1017,8 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
bool safeMode = false;
xr->GetInSafeMode(&safeMode);
if (safeMode) {
useMethodJIT = false;
usePCCounts = false;
useTypeInference = false;
useMethodJITAlways = true;
useHardening = false;
useBaselineJIT = false;
useIon = false;
@ -1035,21 +1026,11 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
}
}
if (useMethodJIT)
newDefaultJSOptions |= JSOPTION_METHODJIT;
else
newDefaultJSOptions &= ~JSOPTION_METHODJIT;
if (usePCCounts)
newDefaultJSOptions |= JSOPTION_PCCOUNT;
else
newDefaultJSOptions &= ~JSOPTION_PCCOUNT;
if (useMethodJITAlways)
newDefaultJSOptions |= JSOPTION_METHODJIT_ALWAYS;
else
newDefaultJSOptions &= ~JSOPTION_METHODJIT_ALWAYS;
if (useTypeInference)
newDefaultJSOptions |= JSOPTION_TYPE_INFERENCE;
else

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

@ -150,8 +150,6 @@ MOZ_STATIC_ASSERT(NS_ARRAY_LENGTH(gStringChars) == ID_COUNT,
enum {
PREF_strict = 0,
PREF_werror,
PREF_methodjit,
PREF_methodjit_always,
PREF_typeinference,
PREF_jit_hardening,
PREF_mem_max,
@ -172,8 +170,6 @@ enum {
const char* gPrefsToWatch[] = {
JS_OPTIONS_DOT_STR "strict",
JS_OPTIONS_DOT_STR "werror",
JS_OPTIONS_DOT_STR "methodjit.content",
JS_OPTIONS_DOT_STR "methodjit_always",
JS_OPTIONS_DOT_STR "typeinference",
JS_OPTIONS_DOT_STR "jit_hardening",
JS_OPTIONS_DOT_STR "mem.max",
@ -222,12 +218,6 @@ PrefCallback(const char* aPrefName, void* aClosure)
if (Preferences::GetBool(gPrefsToWatch[PREF_werror])) {
newOptions |= JSOPTION_WERROR;
}
if (Preferences::GetBool(gPrefsToWatch[PREF_methodjit])) {
newOptions |= JSOPTION_METHODJIT;
}
if (Preferences::GetBool(gPrefsToWatch[PREF_methodjit_always])) {
newOptions |= JSOPTION_METHODJIT_ALWAYS;
}
if (Preferences::GetBool(gPrefsToWatch[PREF_typeinference])) {
newOptions |= JSOPTION_TYPE_INFERENCE;
}

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

@ -91,7 +91,6 @@ struct TypeInferenceSizes
// Data for tracking JIT-code memory usage.
struct CodeSizes
{
size_t jaeger;
size_t ion;
size_t asmJS;
size_t baseline;
@ -241,7 +240,6 @@ struct CompartmentStats
shapesExtraTreeShapeKids(0),
shapesCompartmentTables(0),
scriptData(0),
jaegerData(0),
baselineData(0),
baselineStubsFallback(0),
baselineStubsOptimized(0),
@ -271,7 +269,6 @@ struct CompartmentStats
shapesExtraTreeShapeKids(other.shapesExtraTreeShapeKids),
shapesCompartmentTables(other.shapesCompartmentTables),
scriptData(other.scriptData),
jaegerData(other.jaegerData),
baselineData(other.baselineData),
baselineStubsFallback(other.baselineStubsFallback),
baselineStubsOptimized(other.baselineStubsOptimized),
@ -306,7 +303,6 @@ struct CompartmentStats
size_t shapesExtraTreeShapeKids;
size_t shapesCompartmentTables;
size_t scriptData;
size_t jaegerData;
size_t baselineData;
size_t baselineStubsFallback;
size_t baselineStubsOptimized;
@ -339,7 +335,6 @@ struct CompartmentStats
ADD(shapesExtraTreeShapeKids);
ADD(shapesCompartmentTables);
ADD(scriptData);
ADD(jaegerData);
ADD(baselineData);
ADD(baselineStubsFallback);
ADD(baselineStubsOptimized);

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

@ -51,14 +51,12 @@ ExecutableAllocator::sizeOfCode(JS::CodeSizes *sizes) const
if (m_pools.initialized()) {
for (ExecPoolHashSet::Range r = m_pools.all(); !r.empty(); r.popFront()) {
ExecutablePool* pool = r.front();
sizes->jaeger += pool->m_jaegerCodeBytes;
sizes->ion += pool->m_ionCodeBytes;
sizes->baseline += pool->m_baselineCodeBytes;
sizes->asmJS += pool->m_asmJSCodeBytes;
sizes->regexp += pool->m_regexpCodeBytes;
sizes->other += pool->m_otherCodeBytes;
sizes->unused += pool->m_allocation.size - pool->m_jaegerCodeBytes
- pool->m_ionCodeBytes
sizes->unused += pool->m_allocation.size - pool->m_ionCodeBytes
- pool->m_baselineCodeBytes
- pool->m_asmJSCodeBytes
- pool->m_regexpCodeBytes

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

@ -86,7 +86,7 @@ namespace JSC {
class ExecutableAllocator;
enum CodeKind { JAEGER_CODE, ION_CODE, BASELINE_CODE, REGEXP_CODE, ASMJS_CODE, OTHER_CODE };
enum CodeKind { ION_CODE, BASELINE_CODE, REGEXP_CODE, ASMJS_CODE, OTHER_CODE };
// These are reference-counted. A new one starts with a count of 1.
class ExecutablePool {
@ -110,7 +110,6 @@ private:
unsigned m_refCount;
// Number of bytes currently used for Method and Regexp JIT code.
size_t m_jaegerCodeBytes;
size_t m_ionCodeBytes;
size_t m_baselineCodeBytes;
size_t m_asmJSCodeBytes;
@ -136,7 +135,7 @@ public:
ExecutablePool(ExecutableAllocator* allocator, Allocation a)
: m_allocator(allocator), m_freePtr(a.pages), m_end(m_freePtr + a.size), m_allocation(a),
m_refCount(1), m_jaegerCodeBytes(0), m_ionCodeBytes(0), m_baselineCodeBytes(0),
m_refCount(1), m_ionCodeBytes(0), m_baselineCodeBytes(0),
m_asmJSCodeBytes(0), m_regexpCodeBytes(0), m_otherCodeBytes(0),
m_destroy(false), m_gcNumber(0)
{ }
@ -160,7 +159,6 @@ private:
m_freePtr += n;
switch (kind) {
case JAEGER_CODE: m_jaegerCodeBytes += n; break;
case ION_CODE: m_ionCodeBytes += n; break;
case BASELINE_CODE: m_baselineCodeBytes += n; break;
case ASMJS_CODE: m_asmJSCodeBytes += n; break;

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

@ -3,7 +3,6 @@ gczeal(4);
var optionNames = options().split(',');
for (var i = 0; i < optionNames.length; i++)
var optionName = optionNames[i];
options(optionName);
evaluate("\
function addDebug(g, id) {\
var debuggerGlobal = newGlobal('new-compartment');\

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

@ -242,10 +242,6 @@ BEGIN_TEST(testDebugger_singleStepThrow)
CHECK(JS_SetDebugModeForCompartment(cx, cx->compartment, true));
CHECK(JS_SetInterrupt(rt, onStep, NULL));
uint32_t opts = JS_GetOptions(cx);
opts |= JSOPTION_METHODJIT | JSOPTION_METHODJIT_ALWAYS;
JS_SetOptions(cx, opts);
CHECK(JS_DefineFunction(cx, global, "setStepMode", setStepMode, 0, 0));
EXEC("var e;\n"
"setStepMode();\n"

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

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

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

@ -142,8 +142,7 @@ END_TEST(testProfileStrings_isCalledWithInterpreter)
BEGIN_TEST(testProfileStrings_isCalledWithJIT)
{
CHECK(initialize(cx));
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_METHODJIT |
JSOPTION_METHODJIT_ALWAYS);
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_BASELINE | JSOPTION_ION);
EXEC("function g() { var p = new Prof(); p.test_fn(); }");
EXEC("function f() { g(); }");
@ -191,7 +190,7 @@ END_TEST(testProfileStrings_isCalledWithJIT)
BEGIN_TEST(testProfileStrings_isCalledWhenError)
{
CHECK(initialize(cx));
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_METHODJIT | JSOPTION_METHODJIT_ALWAYS);
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_BASELINE | JSOPTION_ION);
EXEC("function check2() { throw 'a'; }");
@ -214,7 +213,7 @@ END_TEST(testProfileStrings_isCalledWhenError)
BEGIN_TEST(testProfileStrings_worksWhenEnabledOnTheFly)
{
CHECK(initialize(cx));
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_METHODJIT | JSOPTION_METHODJIT_ALWAYS);
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_BASELINE | JSOPTION_ION);
EXEC("function b(p) { p.test_fn(); }");
EXEC("function a() { var p = new Prof(); p.enable(); b(p); }");

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

@ -1945,26 +1945,21 @@ JS_StringToVersion(const char *string);
leaving that up to the
embedding. */
#define JSOPTION_METHODJIT JS_BIT(14) /* Whole-method JIT. */
#define JSOPTION_BASELINE JS_BIT(14) /* Baseline compiler. */
#define JSOPTION_BASELINE JS_BIT(15) /* Baseline compiler. */
#define JSOPTION_PCCOUNT JS_BIT(15) /* Collect per-op execution counts */
#define JSOPTION_METHODJIT_ALWAYS \
JS_BIT(16) /* Always whole-method JIT,
don't tune at run-time. */
#define JSOPTION_PCCOUNT JS_BIT(17) /* Collect per-op execution counts */
#define JSOPTION_TYPE_INFERENCE JS_BIT(18) /* Perform type inference. */
#define JSOPTION_STRICT_MODE JS_BIT(19) /* Provides a way to force
#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
without requiring
"use strict" annotations. */
#define JSOPTION_ION JS_BIT(20) /* IonMonkey */
#define JSOPTION_ION JS_BIT(18) /* IonMonkey */
#define JSOPTION_ASMJS JS_BIT(21) /* optimizingasm.js compiler */
#define JSOPTION_ASMJS JS_BIT(19) /* optimizingasm.js compiler */
#define JSOPTION_MASK JS_BITMASK(22)
#define JSOPTION_MASK JS_BITMASK(20)
extern JS_PUBLIC_API(uint32_t)
JS_GetOptions(JSContext *cx);

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

@ -2437,12 +2437,10 @@ TypeZone::init(JSContext *cx)
!cx->hasOption(JSOPTION_TYPE_INFERENCE) ||
!cx->runtime->jitSupportsFloatingPoint)
{
jaegerCompilationAllowed = true;
return;
}
inferenceEnabled = true;
jaegerCompilationAllowed = cx->hasOption(JSOPTION_METHODJIT);
}
TypeObject *

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

@ -1469,13 +1469,6 @@ struct TypeZone
/* Whether type inference is enabled in this compartment. */
bool inferenceEnabled;
/*
* JM compilation is allowed only if script analysis has been used to
* monitor the behavior of all scripts in this zone since its creation.
* OSR in JM requires this property.
*/
bool jaegerCompilationAllowed;
TypeZone(JS::Zone *zone);
~TypeZone();
void init(JSContext *cx);

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

@ -1072,18 +1072,12 @@ TypeScript::SetThis(JSContext *cx, JSScript *script, Type type)
return;
JS_ASSERT(script->types);
/* Analyze the script regardless if -a was used. */
bool analyze = cx->hasOption(JSOPTION_METHODJIT_ALWAYS);
if (!ThisTypes(script)->hasType(type) || analyze) {
if (!ThisTypes(script)->hasType(type)) {
AutoEnterAnalysis enter(cx);
InferSpew(ISpewOps, "externalType: setThis #%u: %s",
script->id(), TypeString(type));
ThisTypes(script)->addType(cx, type);
if (analyze)
script->ensureRanInference(cx);
}
}

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

@ -121,7 +121,6 @@ static double gTimeoutInterval = -1.0;
static volatile bool gTimedOut = false;
static JS::Value gTimeoutFunc;
static bool enableMethodJit = true;
static bool enableTypeInference = true;
static bool enableDisassemblyDumps = false;
static bool enableIon = true;
@ -600,8 +599,6 @@ static const struct JSOption {
const char *name;
uint32_t flag;
} js_options[] = {
{"methodjit", JSOPTION_METHODJIT},
{"methodjit_always",JSOPTION_METHODJIT_ALWAYS},
{"strict", JSOPTION_STRICT},
{"typeinfer", JSOPTION_TYPE_INFERENCE},
{"werror", JSOPTION_WERROR},
@ -4775,8 +4772,6 @@ NewContext(JSRuntime *rt)
JS_SetErrorReporter(cx, my_ErrorReporter);
JS_SetVersion(cx, JSVERSION_LATEST);
SetContextOptions(cx);
if (enableMethodJit)
JS_ToggleOptions(cx, JSOPTION_METHODJIT);
if (enableTypeInference)
JS_ToggleOptions(cx, JSOPTION_TYPE_INFERENCE);
if (enableIon)
@ -4926,9 +4921,6 @@ ProcessArgs(JSContext *cx, JSObject *obj_, OptionParser *op)
{
RootedObject obj(cx, obj_);
if (op->getBoolOption('a'))
JS_ToggleOptions(cx, JSOPTION_METHODJIT_ALWAYS);
if (op->getBoolOption('c'))
compileOnly = true;
@ -5129,17 +5121,13 @@ Shell(JSContext *cx, OptionParser *op, char **envp)
JSAutoRequest ar(cx);
/*
* First check to see if type inference and JM are enabled. These flags
* First check to see if type inference is enabled. These flags
* must be set on the compartment when it is constructed.
*/
if (op->getBoolOption("no-ti")) {
enableTypeInference = false;
JS_ToggleOptions(cx, JSOPTION_TYPE_INFERENCE);
}
if (op->getBoolOption("no-jm")) {
enableMethodJit = false;
JS_ToggleOptions(cx, JSOPTION_METHODJIT);
}
RootedObject glob(cx);
glob = NewGlobalObject(cx, NULL);
@ -5248,8 +5236,8 @@ main(int argc, char **argv, char **envp)
if (!op.addMultiStringOption('f', "file", "PATH", "File path to run")
|| !op.addMultiStringOption('e', "execute", "CODE", "Inline code to run")
|| !op.addBoolOption('i', "shell", "Enter prompt after running code")
|| !op.addBoolOption('m', "jm", "Enable the JaegerMonkey method JIT (default)")
|| !op.addBoolOption('\0', "no-jm", "Disable the JaegerMonkey method JIT")
|| !op.addBoolOption('m', "jm", "No-op (still used by fuzzers)")
|| !op.addBoolOption('\0', "no-jm", "No-op (still used by fuzzers)")
|| !op.addBoolOption('n', "ti", "Enable type inference (default)")
|| !op.addBoolOption('\0', "no-ti", "Disable type inference")
|| !op.addBoolOption('c', "compileonly", "Only compile, don't run (syntax checking mode)")
@ -5257,8 +5245,7 @@ main(int argc, char **argv, char **envp)
|| !op.addBoolOption('W', "nowarnings", "Don't emit warnings")
|| !op.addBoolOption('s', "strict", "Check strictness")
|| !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.")
|| !op.addBoolOption('a', "always-mjit", "No-op (still used by fuzzers)")
|| !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

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

@ -237,8 +237,6 @@ function optionsInit() {
options.currvalues = {
strict: true,
werror: true,
methodjit: true,
methodjit_always: true,
strict_mode: true
};

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

@ -119,7 +119,7 @@ interface ScheduledGCCallback : nsISupports
/**
* interface of Components.utils
*/
[scriptable, uuid(623d354d-6eab-4cf6-8c08-2cde5869d439)]
[scriptable, uuid(fdd32d38-9341-4067-9000-d781075a60c9)]
interface nsIXPCComponents_Utils : nsISupports
{
@ -382,12 +382,6 @@ interface nsIXPCComponents_Utils : nsISupports
[implicit_jscontext]
attribute boolean werror;
[implicit_jscontext]
attribute boolean methodjit;
[implicit_jscontext]
attribute boolean methodjit_always;
[implicit_jscontext]
attribute boolean strict_mode;

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

@ -1151,9 +1151,6 @@ ProcessArgsForCompartment(JSContext *cx, char **argv, int argc)
case 's':
JS_ToggleOptions(cx, JSOPTION_STRICT);
break;
case 'm':
JS_ToggleOptions(cx, JSOPTION_METHODJIT);
break;
case 'I':
JS_ToggleOptions(cx, JSOPTION_COMPILE_N_GO);
JS_ToggleOptions(cx, JSOPTION_ION);

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

@ -4505,8 +4505,6 @@ SetBoolOption(JSContext* cx, uint32_t aOption, bool aValue)
GENERATE_JSOPTION_GETTER_SETTER(Strict, JSOPTION_STRICT)
GENERATE_JSOPTION_GETTER_SETTER(Werror, JSOPTION_WERROR)
GENERATE_JSOPTION_GETTER_SETTER(Methodjit, JSOPTION_METHODJIT)
GENERATE_JSOPTION_GETTER_SETTER(Methodjit_always, JSOPTION_METHODJIT_ALWAYS)
GENERATE_JSOPTION_GETTER_SETTER(Strict_mode, JSOPTION_STRICT_MODE)
GENERATE_JSOPTION_GETTER_SETTER(Ion, JSOPTION_ION)

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

@ -1872,11 +1872,6 @@ ReportCompartmentStats(const JS::CompartmentStats &cStats,
cStats.scriptData,
"Memory allocated for various variable-length tables in JSScript.");
ZCREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("jaeger-data"),
cStats.jaegerData,
"Memory used by the JaegerMonkey JIT for compilation data: "
"JITScripts, native maps, and inline cache structs.");
ZCREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("baseline/data"),
cStats.baselineData,
"Memory used by the Baseline JIT for compilation data: "
@ -2020,10 +2015,6 @@ ReportJSRuntimeExplicitTreeStats(const JS::RuntimeStats &rtStats,
"Memory held transiently in JSRuntime and used during "
"compilation. It mostly holds parse nodes.");
RREPORT_BYTES(rtPath + NS_LITERAL_CSTRING("runtime/code/jaeger"),
nsIMemoryReporter::KIND_NONHEAP, rtStats.runtime.code.jaeger,
"Memory used by the JaegerMonkey JIT to hold generated code.");
RREPORT_BYTES(rtPath + NS_LITERAL_CSTRING("runtime/code/ion"),
nsIMemoryReporter::KIND_NONHEAP, rtStats.runtime.code.ion,
"Memory used by the IonMonkey JIT to hold generated code.");

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

@ -780,8 +780,6 @@ pref("javascript.options.strict", false);
#ifdef DEBUG
pref("javascript.options.strict.debug", true);
#endif
pref("javascript.options.methodjit.content", false);
pref("javascript.options.methodjit.chrome", false);
pref("javascript.options.baselinejit.content", true);
pref("javascript.options.baselinejit.chrome", true);
pref("javascript.options.ion.content", true);
@ -789,7 +787,6 @@ 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.methodjit_always", false);
pref("javascript.options.jit_hardening", true);
pref("javascript.options.typeinference", true);
// This preference limits the memory usage of javascript.