mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Bug 885648 - Add barriers for generator stack value. r=terrence
This commit is contained in:
parent
f09265969f
commit
9c80385e74
9
js/src/jit-test/tests/basic/bug885648.js
Normal file
9
js/src/jit-test/tests/basic/bug885648.js
Normal file
@ -0,0 +1,9 @@
|
||||
gczeal(4,1);
|
||||
var iterable = {persistedProp: 17};
|
||||
iterable.__iterator__ = function() {
|
||||
yield ["foo", 2];
|
||||
yield ["bar", 3];
|
||||
};
|
||||
var it = Iterator(iterable);
|
||||
assertEq(it.next().toString(), "foo,2");
|
||||
assertEq(it.next().toString(), "bar,3");
|
@ -1418,11 +1418,6 @@ GeneratorState::pushInterpreterFrame(JSContext *cx, FrameGuard *)
|
||||
* or else some kind of epoch scheme would have to be used.
|
||||
*/
|
||||
GeneratorWriteBarrierPre(cx, gen_);
|
||||
|
||||
/*
|
||||
* Don't change the state until after the frame is successfully pushed
|
||||
* or else we might fail to scan some generator values.
|
||||
*/
|
||||
gen_->state = futureState_;
|
||||
|
||||
gen_->fp->clearSuspended();
|
||||
@ -1561,9 +1556,12 @@ SendToGenerator(JSContext *cx, JSGeneratorOp op, HandleObject obj,
|
||||
if (gen->state == JSGEN_OPEN) {
|
||||
/*
|
||||
* Store the argument to send as the result of the yield
|
||||
* expression.
|
||||
* expression. The generator stack is not barriered, so we need
|
||||
* write barriers here.
|
||||
*/
|
||||
HeapValue::writeBarrierPre(gen->regs.sp[-1]);
|
||||
gen->regs.sp[-1] = arg;
|
||||
HeapValue::writeBarrierPost(cx->runtime(), gen->regs.sp[-1], &gen->regs.sp[-1]);
|
||||
}
|
||||
futureState = JSGEN_RUNNING;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user