mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-03 15:26:07 +00:00
Bug 658055 - Always use getter to access fun->script() (r=dmandelin)
This commit is contained in:
parent
c7c211afea
commit
d9f673cde1
@ -4250,7 +4250,7 @@ JS_CloneFunctionObject(JSContext *cx, JSObject *funobj, JSObject *parent)
|
||||
if (!clone)
|
||||
return NULL;
|
||||
|
||||
JSUpvarArray *uva = fun->u.i.script->upvars();
|
||||
JSUpvarArray *uva = fun->script()->upvars();
|
||||
uint32 i = uva->length;
|
||||
JS_ASSERT(i != 0);
|
||||
|
||||
|
@ -488,7 +488,7 @@ DumpFunctionCountMap(const char *title, JSRuntime::FunctionCountMap &map, FILE *
|
||||
JSFunction *fun = r.front().key;
|
||||
int32 count = r.front().value;
|
||||
|
||||
fprintf(fp, "%10d %s:%u\n", count, fun->u.i.script->filename, fun->u.i.script->lineno);
|
||||
fprintf(fp, "%10d %s:%u\n", count, fun->script()->filename, fun->script()->lineno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1899,7 +1899,7 @@ JS_GetFunctionTotalSize(JSContext *cx, JSFunction *fun)
|
||||
nbytes = sizeof *fun;
|
||||
nbytes += JS_GetObjectTotalSize(cx, FUN_OBJECT(fun));
|
||||
if (FUN_INTERPRETED(fun))
|
||||
nbytes += JS_GetScriptTotalSize(cx, fun->u.i.script);
|
||||
nbytes += JS_GetScriptTotalSize(cx, fun->script());
|
||||
if (fun->atom)
|
||||
nbytes += GetAtomTotalSize(cx, fun->atom);
|
||||
return nbytes;
|
||||
|
@ -4581,7 +4581,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
|
||||
fun = pn->pn_funbox->function();
|
||||
JS_ASSERT(FUN_INTERPRETED(fun));
|
||||
if (fun->u.i.script) {
|
||||
if (fun->script()) {
|
||||
/*
|
||||
* This second pass is needed to emit JSOP_NOP with a source note
|
||||
* for the already-emitted function definition prolog opcode. See
|
||||
|
@ -2339,7 +2339,7 @@ fun_isGenerator(JSContext *cx, uintN argc, Value *vp)
|
||||
|
||||
bool result = false;
|
||||
if (fun->isInterpreted()) {
|
||||
JSScript *script = fun->u.i.script;
|
||||
JSScript *script = fun->script();
|
||||
JS_ASSERT(script->length != 0);
|
||||
result = script->code[0] == JSOP_GENERATOR;
|
||||
}
|
||||
@ -2780,13 +2780,13 @@ js_CloneFunctionObject(JSContext *cx, JSFunction *fun, JSObject *parent,
|
||||
cfun->atom = fun->atom;
|
||||
clone->setPrivate(cfun);
|
||||
if (cfun->isInterpreted()) {
|
||||
JSScript *script = cfun->u.i.script;
|
||||
JSScript *script = cfun->script();
|
||||
JS_ASSERT(script);
|
||||
JS_ASSERT(script->compartment == fun->compartment());
|
||||
JS_ASSERT(script->compartment != cx->compartment);
|
||||
|
||||
cfun->u.i.script = js_CloneScript(cx, script);
|
||||
if (!cfun->u.i.script)
|
||||
if (!cfun->script())
|
||||
return NULL;
|
||||
#ifdef CHECK_SCRIPT_OWNER
|
||||
cfun->script()->owner = NULL;
|
||||
@ -2855,7 +2855,7 @@ js_NewFlatClosure(JSContext *cx, JSFunction *fun, JSOp op, size_t oplen)
|
||||
return closure;
|
||||
|
||||
Value *upvars = closure->getFlatClosureUpvars();
|
||||
uintN level = fun->u.i.script->staticLevel;
|
||||
uintN level = fun->script()->staticLevel;
|
||||
JSUpvarArray *uva = fun->script()->upvars();
|
||||
|
||||
for (uint32 i = 0, n = uva->length; i < n; i++)
|
||||
|
@ -107,7 +107,7 @@
|
||||
#define FUN_INTERPRETED(fun) (FUN_KIND(fun) >= JSFUN_INTERPRETED)
|
||||
#define FUN_FLAT_CLOSURE(fun)(FUN_KIND(fun) == JSFUN_FLAT_CLOSURE)
|
||||
#define FUN_NULL_CLOSURE(fun)(FUN_KIND(fun) == JSFUN_NULL_CLOSURE)
|
||||
#define FUN_SCRIPT(fun) (FUN_INTERPRETED(fun) ? (fun)->u.i.script : NULL)
|
||||
#define FUN_SCRIPT(fun) (FUN_INTERPRETED(fun) ? (fun)->script() : NULL)
|
||||
#define FUN_CLASP(fun) (JS_ASSERT(!FUN_INTERPRETED(fun)), \
|
||||
fun->u.n.clasp)
|
||||
#define FUN_TRCINFO(fun) (JS_ASSERT(!FUN_INTERPRETED(fun)), \
|
||||
|
@ -4555,7 +4555,7 @@ BEGIN_CASE(JSOP_NEW)
|
||||
if (IsFunctionObject(vp[0], &callee)) {
|
||||
newfun = callee->getFunctionPrivate();
|
||||
if (newfun->isInterpretedConstructor()) {
|
||||
if (newfun->u.i.script->isEmpty()) {
|
||||
if (newfun->script()->isEmpty()) {
|
||||
JSObject *obj2 = js_CreateThisForFunction(cx, callee);
|
||||
if (!obj2)
|
||||
goto error;
|
||||
|
@ -4968,7 +4968,7 @@ js_DecompileFunctionBody(JSPrinter *jp)
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
script = jp->fun->u.i.script;
|
||||
script = jp->fun->script();
|
||||
return DecompileBody(jp, script, script->code);
|
||||
}
|
||||
|
||||
@ -5009,7 +5009,7 @@ js_DecompileFunction(JSPrinter *jp)
|
||||
jp->indent -= 4;
|
||||
js_printf(jp, "\t}");
|
||||
} else {
|
||||
JSScript *script = fun->u.i.script;
|
||||
JSScript *script = fun->script();
|
||||
#if JS_HAS_DESTRUCTURING
|
||||
SprintStack ss;
|
||||
void *mark;
|
||||
|
@ -1229,7 +1229,7 @@ Compiler::defineGlobals(JSContext *cx, GlobalScope &globalScope, JSScript *scrip
|
||||
continue;
|
||||
JSFunction *fun = obj->getFunctionPrivate();
|
||||
JS_ASSERT(fun->isInterpreted());
|
||||
JSScript *inner = fun->u.i.script;
|
||||
JSScript *inner = fun->script();
|
||||
if (!JSScript::isValidOffset(inner->globalsOffset) &&
|
||||
!JSScript::isValidOffset(inner->objectsOffset)) {
|
||||
continue;
|
||||
|
@ -1674,7 +1674,7 @@ js_PCToLineNumber(JSContext *cx, JSScript *script, jsbytecode *pc)
|
||||
pc += js_CodeSpec[op].length;
|
||||
if (*pc == JSOP_DEFFUN) {
|
||||
GET_FUNCTION_FROM_BYTECODE(script, pc, 0, fun);
|
||||
return fun->u.i.script->lineno;
|
||||
return fun->script()->lineno;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2503,7 +2503,7 @@ js::str_replace(JSContext *cx, uintN argc, Value *vp)
|
||||
* encode large scripts. We only handle the code patterns generated
|
||||
* by such packers here.
|
||||
*/
|
||||
JSScript *script = fun->u.i.script;
|
||||
JSScript *script = fun->script();
|
||||
jsbytecode *pc = script->code;
|
||||
|
||||
Value table = UndefinedValue();
|
||||
|
@ -3271,7 +3271,7 @@ GetUpvarOnTrace(JSContext* cx, uint32 upvarLevel, int32 slot, uint32 callDepth,
|
||||
stackOffset -= fi->callerHeight;
|
||||
JSObject* callee = *(JSObject**)(&state->stackBase[stackOffset]);
|
||||
JSFunction* fun = GET_FUNCTION_PRIVATE(cx, callee);
|
||||
uintN calleeLevel = fun->u.i.script->staticLevel;
|
||||
uintN calleeLevel = fun->script()->staticLevel;
|
||||
if (calleeLevel == upvarLevel) {
|
||||
/*
|
||||
* Now find the upvar's value in the native stack. stackOffset is
|
||||
@ -13737,7 +13737,7 @@ TraceRecorder::interpretedFunctionCall(Value& fval, JSFunction* fun, uintN argc,
|
||||
debug_only_print0(LC_TMTracer, "\n");
|
||||
#endif
|
||||
|
||||
updateAtoms(fun->u.i.script);
|
||||
updateAtoms(fun->script());
|
||||
return RECORD_CONTINUE;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user