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

Side by Side Diff: test/mjsunit/es6/super-with-spread-modify-next.js

Issue 2659623002: [turbofan] Reduce CallConstructWithSpread where iteration is not observable. (Closed)
Patch Set: respond to comments from Benedikt Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « test/mjsunit/es6/super-with-spread-modify-array-iterator.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --allow-natives-syntax
6
7 (function modifyNext() {
8 'use strict';
9
10 class Point {
11 constructor(x, y) {
12 this.x = x;
13 this.y = y;
14 }
15 }
16
17 class ArgumentsPoint extends Point {
18 constructor() {
19 super(...arguments);
20 }
21 }
22
23 var a = [];
24 var ai = a[Symbol.iterator]();
25
26 var original_next = ai.__proto__['next'];
27
28 function testArgumentsPoint(x, y) {
29 return new ArgumentsPoint(x, y);
30 }
31 testArgumentsPoint(1, 2);
32 testArgumentsPoint(1, 2);
33 % OptimizeFunctionOnNextCall(testArgumentsPoint);
34 var r = testArgumentsPoint(1, 2);
35
36 assertInstanceof(r, ArgumentsPoint);
37 assertInstanceof(r, Point);
38 assertEquals(r.x, 1);
39 assertEquals(r.y, 2);
40
41 var called = 0;
42 Object.defineProperty(ai.__proto__, 'next', {
43 get: function() {
44 called++;
45 return original_next;
46 }
47 });
48
49 var r2 = testArgumentsPoint(1, 2);
50
51 assertEquals(3, called);
52 assertInstanceof(r2, ArgumentsPoint);
53 assertInstanceof(r2, Point);
54 assertEquals(r2.x, 1);
55 assertEquals(r2.y, 2);
56 })();
OLDNEW
« no previous file with comments | « test/mjsunit/es6/super-with-spread-modify-array-iterator.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698