Misc. cleanup.

This commit is contained in:
Brendan Eich
2008-08-03 01:34:07 -07:00
parent a499367e56
commit 5fa2c21375
2 changed files with 15 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set sw=4 ts=8 et tw=78:
* vim: set sw=4 ts=8 et tw=99:
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
@@ -5147,11 +5147,11 @@ js_ReconstructStackDepth(JSContext *cx, JSScript *script, jsbytecode *pc)
}
static intN
ReconstructPCStack(JSContext *cx, JSScript *script, jsbytecode *pc,
ReconstructPCStack(JSContext *cx, JSScript *script, jsbytecode *target,
jsbytecode **pcstack)
{
intN pcdepth, nuses, ndefs;
jsbytecode *begin;
jsbytecode *pc;
JSOp op;
const JSCodeSpec *cs;
ptrdiff_t oplen;
@@ -5167,10 +5167,9 @@ ReconstructPCStack(JSContext *cx, JSScript *script, jsbytecode *pc,
* FIXME: Code to compute oplen copied from js_Disassemble1 and reduced.
* FIXME: Optimize to use last empty-stack sequence point.
*/
LOCAL_ASSERT(script->main <= pc && pc < script->code + script->length);
LOCAL_ASSERT(script->main <= target && target < script->code + script->length);
pcdepth = 0;
begin = pc;
for (pc = script->main; pc < begin; pc += oplen) {
for (pc = script->main; pc < target; pc += oplen) {
op = (JSOp) *pc;
if (op == JSOP_TRAP)
op = JS_GetTrapOpcode(cx, script, pc);
@@ -5194,8 +5193,8 @@ ReconstructPCStack(JSContext *cx, JSScript *script, jsbytecode *pc,
}
/*
* A (C ? T : E) expression requires skipping either T (if begin is in
* E) or both T and E (if begin is after the whole expression) before
* A (C ? T : E) expression requires skipping either T (if target is in
* E) or both T and E (if target is after the whole expression) before
* adjusting pcdepth based on the JSOP_IFEQ or JSOP_IFEQX at pc that
* tests condition C. We know that the stack depth can't change from
* what it was with C on top of stack.
@@ -5205,7 +5204,7 @@ ReconstructPCStack(JSContext *cx, JSScript *script, jsbytecode *pc,
ptrdiff_t jmpoff, jmplen;
jmpoff = js_GetSrcNoteOffset(sn, 0);
if (pc + jmpoff < begin) {
if (pc + jmpoff < target) {
pc += jmpoff;
op = (JSOp) *pc;
JS_ASSERT(op == JSOP_GOTO || op == JSOP_GOTOX);
@@ -5213,13 +5212,13 @@ ReconstructPCStack(JSContext *cx, JSScript *script, jsbytecode *pc,
oplen = cs->length;
JS_ASSERT(oplen > 0);
jmplen = GetJumpOffset(pc, pc);
if (pc + jmplen < begin) {
if (pc + jmplen < target) {
oplen = (uintN) jmplen;
continue;
}
/*
* Ok, begin lies in E. Manually pop C off the model stack,
* Ok, target lies in E. Manually pop C off the model stack,
* since we have moved beyond the IFEQ now.
*/
--pcdepth;
@@ -5315,7 +5314,7 @@ ReconstructPCStack(JSContext *cx, JSScript *script, jsbytecode *pc,
}
pcdepth += ndefs;
}
LOCAL_ASSERT(pc == begin);
LOCAL_ASSERT(pc == target);
return pcdepth;
#undef LOCAL_ASSERT