OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 3 // |
| 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions |
| 6 // are met: |
| 7 // 1. Redistributions of source code must retain the above copyright |
| 8 // notice, this list of conditions and the following disclaimer. |
| 9 // 2. Redistributions in binary form must reproduce the above copyright |
| 10 // notice, this list of conditions and the following disclaimer in the |
| 11 // documentation and/or other materials provided with the distribution. |
| 12 // |
| 13 // THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y |
| 14 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 15 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 16 // DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y |
| 17 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 18 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 19 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N |
| 20 // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 21 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 22 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 |
| 24 description( |
| 25 "Tests that if you alias the arguments in a very small function, arguments simpl
ification still works even if you overwrite the arguments register." |
| 26 ); |
| 27 |
| 28 function foo() { |
| 29 var args = arguments; |
| 30 arguments = [1, 2, 3]; |
| 31 return args[0] + arguments[1] + args[2]; |
| 32 } |
| 33 |
| 34 var result = ""; |
| 35 for (var i = 0; i < 300; ++i) { |
| 36 var a; |
| 37 if (i < 200) |
| 38 a = i; |
| 39 else |
| 40 a = "hello"; |
| 41 var b = i + 1; |
| 42 var c = i + 3; |
| 43 result += foo(a, b, c); |
| 44 } |
| 45 shouldBe("result", "\"5791113151719212325272931333537394143454749515355575961636
56769717375777981838587899193959799101103105107109111113115117119121123125127129
13113313513713914114314514714915115315515715916116316516716917117317517717918118
31851871891911931951971992012032052072092112132152172192212232252272292312332352
37239241243245247249251253255257259261263265267269271273275277279281283285287289
29129329529729930130330530730931131331531731932132332532732933133333533733934134
33453473493513533553573593613633653673693713733753773793813833853873893913933953
97399401403hello2203hello2204hello2205hello2206hello2207hello2208hello2209hello2
210hello2211hello2212hello2213hello2214hello2215hello2216hello2217hello2218hello
2219hello2220hello2221hello2222hello2223hello2224hello2225hello2226hello2227hell
o2228hello2229hello2230hello2231hello2232hello2233hello2234hello2235hello2236hel
lo2237hello2238hello2239hello2240hello2241hello2242hello2243hello2244hello2245he
llo2246hello2247hello2248hello2249hello2250hello2251hello2252hello2253hello2254h
ello2255hello2256hello2257hello2258hello2259hello2260hello2261hello2262hello2263
hello2264hello2265hello2266hello2267hello2268hello2269hello2270hello2271hello227
2hello2273hello2274hello2275hello2276hello2277hello2278hello2279hello2280hello22
81hello2282hello2283hello2284hello2285hello2286hello2287hello2288hello2289hello2
290hello2291hello2292hello2293hello2294hello2295hello2296hello2297hello2298hello
2299hello2300hello2301hello2302\""); |
OLD | NEW |