зеркало из https://github.com/mozilla/gecko-dev.git
Footprint wins: disable export/import from js1.5, fuse common code before a given jump target in js_Invoke, avoid unnecessary subtraction when enforcing ARGC_LIMIT. Also, clean up comment nits.
This commit is contained in:
Родитель
f7d4b5b5f2
Коммит
7c6f47247d
|
@ -454,7 +454,7 @@
|
|||
#define JS_HAS_SEQUENCE_OPS 1 /* has array.slice, string.concat */
|
||||
#define JS_HAS_INITIALIZERS 1 /* has var o = {'foo': 42, 'bar':3} */
|
||||
#define JS_HAS_OBJ_WATCHPOINT 1 /* has o.watch and o.unwatch */
|
||||
#define JS_HAS_EXPORT_IMPORT 1 /* has export fun; import obj.fun */
|
||||
#define JS_HAS_EXPORT_IMPORT 0 /* has export fun; import obj.fun */
|
||||
#define JS_HAS_EVAL_THIS_SCOPE 1 /* Math.eval is same as with (Math) */
|
||||
#define JS_HAS_TRIPLE_EQOPS 1 /* has === and !== identity eqops */
|
||||
#define JS_HAS_SHARP_VARS 1 /* has #n=, #n# for object literals */
|
||||
|
|
|
@ -794,12 +794,10 @@ js_Invoke(JSContext *cx, uintN argc, uintN flags)
|
|||
goto out2;
|
||||
|
||||
if (JSVAL_IS_FUNCTION(cx, v)) {
|
||||
funobj = JSVAL_TO_OBJECT(v);
|
||||
parent = OBJ_GET_PARENT(cx, funobj);
|
||||
fun = (JSFunction *) JS_GetPrivate(cx, funobj);
|
||||
|
||||
/* Make vp refer to funobj to keep it available as argv[-2]. */
|
||||
*vp = v;
|
||||
funobj = JSVAL_TO_OBJECT(v);
|
||||
parent = OBJ_GET_PARENT(cx, funobj);
|
||||
goto have_fun;
|
||||
}
|
||||
}
|
||||
|
@ -807,14 +805,14 @@ js_Invoke(JSContext *cx, uintN argc, uintN flags)
|
|||
script = NULL;
|
||||
minargs = nvars = 0;
|
||||
|
||||
/* Try a call or construct native object op, using fun as fallback. */
|
||||
/* Try a call or construct native object op. */
|
||||
native = (flags & JSINVOKE_CONSTRUCT) ? ops->construct : ops->call;
|
||||
if (!native)
|
||||
goto bad;
|
||||
} else {
|
||||
have_fun:
|
||||
/* Get private data and set derived locals from it. */
|
||||
fun = (JSFunction *) JS_GetPrivate(cx, funobj);
|
||||
have_fun:
|
||||
native = fun->native;
|
||||
script = fun->script;
|
||||
minargs = fun->nargs + fun->extra;
|
||||
|
@ -825,7 +823,7 @@ have_fun:
|
|||
thisp = parent;
|
||||
}
|
||||
|
||||
/* Initialize frame except for varobj, thisp, sp, spbase, and scopeChain. */
|
||||
/* Initialize the rest of frame, except for sp (set by SAVE_SP later). */
|
||||
frame.varobj = NULL;
|
||||
frame.callobj = frame.argsobj = NULL;
|
||||
frame.script = script;
|
||||
|
@ -1248,9 +1246,9 @@ ImportProperty(JSContext *cx, JSObject *obj, jsid id)
|
|||
|
||||
/*
|
||||
* Handle the case of importing a property that refers to a local
|
||||
* variable or formal parameter of a function activation. Those
|
||||
* variable or formal parameter of a function activation. These
|
||||
* properties are accessed by opcodes using stack slot numbers
|
||||
* generated by the compiler rather than runtime name-lookup. These
|
||||
* generated by the compiler rather than runtime name-lookup. These
|
||||
* local references, therefore, bypass the normal scope chain lookup.
|
||||
* So, instead of defining a new property in the activation object,
|
||||
* modify the existing value in the stack slot.
|
||||
|
@ -2979,7 +2977,7 @@ js_Interpret(JSContext *cx, jsval *result)
|
|||
* NB: rval2 must be the property identifier, and rval the
|
||||
* object from which to get the property. The pair form an
|
||||
* ECMA "reference type", which can be used on the right- or
|
||||
* left-hand side of assignment op. Only native methods can
|
||||
* left-hand side of assignment ops. Only native methods can
|
||||
* return reference types. See JSOP_SETCALL just below for
|
||||
* the left-hand-side case.
|
||||
*/
|
||||
|
|
|
@ -2698,7 +2698,7 @@ MemberExpr(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc,
|
|||
|
||||
if (js_MatchToken(cx, ts, TOK_LP) && !ArgumentList(cx, ts, tc, pn))
|
||||
return NULL;
|
||||
if (pn->pn_count - 1 >= ARGC_LIMIT) {
|
||||
if (pn->pn_count > ARGC_LIMIT) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||
JSMSG_TOO_MANY_CON_ARGS);
|
||||
return NULL;
|
||||
|
@ -2763,7 +2763,7 @@ MemberExpr(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc,
|
|||
|
||||
if (!ArgumentList(cx, ts, tc, pn2))
|
||||
return NULL;
|
||||
if (pn2->pn_count - 1 >= ARGC_LIMIT) {
|
||||
if (pn2->pn_count > ARGC_LIMIT) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||
JSMSG_TOO_MANY_FUN_ARGS);
|
||||
return NULL;
|
||||
|
|
Загрузка…
Ссылка в новой задаче