mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-08 12:37:37 +00:00
Bug 554955: Introduce a typed accessor for retrieving functions from JSFunctionBoxes. r=brendan
This commit is contained in:
parent
1b3b57d96b
commit
427569d433
@ -4572,7 +4572,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
}
|
||||
#endif
|
||||
|
||||
fun = (JSFunction *) pn->pn_funbox->object;
|
||||
fun = pn->pn_funbox->function();
|
||||
JS_ASSERT(FUN_INTERPRETED(fun));
|
||||
if (fun->u.i.script) {
|
||||
/*
|
||||
|
@ -312,7 +312,7 @@ Parser::newFunctionBox(JSObject *obj, JSParseNode *fn, JSTreeContext *tc)
|
||||
bool
|
||||
JSFunctionBox::joinable() const
|
||||
{
|
||||
return FUN_NULL_CLOSURE((JSFunction *) object) &&
|
||||
return FUN_NULL_CLOSURE(function()) &&
|
||||
!(tcflags & (TCF_FUN_USES_ARGUMENTS | TCF_FUN_USES_OWN_NAME));
|
||||
}
|
||||
|
||||
@ -1182,7 +1182,7 @@ Compiler::defineGlobals(JSContext *cx, GlobalScope &globalScope, JSScript *scrip
|
||||
Value rval;
|
||||
|
||||
if (def.funbox) {
|
||||
JSFunction *fun = (JSFunction *)def.funbox->object;
|
||||
JSFunction *fun = def.funbox->function();
|
||||
|
||||
/*
|
||||
* No need to check for redeclarations or anything, global
|
||||
@ -2089,7 +2089,7 @@ FindFunArgs(JSFunctionBox *funbox, int level, JSFunctionBoxQueue *queue)
|
||||
do {
|
||||
JSParseNode *fn = funbox->node;
|
||||
JS_ASSERT(fn->pn_arity == PN_FUNC);
|
||||
JSFunction *fun = (JSFunction *) funbox->object;
|
||||
JSFunction *fun = funbox->function();
|
||||
int fnlevel = level;
|
||||
|
||||
/*
|
||||
@ -2355,7 +2355,7 @@ CanFlattenUpvar(JSDefinition *dn, JSFunctionBox *funbox, uint32 tcflags)
|
||||
* function refers to its own name) or strictly after afunbox, we also
|
||||
* defeat the flat closure optimization for this dn.
|
||||
*/
|
||||
JSFunction *afun = (JSFunction *) afunbox->object;
|
||||
JSFunction *afun = afunbox->function();
|
||||
if (!(afun->flags & JSFUN_LAMBDA)) {
|
||||
if (dn->isBindingForm() || dn->pn_pos >= afunbox->node->pn_pos)
|
||||
return false;
|
||||
@ -2501,7 +2501,7 @@ Parser::setFunctionKinds(JSFunctionBox *funbox, uint32 *tcflags)
|
||||
}
|
||||
}
|
||||
|
||||
JSFunction *fun = (JSFunction *) funbox->object;
|
||||
JSFunction *fun = funbox->function();
|
||||
|
||||
JS_ASSERT(FUN_KIND(fun) == JSFUN_INTERPRETED);
|
||||
|
||||
@ -3169,7 +3169,7 @@ Parser::functionDef(JSAtom *funAtom, FunctionType type, uintN lambda)
|
||||
if (!funbox)
|
||||
return NULL;
|
||||
|
||||
JSFunction *fun = (JSFunction *) funbox->object;
|
||||
JSFunction *fun = funbox->function();
|
||||
|
||||
/* Now parse formal argument list and compute fun->nargs. */
|
||||
JSParseNode *prelude = NULL;
|
||||
@ -7499,7 +7499,7 @@ CheckForImmediatelyAppliedLambda(JSParseNode *pn)
|
||||
JS_ASSERT(pn->pn_arity == PN_FUNC);
|
||||
|
||||
JSFunctionBox *funbox = pn->pn_funbox;
|
||||
JS_ASSERT(((JSFunction *) funbox->object)->flags & JSFUN_LAMBDA);
|
||||
JS_ASSERT((funbox->function())->flags & JSFUN_LAMBDA);
|
||||
if (!(funbox->tcflags & (TCF_FUN_USES_ARGUMENTS | TCF_FUN_USES_OWN_NAME)))
|
||||
pn->pn_dflags &= ~PND_FUNARG;
|
||||
}
|
||||
|
@ -974,6 +974,8 @@ struct JSFunctionBox : public JSObjectBox
|
||||
level:JSFB_LEVEL_BITS;
|
||||
uint32 tcflags;
|
||||
|
||||
JSFunction *function() const { return (JSFunction *) object; }
|
||||
|
||||
bool joinable() const;
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user