19c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org// Copyright 2012 the V8 project authors. All rights reserved.
29c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org// Redistribution and use in source and binary forms, with or without
39c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org// modification, are permitted provided that the following conditions are
49c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org// met:
59c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org//
69c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org//     * Redistributions of source code must retain the above copyright
79c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org//       notice, this list of conditions and the following disclaimer.
89c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org//     * Redistributions in binary form must reproduce the above
99c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org//       copyright notice, this list of conditions and the following
109c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org//       disclaimer in the documentation and/or other materials provided
119c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org//       with the distribution.
129c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org//     * Neither the name of Google Inc. nor the names of its
139c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org//       contributors may be used to endorse or promote products derived
149c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org//       from this software without specific prior written permission.
159c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org//
169c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
179c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
189c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
199c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
209c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
219c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
229c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
239c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
249c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
259c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
269c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
279c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org
289c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org// Filler long enough to trigger lazy parsing.
299c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.orgvar filler = "//" + new Array(1024).join('x');
309c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org
319c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.orgvar scope = { x:23 };
329c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org
339c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.orgwith(scope) {
349c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org  eval(
359c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org    "scope.f = (function outer() {" +
369c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org    "  function inner() {" +
379c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org    "    return x;" +
389c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org    "  }" +
399c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org    "  return inner;" +
409c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org    "})();" +
419c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org    filler
429c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org  );
439c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org};
449c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.org
459c741c80bfc8026103e86b46e15e2544095ce67eyangguo@chromium.orgassertSame(23, scope.f());
46