зеркало из https://github.com/mozilla/pjs.git
Unregress perf in wake of 418069 (420426, r=mrbkap, a=mconnor).
This commit is contained in:
Родитель
c437f3606c
Коммит
1a6056d3f3
|
@ -678,9 +678,7 @@ JS_GetGlobalForObject(JSContext *cx, JSObject *obj);
|
|||
*/
|
||||
#define JS_CALLEE(cx,vp) ((vp)[0])
|
||||
#define JS_ARGV_CALLEE(argv) ((argv)[-2])
|
||||
#define JS_THIS(cx,vp) (JSVAL_IS_NULL((vp)[1]) \
|
||||
? JS_ComputeThis(cx, vp) \
|
||||
: (vp)[1])
|
||||
#define JS_THIS(cx,vp) JS_ComputeThis(cx, vp)
|
||||
#define JS_THIS_OBJECT(cx,vp) ((JSObject *) JS_THIS(cx,vp))
|
||||
#define JS_ARGV(cx,vp) ((vp) + 2)
|
||||
#define JS_RVAL(cx,vp) (*(vp))
|
||||
|
|
|
@ -870,7 +870,7 @@ js_GetPrimitiveThis(JSContext *cx, jsval *vp, JSClass *clasp, jsval *thisvp)
|
|||
|
||||
v = vp[1];
|
||||
if (JSVAL_IS_OBJECT(v)) {
|
||||
obj = JSVAL_TO_OBJECT(v);
|
||||
obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!JS_InstanceOf(cx, obj, clasp, vp + 2))
|
||||
return JS_FALSE;
|
||||
v = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE);
|
||||
|
@ -922,7 +922,7 @@ ComputeGlobalThis(JSContext *cx, JSBool lazy, jsval *argv)
|
|||
*/
|
||||
fp = cx->fp; /* quell GCC overwarning */
|
||||
if (lazy) {
|
||||
JS_ASSERT(!fp->thisp && fp->argv == argv);
|
||||
JS_ASSERT(fp->argv == argv);
|
||||
fp->dormantNext = cx->dormantFrameChain;
|
||||
cx->dormantFrameChain = fp;
|
||||
cx->fp = fp->down;
|
||||
|
@ -1262,10 +1262,12 @@ have_fun:
|
|||
* JS_THIS or JS_THIS_OBJECT, and scripted functions will go through
|
||||
* the appropriate this-computing bytecode, e.g., JSOP_THIS.
|
||||
*/
|
||||
if (native && fun && !(fun->flags & JSFUN_FAST_NATIVE) &&
|
||||
!js_ComputeThis(cx, JS_FALSE, vp + 2)) {
|
||||
ok = JS_FALSE;
|
||||
goto out2;
|
||||
if (native && fun && !(fun->flags & JSFUN_FAST_NATIVE)) {
|
||||
if (!js_ComputeThis(cx, JS_FALSE, vp + 2)) {
|
||||
ok = JS_FALSE;
|
||||
goto out2;
|
||||
}
|
||||
flags |= JSFRAME_COMPUTED_THIS;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1616,7 +1618,7 @@ js_Execute(JSContext *cx, JSObject *chain, JSScript *script,
|
|||
frame.sp = NULL;
|
||||
frame.spbase = NULL;
|
||||
frame.sharpDepth = 0;
|
||||
frame.flags = flags;
|
||||
frame.flags = flags | JSFRAME_COMPUTED_THIS;
|
||||
frame.dormantNext = NULL;
|
||||
frame.xmlNamespace = NULL;
|
||||
frame.blockChain = NULL;
|
||||
|
@ -4006,19 +4008,33 @@ interrupt:
|
|||
DO_NEXT_OP(len);
|
||||
}
|
||||
|
||||
#define COMPUTE_THIS(cx, fp, obj) \
|
||||
JS_BEGIN_MACRO \
|
||||
if (fp->flags & JSFRAME_COMPUTED_THIS) { \
|
||||
obj = fp->thisp; \
|
||||
} else { \
|
||||
obj = js_ComputeThis(cx, JS_TRUE, fp->argv); \
|
||||
if (!obj) \
|
||||
goto error; \
|
||||
fp->thisp = obj; \
|
||||
fp->flags |= JSFRAME_COMPUTED_THIS; \
|
||||
} \
|
||||
JS_END_MACRO
|
||||
|
||||
BEGIN_CASE(JSOP_THIS)
|
||||
COMPUTE_THIS(cx, fp, obj);
|
||||
PUSH_OPND(OBJECT_TO_JSVAL(obj));
|
||||
END_CASE(JSOP_THIS)
|
||||
|
||||
BEGIN_CASE(JSOP_GETTHISPROP)
|
||||
i = 0;
|
||||
obj = fp->thisp;
|
||||
if (!obj) {
|
||||
obj = ComputeGlobalThis(cx, JS_TRUE, fp->argv);
|
||||
if (!obj)
|
||||
goto error;
|
||||
fp->thisp = obj;
|
||||
}
|
||||
COMPUTE_THIS(cx, fp, obj);
|
||||
PUSH(JSVAL_NULL);
|
||||
len = JSOP_GETTHISPROP_LENGTH;
|
||||
goto do_getprop_with_obj;
|
||||
|
||||
#undef COMPUTE_THIS
|
||||
|
||||
BEGIN_CASE(JSOP_GETARGPROP)
|
||||
i = ARGNO_LEN;
|
||||
slot = GET_ARGNO(pc);
|
||||
|
@ -4204,8 +4220,6 @@ interrupt:
|
|||
}
|
||||
STORE_OPND(-1, OBJECT_TO_JSVAL(obj));
|
||||
STORE_OPND(-2, rval);
|
||||
if (!ComputeThis(cx, JS_FALSE, sp))
|
||||
goto error;
|
||||
} else {
|
||||
JS_ASSERT(obj->map->ops->getProperty == js_GetProperty);
|
||||
if (!js_GetPropertyHelper(cx, obj, id, &rval, &entry))
|
||||
|
@ -4888,12 +4902,8 @@ interrupt:
|
|||
|
||||
do_push_rval:
|
||||
PUSH_OPND(rval);
|
||||
if (op == JSOP_CALLNAME) {
|
||||
if (op == JSOP_CALLNAME)
|
||||
PUSH_OPND(OBJECT_TO_JSVAL(obj));
|
||||
SAVE_SP(fp);
|
||||
if (!ComputeThis(cx, JS_FALSE, sp))
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
END_CASE(JSOP_NAME)
|
||||
|
||||
|
@ -5082,17 +5092,6 @@ interrupt:
|
|||
PUSH_OPND(JSVAL_NULL);
|
||||
END_CASE(JSOP_NULL)
|
||||
|
||||
BEGIN_CASE(JSOP_THIS)
|
||||
obj = fp->thisp;
|
||||
if (!obj) {
|
||||
obj = ComputeGlobalThis(cx, JS_TRUE, fp->argv);
|
||||
if (!obj)
|
||||
goto error;
|
||||
fp->thisp = obj;
|
||||
}
|
||||
PUSH_OPND(OBJECT_TO_JSVAL(obj));
|
||||
END_CASE(JSOP_THIS)
|
||||
|
||||
BEGIN_CASE(JSOP_FALSE)
|
||||
PUSH_OPND(JSVAL_FALSE);
|
||||
END_CASE(JSOP_FALSE)
|
||||
|
@ -6315,12 +6314,8 @@ interrupt:
|
|||
if (!OBJ_GET_PROPERTY(cx, obj, id, &rval))
|
||||
goto error;
|
||||
STORE_OPND(-1, rval);
|
||||
if (op == JSOP_CALLXMLNAME) {
|
||||
if (op == JSOP_CALLXMLNAME)
|
||||
PUSH_OPND(OBJECT_TO_JSVAL(obj));
|
||||
SAVE_SP(fp);
|
||||
if (!ComputeThis(cx, JS_FALSE, sp))
|
||||
goto error;
|
||||
}
|
||||
END_CASE(JSOP_XMLNAME)
|
||||
|
||||
BEGIN_CASE(JSOP_DESCENDANTS)
|
||||
|
|
|
@ -98,18 +98,19 @@ typedef struct JSInlineFrame {
|
|||
} JSInlineFrame;
|
||||
|
||||
/* JS stack frame flags. */
|
||||
#define JSFRAME_CONSTRUCTING 0x01 /* frame is for a constructor invocation */
|
||||
#define JSFRAME_INTERNAL 0x02 /* internal call, not invoked by a script */
|
||||
#define JSFRAME_ASSIGNING 0x04 /* a complex (not simplex JOF_ASSIGNING) op
|
||||
#define JSFRAME_CONSTRUCTING 0x01 /* frame is for a constructor invocation */
|
||||
#define JSFRAME_INTERNAL 0x02 /* internal call, not invoked by a script */
|
||||
#define JSFRAME_ASSIGNING 0x04 /* a complex (not simplex JOF_ASSIGNING) op
|
||||
is currently assigning to a property */
|
||||
#define JSFRAME_DEBUGGER 0x08 /* frame for JS_EvaluateInStackFrame */
|
||||
#define JSFRAME_EVAL 0x10 /* frame for obj_eval */
|
||||
#define JSFRAME_SCRIPT_OBJECT 0x20 /* compiling source for a Script object */
|
||||
#define JSFRAME_YIELDING 0x40 /* js_Interpret dispatched JSOP_YIELD */
|
||||
#define JSFRAME_ITERATOR 0x80 /* trying to get an iterator for for-in */
|
||||
#define JSFRAME_POP_BLOCKS 0x100 /* scope chain contains blocks to pop */
|
||||
#define JSFRAME_GENERATOR 0x200 /* frame belongs to generator-iterator */
|
||||
#define JSFRAME_ROOTED_ARGV 0x400 /* frame.argv is rooted by the caller */
|
||||
#define JSFRAME_DEBUGGER 0x08 /* frame for JS_EvaluateInStackFrame */
|
||||
#define JSFRAME_EVAL 0x10 /* frame for obj_eval */
|
||||
#define JSFRAME_SCRIPT_OBJECT 0x20 /* compiling source for a Script object */
|
||||
#define JSFRAME_YIELDING 0x40 /* js_Interpret dispatched JSOP_YIELD */
|
||||
#define JSFRAME_ITERATOR 0x80 /* trying to get an iterator for for-in */
|
||||
#define JSFRAME_POP_BLOCKS 0x100 /* scope chain contains blocks to pop */
|
||||
#define JSFRAME_GENERATOR 0x200 /* frame belongs to generator-iterator */
|
||||
#define JSFRAME_ROOTED_ARGV 0x400 /* frame.argv is rooted by the caller */
|
||||
#define JSFRAME_COMPUTED_THIS 0x800 /* frame.thisp was computed already */
|
||||
|
||||
#define JSFRAME_OVERRIDE_SHIFT 24 /* override bit-set params; see jsfun.c */
|
||||
#define JSFRAME_OVERRIDE_BITS 8
|
||||
|
|
|
@ -391,7 +391,7 @@ num_valueOf(JSContext *cx, uintN argc, jsval *vp)
|
|||
*vp = v;
|
||||
return JS_TRUE;
|
||||
}
|
||||
obj = JSVAL_TO_OBJECT(v);
|
||||
obj = JS_THIS_OBJECT(cx, vp);
|
||||
if (!JS_InstanceOf(cx, obj, &js_NumberClass, vp + 2))
|
||||
return JS_FALSE;
|
||||
*vp = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE);
|
||||
|
|
Загрузка…
Ссылка в новой задаче