mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-05 00:25:27 +00:00
Merge.
This commit is contained in:
commit
cac6830023
@ -234,6 +234,7 @@ Process(JSContext *cx, JSObject *obj, char *filename, JSBool forceTTY)
|
||||
int lineno;
|
||||
int startline;
|
||||
FILE *file;
|
||||
uint32 oldopts;
|
||||
|
||||
if (forceTTY || !filename || strcmp(filename, "-") == 0) {
|
||||
file = stdin;
|
||||
@ -266,7 +267,11 @@ Process(JSContext *cx, JSObject *obj, char *filename, JSBool forceTTY)
|
||||
}
|
||||
}
|
||||
ungetc(ch, file);
|
||||
|
||||
oldopts = JS_GetOptions(cx);
|
||||
JS_SetOptions(cx, oldopts | JSOPTION_COMPILE_N_GO);
|
||||
script = JS_CompileFileHandle(cx, obj, filename, file);
|
||||
JS_SetOptions(cx, oldopts);
|
||||
if (script) {
|
||||
if (!compileOnly)
|
||||
(void)JS_ExecuteScript(cx, obj, script, &result);
|
||||
@ -650,6 +655,7 @@ Load(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
oldopts = JS_GetOptions(cx);
|
||||
JS_SetOptions(cx, oldopts | JSOPTION_COMPILE_N_GO);
|
||||
script = JS_CompileFile(cx, obj, filename);
|
||||
JS_SetOptions(cx, oldopts);
|
||||
if (!script) {
|
||||
ok = JS_FALSE;
|
||||
} else {
|
||||
@ -658,7 +664,6 @@ Load(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
: JS_TRUE;
|
||||
JS_DestroyScript(cx, script);
|
||||
}
|
||||
JS_SetOptions(cx, oldopts);
|
||||
if (!ok)
|
||||
return JS_FALSE;
|
||||
}
|
||||
@ -1415,6 +1420,7 @@ DisassFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
const char *filename;
|
||||
JSScript *script;
|
||||
JSBool ok;
|
||||
uint32 oldopts;
|
||||
|
||||
if (!argc)
|
||||
return JS_TRUE;
|
||||
@ -1425,7 +1431,10 @@ DisassFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
argv[0] = STRING_TO_JSVAL(str);
|
||||
|
||||
filename = JS_GetStringBytes(str);
|
||||
oldopts = JS_GetOptions(cx);
|
||||
JS_SetOptions(cx, oldopts | JSOPTION_COMPILE_N_GO);
|
||||
script = JS_CompileFile(cx, obj, filename);
|
||||
JS_SetOptions(cx, oldopts);
|
||||
if (!script)
|
||||
return JS_FALSE;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: set ts=8 sw=4 et tw=78:
|
||||
* vim: set ts=8 sw=4 et tw=99:
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
@ -3150,6 +3150,11 @@ js_EmitFunctionScript(JSContext *cx, JSCodeGenerator *cg, JSParseNode *body)
|
||||
CG_SWITCH_TO_MAIN(cg);
|
||||
}
|
||||
|
||||
if (!(cg->treeContext.flags & TCF_FUN_HEAVYWEIGHT) &&
|
||||
(cg->treeContext.flags & TCF_COMPILE_N_GO)) {
|
||||
STOBJ_SET_PARENT(FUN_OBJECT(cg->treeContext.fun), cx->fp->scopeChain);
|
||||
}
|
||||
|
||||
return js_EmitTree(cx, cg, body) &&
|
||||
js_Emit1(cx, cg, JSOP_STOP) >= 0 &&
|
||||
js_NewScriptFromCG(cx, cg);
|
||||
|
@ -5906,9 +5906,12 @@ js_Interpret(JSContext *cx)
|
||||
if (!parent)
|
||||
goto error;
|
||||
|
||||
obj = js_CloneFunctionObject(cx, fun, parent);
|
||||
if (!obj)
|
||||
goto error;
|
||||
obj = FUN_OBJECT(fun);
|
||||
if (OBJ_GET_PARENT(cx, obj) != parent) {
|
||||
obj = js_CloneFunctionObject(cx, fun, parent);
|
||||
if (!obj)
|
||||
goto error;
|
||||
}
|
||||
|
||||
fp->vars[slot] = OBJECT_TO_JSVAL(obj);
|
||||
END_CASE(JSOP_DEFLOCALFUN)
|
||||
|
@ -1198,7 +1198,7 @@ FunctionDef(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc,
|
||||
|
||||
/* Initialize early for possible flags mutation via DestructuringExpr. */
|
||||
TREE_CONTEXT_INIT(&funtc, tc->parseContext);
|
||||
funtc.flags |= TCF_IN_FUNCTION;
|
||||
funtc.flags |= TCF_IN_FUNCTION | (tc->flags & TCF_COMPILE_N_GO);
|
||||
funtc.fun = fun;
|
||||
|
||||
/* Now parse formal argument list and compute fun->nargs. */
|
||||
@ -1405,7 +1405,7 @@ FunctionDef(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc,
|
||||
pn->pn_funpob = funpob;
|
||||
pn->pn_op = op;
|
||||
pn->pn_body = body;
|
||||
pn->pn_flags = funtc.flags & (TCF_FUN_FLAGS | TCF_HAS_DEFXMLNS);
|
||||
pn->pn_flags = funtc.flags & (TCF_FUN_FLAGS | TCF_HAS_DEFXMLNS | TCF_COMPILE_N_GO);
|
||||
pn->pn_sclen = funtc.maxScopeDepth;
|
||||
TREE_CONTEXT_FINISH(&funtc);
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user