1d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org// Copyright 2013 the V8 project authors. All rights reserved.
2d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org// Redistribution and use in source and binary forms, with or without
3d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org// modification, are permitted provided that the following conditions are
4d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org// met:
5d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org//
6d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org//     * Redistributions of source code must retain the above copyright
7d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org//       notice, this list of conditions and the following disclaimer.
8d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org//     * Redistributions in binary form must reproduce the above
9d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org//       copyright notice, this list of conditions and the following
10d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org//       disclaimer in the documentation and/or other materials provided
11d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org//       with the distribution.
12d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org//     * Neither the name of Google Inc. nor the names of its
13d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org//       contributors may be used to endorse or promote products derived
14d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org//       from this software without specific prior written permission.
15d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org//
16d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org
28d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org// Flags: --allow-natives-syntax
29d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org
30d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.orgvar a = {x:1};
31d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.orgvar a_deprecate = {x:1};
32d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.orga_deprecate.x = 1.5;
33d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.orgfunction create() {
34d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org  return {__proto__:a, y:1};
35d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org}
36d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.orgvar b1 = create();
37d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.orgvar b2 = create();
38d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.orgvar b3 = create();
39d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.orgvar b4 = create();
40d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org
41d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.orgfunction set(b) {
42d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org  b.x = 5;
43d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org  b.z = 10;
44d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org}
45d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org
46d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.orgset(b1);
47d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.orgset(b2);
48d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.org%OptimizeFunctionOnNextCall(set);
49d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.orgset(b3);
50d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.orgvar called = false;
51d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.orga.x = 1.5;
52d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.orgObject.defineProperty(a, "z", {set:function(v) { called = true; }});
53d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.orgset(b4);
54d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.orgassertTrue(called);
55d3c42109e5b85232d19beab8deeb24bdcbbf07f9danno@chromium.orgassertEquals(undefined, b4.z);
56