зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1417844 part 4 - Remove more JSVersion code. r=evilpie
This commit is contained in:
Родитель
2e7986aee1
Коммит
793d5faa99
|
@ -173,18 +173,6 @@ Load(JSContext *cx,
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
Version(JSContext *cx,
|
||||
unsigned argc,
|
||||
JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
args.rval().setInt32(JS_GetVersion(cx));
|
||||
if (args.get(0).isInt32())
|
||||
JS::SetVersionForCurrentRealm(cx, JSVersion(args[0].toInt32()));
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
Quit(JSContext *cx,
|
||||
unsigned argc,
|
||||
|
@ -250,7 +238,6 @@ const JSFunctionSpec gGlobalFunctions[] =
|
|||
JS_FN("print", Print, 0,0),
|
||||
JS_FN("load", Load, 1,0),
|
||||
JS_FN("quit", Quit, 0,0),
|
||||
JS_FN("version", Version, 1,0),
|
||||
JS_FN("dumpXPC", DumpXPC, 1,0),
|
||||
JS_FN("dump", Dump, 1,0),
|
||||
JS_FN("gc", GC, 0,0),
|
||||
|
|
|
@ -117,17 +117,6 @@ GetRealmErrorPrototype(JSContext* cx);
|
|||
extern JS_PUBLIC_API(JSObject*)
|
||||
GetRealmIteratorPrototype(JSContext* cx);
|
||||
|
||||
/**
|
||||
* Change the JS language version for the current Realm. This is discouraged,
|
||||
* but necessary to support the `version()` builtin function in the js and xpc
|
||||
* shells.
|
||||
*
|
||||
* It would be nice to put this in jsfriendapi, but the linkage requirements
|
||||
* of the shells make that impossible.
|
||||
*/
|
||||
JS_PUBLIC_API(void)
|
||||
SetVersionForCurrentRealm(JSContext* cx, JSVersion version);
|
||||
|
||||
} // namespace JS
|
||||
|
||||
#endif // js_Realm_h
|
||||
|
|
|
@ -589,12 +589,6 @@ JS::SetSingleThreadedExecutionCallbacks(JSContext* cx,
|
|||
cx->runtime()->endSingleThreadedExecutionCallback = end;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSVersion)
|
||||
JS_GetVersion(JSContext* cx)
|
||||
{
|
||||
return VersionNumber(cx->findVersion());
|
||||
}
|
||||
|
||||
static const struct v2smap {
|
||||
JSVersion version;
|
||||
const char* string;
|
||||
|
|
|
@ -1123,9 +1123,6 @@ class MOZ_RAII JSAutoRequest
|
|||
#endif
|
||||
};
|
||||
|
||||
extern JS_PUBLIC_API(JSVersion)
|
||||
JS_GetVersion(JSContext* cx);
|
||||
|
||||
extern JS_PUBLIC_API(const char*)
|
||||
JS_VersionToString(JSVersion version);
|
||||
|
||||
|
|
|
@ -1593,15 +1593,6 @@ JSContext::initJitStackLimit()
|
|||
resetJitStackLimit();
|
||||
}
|
||||
|
||||
JSVersion
|
||||
JSContext::findVersion()
|
||||
{
|
||||
if (!CurrentThreadCanAccessRuntime(runtime()))
|
||||
return JSVERSION_DEFAULT;
|
||||
|
||||
return runtime()->defaultVersion();
|
||||
}
|
||||
|
||||
void
|
||||
JSContext::updateMallocCounter(size_t nbytes)
|
||||
{
|
||||
|
|
|
@ -672,16 +672,6 @@ struct JSContext : public JS::RootingContext,
|
|||
void resetJitStackLimit();
|
||||
|
||||
public:
|
||||
/*
|
||||
* Return:
|
||||
* - The newest scripted frame's version, if there is such a frame.
|
||||
* - The version from the compartment.
|
||||
* - The default version.
|
||||
*
|
||||
* Note: if this ever shows up in a profile, just add caching!
|
||||
*/
|
||||
JSVersion findVersion();
|
||||
|
||||
JS::ContextOptions& options() {
|
||||
return options_.ref();
|
||||
}
|
||||
|
|
|
@ -110,8 +110,3 @@ JS::GetRealmIteratorPrototype(JSContext* cx)
|
|||
CHECK_REQUEST(cx);
|
||||
return GlobalObject::getOrCreateIteratorPrototype(cx, cx->global());
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS::SetVersionForCurrentRealm(JSContext* cx, JSVersion version)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1091,48 +1091,6 @@ struct JSRuntime : public js::MallocProvider<JSRuntime>
|
|||
|
||||
namespace js {
|
||||
|
||||
/*
|
||||
* Flags accompany script version data so that a) dynamically created scripts
|
||||
* can inherit their caller's compile-time properties and b) scripts can be
|
||||
* appropriately compared in the eval cache across global option changes. An
|
||||
* example of the latter is enabling the top-level-anonymous-function-is-error
|
||||
* option: subsequent evals of the same, previously-valid script text may have
|
||||
* become invalid.
|
||||
*/
|
||||
namespace VersionFlags {
|
||||
static const unsigned MASK = 0x0FFF; /* see JSVersion in jspubtd.h */
|
||||
} /* namespace VersionFlags */
|
||||
|
||||
static inline JSVersion
|
||||
VersionNumber(JSVersion version)
|
||||
{
|
||||
return JSVersion(uint32_t(version) & VersionFlags::MASK);
|
||||
}
|
||||
|
||||
static inline JSVersion
|
||||
VersionExtractFlags(JSVersion version)
|
||||
{
|
||||
return JSVersion(uint32_t(version) & ~VersionFlags::MASK);
|
||||
}
|
||||
|
||||
static inline void
|
||||
VersionCopyFlags(JSVersion* version, JSVersion from)
|
||||
{
|
||||
*version = JSVersion(VersionNumber(*version) | VersionExtractFlags(from));
|
||||
}
|
||||
|
||||
static inline bool
|
||||
VersionHasFlags(JSVersion version)
|
||||
{
|
||||
return !!VersionExtractFlags(version);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
VersionIsKnown(JSVersion version)
|
||||
{
|
||||
return VersionNumber(version) != JSVERSION_UNKNOWN;
|
||||
}
|
||||
|
||||
inline void
|
||||
FreeOp::free_(void* p)
|
||||
{
|
||||
|
|
|
@ -386,16 +386,6 @@ Load(JSContext* cx, unsigned argc, Value* vp)
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
Version(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
args.rval().setInt32(JS_GetVersion(cx));
|
||||
if (args.get(0).isInt32())
|
||||
SetVersionForCurrentRealm(cx, JSVersion(args[0].toInt32()));
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
Quit(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
|
@ -662,7 +652,6 @@ static const JSFunctionSpec glob_functions[] = {
|
|||
JS_FN("readline", ReadLine, 1,0),
|
||||
JS_FN("load", Load, 1,0),
|
||||
JS_FN("quit", Quit, 0,0),
|
||||
JS_FN("version", Version, 1,0),
|
||||
JS_FN("dumpXPC", DumpXPC, 1,0),
|
||||
JS_FN("dump", Dump, 1,0),
|
||||
JS_FN("gc", GC, 0,0),
|
||||
|
@ -840,7 +829,7 @@ static int
|
|||
usage()
|
||||
{
|
||||
fprintf(gErrFile, "%s\n", JS_GetImplementationVersion());
|
||||
fprintf(gErrFile, "usage: xpcshell [-g gredir] [-a appdir] [-r manifest]... [-WwxiCSsmIp] [-v version] [-f scriptfile] [-e script] [scriptfile] [scriptarg...]\n");
|
||||
fprintf(gErrFile, "usage: xpcshell [-g gredir] [-a appdir] [-r manifest]... [-WwxiCSsmIp] [-f scriptfile] [-e script] [scriptfile] [scriptarg...]\n");
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
@ -953,12 +942,6 @@ ProcessArgs(AutoJSAPI& jsapi, char** argv, int argc, XPCShellDirProvider* aDirPr
|
|||
break;
|
||||
}
|
||||
switch (argv[i][1]) {
|
||||
case 'v':
|
||||
if (++i == argc) {
|
||||
return printUsageAndSetExitCode();
|
||||
}
|
||||
SetVersionForCurrentRealm(cx, JSVersion(atoi(argv[i])));
|
||||
break;
|
||||
case 'W':
|
||||
reportWarnings = false;
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче