зеркало из 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)
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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.
|
||||
|
|
Загрузка…
Ссылка в новой задаче