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

Side by Side Diff: test/mjsunit/harmony/super.js

Issue 1238743002: [turbofan] Implement super call support in TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_turbofan-super-2
Patch Set: Revert "Addressed comments." Created 5 years, 5 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 | « src/compiler/js-generic-lowering.cc ('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
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --harmony-arrow-functions --allow-natives-syntax 5 // Flags: --harmony-arrow-functions --allow-natives-syntax
6 // Flags: --harmony-spreadcalls 6 // Flags: --harmony-spreadcalls
7 7
8 (function TestSuperNamedLoads() { 8 (function TestSuperNamedLoads() {
9 function Base() { } 9 function Base() { }
10 function fBase() { } 10 function fBase() { }
(...skipping 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2174 let o = f(); 2174 let o = f();
2175 assertEquals(2, o.x); 2175 assertEquals(2, o.x);
2176 assertInstanceof(o, Derived); 2176 assertInstanceof(o, Derived);
2177 2177
2178 assertThrows(function() { 2178 assertThrows(function() {
2179 f(); 2179 f();
2180 }, ReferenceError); 2180 }, ReferenceError);
2181 })(); 2181 })();
2182 2182
2183 2183
2184 (function TestSuperCallInLoop() {
2185 'use strict';
2186 class Base {
2187 constructor(x) {
2188 this.x = x;
2189 }
2190 }
2191 class Derived extends Base {
2192 constructor(x, n) {
2193 for (var i = 0; i < n; ++i) {
2194 super(x);
2195 }
2196 }
2197 }
2198
2199 let o = new Derived(23, 1);
2200 assertEquals(23, o.x);
2201 assertInstanceof(o, Derived);
2202
2203 assertThrows("new Derived(42, 0)", ReferenceError);
2204 assertThrows("new Derived(65, 2)", ReferenceError);
2205 })();
2206
2207
2208 (function TestSuperCallReentrant() {
2209 'use strict';
2210 class Base {
2211 constructor(fun) {
2212 this.x = fun();
2213 }
2214 }
2215 class Derived extends Base {
2216 constructor(x) {
2217 let f = () => super(() => x)
2218 super(f);
2219 }
2220 }
2221 assertThrows("new Derived(23)", ReferenceError);
2222 })();
2223
2224
2184 (function TestSuperCallSpreadInEval() { 2225 (function TestSuperCallSpreadInEval() {
2185 'use strict'; 2226 'use strict';
2186 class Base { 2227 class Base {
2187 constructor(x) { 2228 constructor(x) {
2188 this.x = x; 2229 this.x = x;
2189 } 2230 }
2190 } 2231 }
2191 class Derived extends Base { 2232 class Derived extends Base {
2192 constructor(x) { 2233 constructor(x) {
2193 eval('super(...[x])'); 2234 eval('super(...[x])');
(...skipping 12 matching lines...) Expand all
2206 } 2247 }
2207 } 2248 }
2208 class Derived extends Base { 2249 class Derived extends Base {
2209 constructor(x) { 2250 constructor(x) {
2210 (() => super(...[x]))(); 2251 (() => super(...[x]))();
2211 } 2252 }
2212 } 2253 }
2213 let d = new Derived(42); 2254 let d = new Derived(42);
2214 assertSame(42, d.x); 2255 assertSame(42, d.x);
2215 })(); 2256 })();
OLDNEW
« no previous file with comments | « src/compiler/js-generic-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698