зеркало из 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)
|
js_EmitFunctionBytecode(JSContext *cx, JSCodeGenerator *cg, JSParseNode *body)
|
||||||
{
|
{
|
||||||
if (cg->treeContext.flags & TCF_FUN_IS_GENERATOR) {
|
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)
|
if (js_Emit1(cx, cg, JSOP_GENERATOR) < 0)
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
|
CG_SWITCH_TO_MAIN(cg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return js_EmitTree(cx, cg, body) &&
|
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;
|
offset = CG_PROLOG_OFFSET(cg) - cg->prolog.lastNoteOffset;
|
||||||
JS_ASSERT(offset >= 0);
|
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. */
|
/* NB: Use as much of the first main note's delta as we can. */
|
||||||
sn = cg->main.notes;
|
sn = cg->main.notes;
|
||||||
delta = SN_IS_XDELTA(sn)
|
delta = SN_IS_XDELTA(sn)
|
||||||
|
|
|
@ -1970,17 +1970,22 @@ js_CloneBlockObject(JSContext *cx, JSObject *proto, JSObject *parent,
|
||||||
JSBool
|
JSBool
|
||||||
js_PutBlockObject(JSContext *cx, JSObject *obj)
|
js_PutBlockObject(JSContext *cx, JSObject *obj)
|
||||||
{
|
{
|
||||||
|
JSStackFrame *fp;
|
||||||
|
uintN depth, slot;
|
||||||
JSScopeProperty *sprop;
|
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) {
|
for (sprop = OBJ_SCOPE(obj)->lastProp; sprop; sprop = sprop->parent) {
|
||||||
if (sprop->getter != js_BlockClass.getProperty)
|
if (sprop->getter != js_BlockClass.getProperty)
|
||||||
continue;
|
continue;
|
||||||
if (!(sprop->flags & SPROP_HAS_SHORTID))
|
if (!(sprop->flags & SPROP_HAS_SHORTID))
|
||||||
continue;
|
continue;
|
||||||
if (!sprop->getter(cx, obj, INT_TO_JSVAL(sprop->shortid), &v) ||
|
slot = depth + (uintN)sprop->shortid;
|
||||||
!js_DefineNativeProperty(cx, obj, sprop->id,
|
JS_ASSERT(slot < fp->script->depth);
|
||||||
v, NULL, NULL,
|
if (!js_DefineNativeProperty(cx, obj, sprop->id,
|
||||||
|
fp->spbase[slot], NULL, NULL,
|
||||||
JSPROP_ENUMERATE | JSPROP_PERMANENT,
|
JSPROP_ENUMERATE | JSPROP_PERMANENT,
|
||||||
SPROP_HAS_SHORTID, sprop->shortid,
|
SPROP_HAS_SHORTID, sprop->shortid,
|
||||||
NULL)) {
|
NULL)) {
|
||||||
|
|
|
@ -201,7 +201,7 @@ JS_XDRFindClassById(JSXDRState *xdr, uint32 id);
|
||||||
* before deserialization of bytecode. If the saved version does not match
|
* before deserialization of bytecode. If the saved version does not match
|
||||||
* the current version, abort deserialization and invalidate the file.
|
* the current version, abort deserialization and invalidate the file.
|
||||||
*/
|
*/
|
||||||
#define JSXDR_BYTECODE_VERSION (0xb973c0de - 14)
|
#define JSXDR_BYTECODE_VERSION (0xb973c0de - 15)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Library-private functions.
|
* Library-private functions.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче