зеркало из https://github.com/mozilla/gecko-dev.git
Fix useless expression elimination to work with native-function-called JS_EvaluateScript (87271, r=rogerl, sr=jband).
This commit is contained in:
Родитель
f736866828
Коммит
6abf5d1dd4
|
@ -2141,11 +2141,12 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
|||
pn2 = pn->pn_kid;
|
||||
if (pn2) {
|
||||
/*
|
||||
* Top-level JS_Execute/EvaluateScript, debugger, and eval frames
|
||||
* may need the last expression statement's value as the script's
|
||||
* result, even though it appears useless otherwise.
|
||||
* Top-level or called-from-a-native JS_Execute/EvaluateScript,
|
||||
* debugger, and eval frames may need the value of the ultimate
|
||||
* expression statement as the script's result, despite the fact
|
||||
* that it appears useless to the compiler.
|
||||
*/
|
||||
useful = !cx->fp->fun || cx->fp->special;
|
||||
useful = !cx->fp->fun || cx->fp->fun->native || cx->fp->special;
|
||||
if (!useful) {
|
||||
if (!CheckSideEffects(cx, &cg->treeContext, pn2, &useful))
|
||||
return JS_FALSE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче