Hack special frame flags into fp when compiling under JS_Evaluate*InStackFrame, so useless expressions don't get optimized away (92087, r=rginda, sr=jband).

This commit is contained in:
brendan%mozilla.org 2002-02-12 07:44:48 +00:00
Родитель 6c0be2f899
Коммит 220ffd5fbc
1 изменённых файлов: 11 добавлений и 1 удалений

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

@ -738,15 +738,25 @@ JS_EvaluateUCInStackFrame(JSContext *cx, JSStackFrame *fp,
const char *filename, uintN lineno,
jsval *rval)
{
uint32 flags;
JSScript *script;
JSBool ok;
/*
* XXX Hack around ancient compiler API to propagate the JSFRAME_SPECIAL
* flags to the code generator (see js_EmitTree's TOK_SEMI case).
*/
flags = fp->flags;
fp->flags |= JSFRAME_DEBUGGER | JSFRAME_EVAL;
script = JS_CompileUCScriptForPrincipals(cx, fp->scopeChain,
fp->script ? fp->script->principals
fp->script
? fp->script->principals
: NULL,
bytes, length, filename, lineno);
fp->flags = flags;
if (!script)
return JS_FALSE;
ok = js_Execute(cx, fp->scopeChain, script, fp,
JSFRAME_DEBUGGER | JSFRAME_EVAL, rval);
js_DestroyScript(cx, script);