This commit is contained in:
Robert Sayre 2009-05-21 00:09:41 -04:00
commit 92002a43da
3 changed files with 46 additions and 30 deletions

View File

@ -6206,8 +6206,8 @@ js_DumpStackFrame(JSStackFrame *fp)
fprintf(stderr, " current op: %s\n", js_CodeName[*pc]);
}
if (sp && fp->slots) {
fprintf(stderr, " slots: %p\n", fp->slots);
fprintf(stderr, " sp: %p = slots + %u\n", sp, (unsigned) (sp - fp->slots));
fprintf(stderr, " slots: %p\n", (void *) fp->slots);
fprintf(stderr, " sp: %p = slots + %u\n", (void *) sp, (unsigned) (sp - fp->slots));
if (sp - fp->slots < 10000) { // sanity
for (jsval *p = fp->slots; p < sp; p++) {
fprintf(stderr, " %p: ", (void *) p);
@ -6219,7 +6219,7 @@ js_DumpStackFrame(JSStackFrame *fp)
fprintf(stderr, " sp: %p\n", (void *) sp);
fprintf(stderr, " slots: %p\n", (void *) fp->slots);
}
fprintf(stderr, " argv: %p (argc: %u)\n", fp->argv, (unsigned) fp->argc);
fprintf(stderr, " argv: %p (argc: %u)\n", (void *) fp->argv, (unsigned) fp->argc);
MaybeDumpObject("callobj", fp->callobj);
MaybeDumpObject("argsobj", fp->argsobj);
MaybeDumpObject("varobj", fp->varobj);
@ -6261,12 +6261,12 @@ js_DumpStackFrame(JSStackFrame *fp)
if (fp->sharpDepth)
fprintf(stderr, " sharpDepth: %u\n", (unsigned) fp->sharpDepth);
if (fp->xmlNamespace)
fprintf(stderr, " xmlNamespace: (JSObject *) %p\n", fp->xmlNamespace);
fprintf(stderr, " xmlNamespace: (JSObject *) %p\n", (void *) fp->xmlNamespace);
if (fp->dormantNext)
fprintf(stderr, " dormantNext: (JSStackFrame *) %p\n", fp->dormantNext);
fprintf(stderr, " dormantNext: (JSStackFrame *) %p\n", (void *) fp->dormantNext);
if (fp->displaySave)
fprintf(stderr, " displaySave: (JSStackFrame *) %p\n", fp->displaySave);
fprintf(stderr, " displaySave: (JSStackFrame *) %p\n", (void *) fp->displaySave);
fputc('\n', stderr);
}

View File

@ -1928,21 +1928,44 @@ skip:
--n;
if (fp->callee) {
/*
* We might return from trace with a different function object, but it still
* has to be the same function (FIXME: bug 471425, eliminate fp->callee).
* We might return from trace with a different callee object, but it still
* has to be the same JSFunction (FIXME: bug 471425, eliminate fp->callee).
*/
JS_ASSERT(JSVAL_IS_OBJECT(fp->argv[-1]));
JS_ASSERT(HAS_FUNCTION_CLASS(JSVAL_TO_OBJECT(fp->argv[-2])));
JS_ASSERT(GET_FUNCTION_PRIVATE(cx, JSVAL_TO_OBJECT(fp->argv[-2])) ==
GET_FUNCTION_PRIVATE(cx, fp->callee));
JS_ASSERT(GET_FUNCTION_PRIVATE(cx, fp->callee) == fp->fun);
fp->callee = JSVAL_TO_OBJECT(fp->argv[-2]);
/*
* SynthesizeFrame sets scopeChain to NULL, because we can't calculate the
* correct scope chain until we have the final callee. Calculate the real
* scope object here.
*/
if (!fp->scopeChain)
if (!fp->scopeChain) {
fp->scopeChain = OBJ_GET_PARENT(cx, fp->callee);
if (fp->fun->flags & JSFUN_HEAVYWEIGHT) {
/*
* Set hookData to null because the failure case for js_GetCallObject
* involves it calling the debugger hook.
*
* Allocating the Call object must not fail, so use an object
* previously reserved by js_ExecuteTree if needed.
*/
void* hookData = ((JSInlineFrame*)fp)->hookData;
((JSInlineFrame*)fp)->hookData = NULL;
JS_ASSERT(!JS_TRACE_MONITOR(cx).useReservedObjects);
JS_TRACE_MONITOR(cx).useReservedObjects = JS_TRUE;
#ifdef DEBUG
JSObject *obj =
#endif
js_GetCallObject(cx, fp);
JS_ASSERT(obj);
JS_TRACE_MONITOR(cx).useReservedObjects = JS_FALSE;
((JSInlineFrame*)fp)->hookData = hookData;
}
}
fp->thisp = JSVAL_TO_OBJECT(fp->argv[-1]);
if (fp->flags & JSFRAME_CONSTRUCTING) // constructors always compute 'this'
fp->flags |= JSFRAME_COMPUTED_THIS;
@ -3609,33 +3632,13 @@ js_SynthesizeFrame(JSContext* cx, const FrameInfo& fi)
fp->regs = &newifp->callerRegs;
fp = cx->fp = &newifp->frame;
if (fun->flags & JSFUN_HEAVYWEIGHT) {
/*
* Set hookData to null because the failure case for js_GetCallObject
* involves it calling the debugger hook.
*
* Allocating the Call object must not fail, so use an object
* previously reserved by js_ExecuteTree if needed.
*/
newifp->hookData = NULL;
JS_ASSERT(!JS_TRACE_MONITOR(cx).useReservedObjects);
JS_TRACE_MONITOR(cx).useReservedObjects = JS_TRUE;
#ifdef DEBUG
JSObject *obj =
#endif
js_GetCallObject(cx, &newifp->frame);
JS_ASSERT(obj);
JS_TRACE_MONITOR(cx).useReservedObjects = JS_FALSE;
}
/*
* If there's a call hook, invoke it to compute the hookData used by
* debuggers that cooperate with the interpreter.
*/
JSInterpreterHook hook = cx->debugHooks->callHook;
if (hook) {
newifp->hookData = hook(cx, &newifp->frame, JS_TRUE, 0,
cx->debugHooks->callHookData);
newifp->hookData = hook(cx, fp, JS_TRUE, 0, cx->debugHooks->callHookData);
} else {
newifp->hookData = NULL;
}

View File

@ -5221,6 +5221,19 @@ function testNewArrayCount2() {
testNewArrayCount2.expected = 3;
test(testNewArrayCount2);
function testGetCallObjInlined(i) {
if (i > 7) eval("1");
return 1;
}
function testGetCallObj() {
for (var i = 0; i < 10; ++i)
testGetCallObjInlined(i);
return "ok";
}
testGetCallObj.expected = "ok";
test(testGetCallObj);
/*****************************************************************************
* *
* _____ _ _ _____ ______ _____ _______ *