Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(674)

Unified Diff: test/mjsunit/harmony/generators-instantiation.js

Issue 13408005: Force context allocation for variables in generator scopes. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698