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

Side by Side Diff: test/mjsunit/harmony/do-expressions.js

Issue 1575133003: [parser] fix null-dereference in DoExpression rewriting (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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/parsing/parser.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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-do-expressions --harmony-sloppy-let --allow-natives-syntax 5 // Flags: --harmony-do-expressions --harmony-sloppy-let --allow-natives-syntax
6 // Flags: --harmony-default-parameters --harmony-destructuring-bind 6 // Flags: --harmony-default-parameters --harmony-destructuring-bind
7 // Flags: --harmony-completion 7 // Flags: --harmony-completion
8 8
9 function returnValue(v) { return v; } 9 function returnValue(v) { return v; }
10 function MyError() {} 10 function MyError() {}
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 // TODO(caitp): Always block-scope function declarations in |do| expressions 256 // TODO(caitp): Always block-scope function declarations in |do| expressions
257 //(do { 257 //(do {
258 // assertEquals(true, inner_func()); 258 // assertEquals(true, inner_func());
259 // function inner_func() { return true; } 259 // function inner_func() { return true; }
260 //}); 260 //});
261 //assertThrows(function() { return innerFunc(); }, ReferenceError); 261 //assertThrows(function() { return innerFunc(); }, ReferenceError);
262 } 262 }
263 TestHoisting(); 263 TestHoisting();
264 264
265 265
266 // v8:4661
267
268 function tryFinallySimple() { (do { try {} finally {} }); }
269 tryFinallySimple();
270 tryFinallySimple();
271 tryFinallySimple();
272 tryFinallySimple();
273
274 var finallyRanCount = 0;
275 function tryFinallyDoExpr() {
276 return (do {
277 try {
278 throw "BOO";
279 } catch (e) {
280 "Caught: " + e + " (" + finallyRanCount + ")"
281 } finally {
282 ++finallyRanCount;
283 }
284 });
285 }
286 assertEquals("Caught: BOO (0)", tryFinallyDoExpr());
287 assertEquals(1, finallyRanCount);
288 assertEquals("Caught: BOO (1)", tryFinallyDoExpr());
289 assertEquals(2, finallyRanCount);
290 assertEquals("Caught: BOO (2)", tryFinallyDoExpr());
291 assertEquals(3, finallyRanCount);
292 assertEquals("Caught: BOO (3)", tryFinallyDoExpr());
293 assertEquals(4, finallyRanCount);
294
295
266 function TestOSR() { 296 function TestOSR() {
267 var numbers = do { 297 var numbers = do {
268 let nums = []; 298 let nums = [];
269 for (let i = 0; i < 1000; ++i) { 299 for (let i = 0; i < 1000; ++i) {
270 let value = (Math.random() * 100) | 0; 300 let value = (Math.random() * 100) | 0;
271 nums.push(value === 0 ? 1 : value), nums; 301 nums.push(value === 0 ? 1 : value), nums;
272 } 302 }
273 }; 303 };
274 assertEquals(numbers.length, 1000); 304 assertEquals(numbers.length, 1000);
275 } 305 }
276 306
277 for (var i = 0; i < 64; ++i) TestOSR(); 307 for (var i = 0; i < 64; ++i) TestOSR();
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698