mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Prefer getarg;length, etc. to getargprop.
This commit is contained in:
parent
9182a834c4
commit
13d6469f9b
@ -43,8 +43,10 @@
|
||||
# Just ripped from Linux config
|
||||
#
|
||||
|
||||
CC = gcc-4.2
|
||||
CXX = g++-4.2
|
||||
#CC = gcc-4.2
|
||||
#CXX = g++-4.2
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
CFLAGS += -Wall -Wno-format -MMD
|
||||
OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DDARWIN
|
||||
|
||||
|
@ -2308,46 +2308,48 @@ EmitPropOp(JSContext *cx, JSParseNode *pn, JSOp op, JSCodeGenerator *cg,
|
||||
op = JSOP_CALLPROP;
|
||||
} else if (op == JSOP_GETPROP && pn->pn_type == TOK_DOT) {
|
||||
if (pn2->pn_op == JSOP_THIS) {
|
||||
/* Fast path for gets of |this.foo|. */
|
||||
return EmitAtomOp(cx, pn, JSOP_GETTHISPROP, cg);
|
||||
}
|
||||
|
||||
if (pn2->pn_type == TOK_NAME) {
|
||||
if (pn->pn_atom != cx->runtime->atomState.lengthAtom ) {
|
||||
/* Fast path for gets of |this.foo|. */
|
||||
return EmitAtomOp(cx, pn, JSOP_GETTHISPROP, cg);
|
||||
}
|
||||
} else if (pn2->pn_type == TOK_NAME) {
|
||||
/*
|
||||
* Try to optimize:
|
||||
* - arguments.length into JSOP_ARGCNT
|
||||
* - argname.prop into JSOP_GETARGPROP
|
||||
* - varname.prop into JSOP_GETVARPROP
|
||||
* - localname.prop into JSOP_GETLOCALPROP
|
||||
* but don't do this if the property is 'length' -- prefer to emit
|
||||
* JSOP_GETARG, etc., and then JSOP_LENGTH.
|
||||
*/
|
||||
if (!BindNameToSlot(cx, cg, pn2, 0))
|
||||
return JS_FALSE;
|
||||
switch (pn2->pn_op) {
|
||||
case JSOP_ARGUMENTS:
|
||||
if (pn->pn_atom == cx->runtime->atomState.lengthAtom)
|
||||
if (pn->pn_atom == cx->runtime->atomState.lengthAtom) {
|
||||
if (pn2->pn_op == JSOP_ARGUMENTS)
|
||||
return js_Emit1(cx, cg, JSOP_ARGCNT) >= 0;
|
||||
break;
|
||||
} else {
|
||||
switch (pn2->pn_op) {
|
||||
case JSOP_GETARG:
|
||||
op = JSOP_GETARGPROP;
|
||||
goto do_indexconst;
|
||||
case JSOP_GETVAR:
|
||||
op = JSOP_GETVARPROP;
|
||||
goto do_indexconst;
|
||||
case JSOP_GETLOCAL:
|
||||
op = JSOP_GETLOCALPROP;
|
||||
do_indexconst: {
|
||||
JSAtomListElement *ale;
|
||||
jsatomid atomIndex;
|
||||
|
||||
case JSOP_GETARG:
|
||||
op = JSOP_GETARGPROP;
|
||||
goto do_indexconst;
|
||||
case JSOP_GETVAR:
|
||||
op = JSOP_GETVARPROP;
|
||||
goto do_indexconst;
|
||||
case JSOP_GETLOCAL:
|
||||
op = JSOP_GETLOCALPROP;
|
||||
do_indexconst: {
|
||||
JSAtomListElement *ale;
|
||||
jsatomid atomIndex;
|
||||
ale = js_IndexAtom(cx, pn->pn_atom, &cg->atomList);
|
||||
if (!ale)
|
||||
return JS_FALSE;
|
||||
atomIndex = ALE_INDEX(ale);
|
||||
return EmitSlotIndexOp(cx, op, pn2->pn_slot, atomIndex, cg);
|
||||
}
|
||||
|
||||
ale = js_IndexAtom(cx, pn->pn_atom, &cg->atomList);
|
||||
if (!ale)
|
||||
return JS_FALSE;
|
||||
atomIndex = ALE_INDEX(ale);
|
||||
return EmitSlotIndexOp(cx, op, pn2->pn_slot, atomIndex, cg);
|
||||
}
|
||||
|
||||
default:;
|
||||
default:;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1102,6 +1102,7 @@ js_LoopEdge(JSContext* cx)
|
||||
/* setup the VM-private FragmentInfo structure for this fragment */
|
||||
fi = new VMFragmentInfo(); // TODO: deallocate when fragment dies
|
||||
f->vmprivate = fi;
|
||||
|
||||
/* create the list of global properties we want to intern */
|
||||
int internableGlobals = findInternableGlobals(cx, cx->fp, NULL);
|
||||
if (internableGlobals < 0)
|
||||
@ -1110,7 +1111,8 @@ js_LoopEdge(JSContext* cx)
|
||||
if ((fi->ngslots = findInternableGlobals(cx, cx->fp, fi->gslots)) < 0)
|
||||
return false;
|
||||
fi->globalShape = OBJ_SCOPE(JS_GetGlobalForObject(cx,
|
||||
cx->fp->scopeChain))->shape;
|
||||
cx->fp->scopeChain))->shape;
|
||||
|
||||
/* determine the native frame layout at the entry point */
|
||||
unsigned entryNativeFrameSlots = nativeFrameSlots(fi->ngslots,
|
||||
cx->fp, cx->fp, *cx->fp->regs);
|
||||
@ -1119,9 +1121,11 @@ js_LoopEdge(JSContext* cx)
|
||||
(cx->fp->regs->sp - cx->fp->spbase)) * sizeof(double);
|
||||
fi->maxNativeFrameSlots = entryNativeFrameSlots;
|
||||
fi->maxCallDepth = 0;
|
||||
|
||||
/* build the entry type map */
|
||||
fi->typeMap = (uint8*)malloc(fi->entryNativeFrameSlots * sizeof(uint8));
|
||||
uint8* m = fi->typeMap;
|
||||
|
||||
/* remember the coerced type of each active slot in the type map */
|
||||
FORALL_SLOTS_IN_PENDING_FRAMES(cx, fi->ngslots, fi->gslots, cx->fp, cx->fp,
|
||||
*m++ = getCoercedType(*vp)
|
||||
|
Loading…
Reference in New Issue
Block a user