| Index: test/mjsunit/harmony/generators-instantiation.js
|
| diff --git a/test/mjsunit/regress/readonly3.js b/test/mjsunit/harmony/generators-instantiation.js
|
| similarity index 71%
|
| copy from test/mjsunit/regress/readonly3.js
|
| copy to test/mjsunit/harmony/generators-instantiation.js
|
| index f81979d272217d768fa9c9c90a0b22ce34d1c15b..1255f9705c479c5966cf916e378aef06033b8b7a 100644
|
| --- a/test/mjsunit/regress/readonly3.js
|
| +++ b/test/mjsunit/harmony/generators-instantiation.js
|
| @@ -25,41 +25,25 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -this.x = 0;
|
| -
|
| -var p = {};
|
| -Object.defineProperty(p, "x", {writable:false, value:5});
|
| -this.__proto__ = p;
|
| -
|
| -function s(v) {
|
| - v.x = 1;
|
| -}
|
| -
|
| -function s_strict(v) {
|
| - "use strict";
|
| - v.x = 1;
|
| -}
|
| -
|
| -function c(p) {
|
| - return {__proto__: p};
|
| +// Flags: --harmony-generators --harmony-scoping
|
| +
|
| +// Test instantations of generators.
|
| +
|
| +// Generators shouldn't allocate stack slots. This test will abort in debug
|
| +// mode if generators have stack slots.
|
| +function TestContextAllocation() {
|
| + function* g1(a, b, c) { yield 1; return [a, b, c]; }
|
| + function* g2() { yield 1; return arguments; }
|
| + function* g3() { yield 1; return this; }
|
| + function* g4() { var x = 10; yield 1; return x; }
|
| + // Temporary variable context allocation
|
| + function* g5(l) { "use strict"; yield 1; for (let x in l) { yield x; } }
|
| +
|
| + g1();
|
| + g2();
|
| + g3();
|
| + g4();
|
| + g5(["foo"]);
|
| }
|
|
|
| -var o1 = c(this);
|
| -var o2 = c(this);
|
| -
|
| -// Initialize the store IC.
|
| -s(c(this));
|
| -s(c(this));
|
| -s_strict(c(this));
|
| -s_strict(c(this));
|
| -
|
| -delete this.x;
|
| -
|
| -// Verify that direct setting fails.
|
| -o1.x = 20;
|
| -assertEquals(5, o1.x);
|
| -
|
| -// Verify that setting through the IC fails.
|
| -s(o2);
|
| -assertEquals(5, o2.x);
|
| -assertThrows("s_strict(o2);", TypeError);
|
| +TestContextAllocation();
|
|
|