OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Flags: --allow-natives-syntax --harmony-do-expressions |
| 6 |
| 7 var p = {}; |
| 8 var testCases = [ |
| 9 { s:"[1, do { _OSR_ 2 }, 3]", r:[1, 2, 3] }, |
| 10 { s:"[1, ...[2], do { _OSR_ 3 }, 4]", r:[1, 2, 3, 4] }, |
| 11 { s:"[1, ...do { _OSR_ [2,3] }, 4]", r:[1, 2, 3, 4] }, |
| 12 { s:"{ a:do { _OSR_ 1 } }", r:{ a:1 } }, |
| 13 { s:"{ a:do { _OSR_ 2 }, __proto__:p }", r:{ a:2, __proto__:p } }, |
| 14 { s:"{ [do { _OSR_ 'b' }]: 3 }", r:{ b:3 } }, |
| 15 { s:"{ [do { _OSR_ 'b' }]: 3, c: 4 }", r:{ b:3, c:4 } }, |
| 16 { s:"{ [do { _OSR_ 'b' }]: 3, __proto__:p }", r:{ b:3, __proto__:p } }, |
| 17 ]; |
| 18 |
| 19 for (var i = 0; i < testCases.length; ++i) { |
| 20 var source = "(function f" + i + "(x) { return " + testCases[i].s + "})"; |
| 21 var osr = "for (var i = 0; i < 10; i++) { if (i == 5) %OptimizeOsr(); }"; |
| 22 var fun = eval(source.replace("_OSR_", osr)); |
| 23 assertEquals(testCases[i].r, fun(23)); |
| 24 } |
OLD | NEW |