зеркало из https://github.com/mozilla/pjs.git
Bug 387909: make sure that [generator] is the first bytecode. r=brendan
This commit is contained in:
Родитель
7076b3fbab
Коммит
316e54c9dc
|
@ -3187,8 +3187,12 @@ JSBool
|
|||
js_EmitFunctionBytecode(JSContext *cx, JSCodeGenerator *cg, JSParseNode *body)
|
||||
{
|
||||
if (cg->treeContext.flags & TCF_FUN_IS_GENERATOR) {
|
||||
/* JSOP_GENERATOR must be the first instruction. */
|
||||
CG_SWITCH_TO_PROLOG(cg);
|
||||
JS_ASSERT(CG_NEXT(cg) == CG_BASE(cg));
|
||||
if (js_Emit1(cx, cg, JSOP_GENERATOR) < 0)
|
||||
return JS_FALSE;
|
||||
CG_SWITCH_TO_MAIN(cg);
|
||||
}
|
||||
|
||||
return js_EmitTree(cx, cg, body) &&
|
||||
|
@ -6782,7 +6786,7 @@ js_FinishTakingSrcNotes(JSContext *cx, JSCodeGenerator *cg, jssrcnote *notes)
|
|||
*/
|
||||
offset = CG_PROLOG_OFFSET(cg) - cg->prolog.lastNoteOffset;
|
||||
JS_ASSERT(offset >= 0);
|
||||
if (offset > 0) {
|
||||
if (offset > 0 && cg->main.noteCount != 0) {
|
||||
/* NB: Use as much of the first main note's delta as we can. */
|
||||
sn = cg->main.notes;
|
||||
delta = SN_IS_XDELTA(sn)
|
||||
|
|
|
@ -863,7 +863,7 @@ js_obj_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
|||
}
|
||||
*rval = STRING_TO_JSVAL(idstr); /* local root */
|
||||
idIsLexicalIdentifier = js_IsIdentifier(idstr);
|
||||
needOldStyleGetterSetter =
|
||||
needOldStyleGetterSetter =
|
||||
!idIsLexicalIdentifier ||
|
||||
js_CheckKeyword(JSSTRING_CHARS(idstr),
|
||||
JSSTRING_LENGTH(idstr)) != TOK_EOF;
|
||||
|
@ -1287,7 +1287,7 @@ obj_eval(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
JS_ASSERT(!caller || caller->pc);
|
||||
indirectCall = (caller && *caller->pc != JSOP_EVAL);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Ban all indirect uses of eval (global.foo = eval; global.foo(...)) and
|
||||
* calls that attempt to use a non-global object as the "with" object in
|
||||
* the former indirect case.
|
||||
|
@ -1970,17 +1970,22 @@ js_CloneBlockObject(JSContext *cx, JSObject *proto, JSObject *parent,
|
|||
JSBool
|
||||
js_PutBlockObject(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
JSStackFrame *fp;
|
||||
uintN depth, slot;
|
||||
JSScopeProperty *sprop;
|
||||
jsval v;
|
||||
|
||||
fp = (JSStackFrame *) JS_GetPrivate(cx, obj);
|
||||
JS_ASSERT(fp);
|
||||
depth = OBJ_BLOCK_DEPTH(cx, obj);
|
||||
for (sprop = OBJ_SCOPE(obj)->lastProp; sprop; sprop = sprop->parent) {
|
||||
if (sprop->getter != js_BlockClass.getProperty)
|
||||
continue;
|
||||
if (!(sprop->flags & SPROP_HAS_SHORTID))
|
||||
continue;
|
||||
if (!sprop->getter(cx, obj, INT_TO_JSVAL(sprop->shortid), &v) ||
|
||||
!js_DefineNativeProperty(cx, obj, sprop->id,
|
||||
v, NULL, NULL,
|
||||
slot = depth + (uintN)sprop->shortid;
|
||||
JS_ASSERT(slot < fp->script->depth);
|
||||
if (!js_DefineNativeProperty(cx, obj, sprop->id,
|
||||
fp->spbase[slot], NULL, NULL,
|
||||
JSPROP_ENUMERATE | JSPROP_PERMANENT,
|
||||
SPROP_HAS_SHORTID, sprop->shortid,
|
||||
NULL)) {
|
||||
|
@ -2806,7 +2811,7 @@ js_AllocSlot(JSContext *cx, JSObject *obj, uint32 *slotp)
|
|||
return JS_FALSE;
|
||||
}
|
||||
|
||||
/* ReallocSlots or js_FreeSlot should set the free slots to void. */
|
||||
/* ReallocSlots or js_FreeSlot should set the free slots to void. */
|
||||
JS_ASSERT(STOBJ_GET_SLOT(obj, map->freeslot) == JSVAL_VOID);
|
||||
*slotp = map->freeslot++;
|
||||
return JS_TRUE;
|
||||
|
|
|
@ -201,7 +201,7 @@ JS_XDRFindClassById(JSXDRState *xdr, uint32 id);
|
|||
* before deserialization of bytecode. If the saved version does not match
|
||||
* the current version, abort deserialization and invalidate the file.
|
||||
*/
|
||||
#define JSXDR_BYTECODE_VERSION (0xb973c0de - 14)
|
||||
#define JSXDR_BYTECODE_VERSION (0xb973c0de - 15)
|
||||
|
||||
/*
|
||||
* Library-private functions.
|
||||
|
|
Загрузка…
Ссылка в новой задаче