Back out patch for bug 431465 due to unit test failures

This commit is contained in:
gavin@gavinsharp.com 2008-05-01 16:06:43 -07:00
Родитель 4c968d63fd
Коммит 9ee89638cd
2 изменённых файлов: 17 добавлений и 51 удалений

Просмотреть файл

@ -105,8 +105,7 @@ js_UntrapScriptCode(JSContext *cx, JSScript *script)
for (trap = (JSTrap *)rt->trapList.next;
trap != (JSTrap *)&rt->trapList;
trap = (JSTrap *)trap->links.next) {
if (trap->script == script &&
(size_t)(trap->pc - script->code) < script->length) {
if (trap->script == script) {
if (code == script->code) {
jssrcnote *sn, *notes;
size_t nbytes;

Просмотреть файл

@ -4617,7 +4617,7 @@ DecompileCode(JSPrinter *jp, JSScript *script, jsbytecode *pc, uintN len,
code = js_UntrapScriptCode(cx, jp->script);
if (code != oldcode) {
jp->script->code = code;
jp->script->main = code + (oldmain - oldcode);
jp->script->main = code + (oldmain - jp->script->code);
pc = code + (pc - oldcode);
}
@ -4907,7 +4907,6 @@ static char *
DecompileExpression(JSContext *cx, JSScript *script, JSFunction *fun,
jsbytecode *pc)
{
jsbytecode *code, *oldcode, *oldmain;
JSOp op;
const JSCodeSpec *cs;
jsbytecode *begin, *end;
@ -4919,20 +4918,9 @@ DecompileExpression(JSContext *cx, JSScript *script, JSFunction *fun,
char *name;
JS_ASSERT(script->main <= pc && pc < script->code + script->length);
pcstack = NULL;
oldcode = script->code;
oldmain = script->main;
/* From this point the control must flow through the label out. */
code = js_UntrapScriptCode(cx, script);
if (code != oldcode) {
script->code = code;
script->main = code + (oldmain - oldcode);
pc = code + (pc - oldcode);
}
op = (JSOp) *pc;
if (op == JSOP_TRAP)
op = JS_GetTrapOpcode(cx, script, pc);
/* None of these stack-writing ops generates novel values. */
JS_ASSERT(op != JSOP_CASE && op != JSOP_CASEX &&
@ -4943,10 +4931,8 @@ DecompileExpression(JSContext *cx, JSScript *script, JSFunction *fun,
* |this| could convert to a very long object initialiser, so cite it by
* its keyword name instead.
*/
if (op == JSOP_THIS) {
name = JS_strdup(cx, js_this_str);
goto out;
}
if (op == JSOP_THIS)
return JS_strdup(cx, js_this_str);
/*
* JSOP_BINDNAME is special: it generates a value, the base object of a
@ -4954,13 +4940,10 @@ DecompileExpression(JSContext *cx, JSScript *script, JSFunction *fun,
* js_DecompileValueGenerator, the name being bound is irrelevant. Just
* fall back to the base object.
*/
if (op == JSOP_BINDNAME) {
name = FAILED_EXPRESSION_DECOMPILER;
goto out;
}
if (op == JSOP_BINDNAME)
return FAILED_EXPRESSION_DECOMPILER;
/* NAME ops are self-contained, others require left or right context. */
name = NULL;
cs = &js_CodeSpec[op];
begin = pc;
end = pc + cs->length;
@ -4971,8 +4954,7 @@ DecompileExpression(JSContext *cx, JSScript *script, JSFunction *fun,
case 0:
sn = js_GetSrcNote(script, pc);
if (!sn)
name = FAILED_EXPRESSION_DECOMPILER;
goto out;
return FAILED_EXPRESSION_DECOMPILER;
switch (SN_TYPE(sn)) {
case SRC_PCBASE:
begin -= js_GetSrcNoteOffset(sn, 0);
@ -4982,23 +4964,18 @@ DecompileExpression(JSContext *cx, JSScript *script, JSFunction *fun,
begin += cs->length;
break;
default:
name = FAILED_EXPRESSION_DECOMPILER;
goto out;
return FAILED_EXPRESSION_DECOMPILER;
}
break;
default:;
}
len = PTRDIFF(end, begin, jsbytecode);
if (len <= 0) {
name = FAILED_EXPRESSION_DECOMPILER;
goto out;
}
if (len <= 0)
return FAILED_EXPRESSION_DECOMPILER;
pcstack = (jsbytecode **) JS_malloc(cx, script->depth * sizeof *pcstack);
if (!pcstack) {
name = NULL;
goto out;
}
if (!pcstack)
return NULL;
/* From this point the control must flow through the label out. */
pcdepth = ReconstructPCStack(cx, script, begin, pcstack);
@ -5007,6 +4984,7 @@ DecompileExpression(JSContext *cx, JSScript *script, JSFunction *fun,
goto out;
}
name = NULL;
jp = JS_NEW_PRINTER(cx, "js_DecompileValueGenerator", fun, 0, JS_FALSE);
if (jp) {
jp->dvgfence = end;
@ -5019,14 +4997,7 @@ DecompileExpression(JSContext *cx, JSScript *script, JSFunction *fun,
}
out:
if (code != oldcode) {
JS_free(cx, script->code);
script->code = oldcode;
script->main = oldmain;
}
if (pcstack)
JS_free(cx, pcstack);
JS_free(cx, pcstack);
return name;
}
@ -5227,11 +5198,7 @@ ReconstructPCStack(JSContext *cx, JSScript *script, jsbytecode *pc,
JS_ASSERT(ndefs == 0);
LOCAL_ASSERT(pcdepth >= 1);
LOCAL_ASSERT(nuses == 0 ||
*pcstack[pcdepth - 1] == JSOP_ENTERBLOCK ||
(*pcstack[pcdepth - 1] == JSOP_TRAP &&
JS_GetTrapOpcode(cx, script,
pcstack[pcdepth - 1]) ==
JSOP_ENTERBLOCK));
*pcstack[pcdepth - 1] == JSOP_ENTERBLOCK);
pcstack[pcdepth - 1] = pc;
break;
}