15c838251403b0be9a882540f1922577abba4c872ager@chromium.org// Copyright 2010 the V8 project authors. All rights reserved. 25c838251403b0be9a882540f1922577abba4c872ager@chromium.org// Redistribution and use in source and binary forms, with or without 35c838251403b0be9a882540f1922577abba4c872ager@chromium.org// modification, are permitted provided that the following conditions are 45c838251403b0be9a882540f1922577abba4c872ager@chromium.org// met: 55c838251403b0be9a882540f1922577abba4c872ager@chromium.org// 65c838251403b0be9a882540f1922577abba4c872ager@chromium.org// * Redistributions of source code must retain the above copyright 75c838251403b0be9a882540f1922577abba4c872ager@chromium.org// notice, this list of conditions and the following disclaimer. 85c838251403b0be9a882540f1922577abba4c872ager@chromium.org// * Redistributions in binary form must reproduce the above 95c838251403b0be9a882540f1922577abba4c872ager@chromium.org// copyright notice, this list of conditions and the following 105c838251403b0be9a882540f1922577abba4c872ager@chromium.org// disclaimer in the documentation and/or other materials provided 115c838251403b0be9a882540f1922577abba4c872ager@chromium.org// with the distribution. 125c838251403b0be9a882540f1922577abba4c872ager@chromium.org// * Neither the name of Google Inc. nor the names of its 135c838251403b0be9a882540f1922577abba4c872ager@chromium.org// contributors may be used to endorse or promote products derived 145c838251403b0be9a882540f1922577abba4c872ager@chromium.org// from this software without specific prior written permission. 155c838251403b0be9a882540f1922577abba4c872ager@chromium.org// 165c838251403b0be9a882540f1922577abba4c872ager@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 175c838251403b0be9a882540f1922577abba4c872ager@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 185c838251403b0be9a882540f1922577abba4c872ager@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 195c838251403b0be9a882540f1922577abba4c872ager@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 205c838251403b0be9a882540f1922577abba4c872ager@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 215c838251403b0be9a882540f1922577abba4c872ager@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 225c838251403b0be9a882540f1922577abba4c872ager@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 235c838251403b0be9a882540f1922577abba4c872ager@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 245c838251403b0be9a882540f1922577abba4c872ager@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 255c838251403b0be9a882540f1922577abba4c872ager@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 265c838251403b0be9a882540f1922577abba4c872ager@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 275c838251403b0be9a882540f1922577abba4c872ager@chromium.org 285c838251403b0be9a882540f1922577abba4c872ager@chromium.org// Tests intercation between __defineGetter__/__defineSetter and fast and slow 295c838251403b0be9a882540f1922577abba4c872ager@chromium.org// mode of the objects due to series of assignments optimization. 305c838251403b0be9a882540f1922577abba4c872ager@chromium.org// (See http://code.google.com/p/v8/issues/detail?id=612) 315c838251403b0be9a882540f1922577abba4c872ager@chromium.org 325c838251403b0be9a882540f1922577abba4c872ager@chromium.orgobj = {} 335c838251403b0be9a882540f1922577abba4c872ager@chromium.org 345c838251403b0be9a882540f1922577abba4c872ager@chromium.org// Define getter which currently moves object into slow mode. 355c838251403b0be9a882540f1922577abba4c872ager@chromium.orgobj.__defineGetter__('foobar', function() { return 42; }) 365c838251403b0be9a882540f1922577abba4c872ager@chromium.org 375c838251403b0be9a882540f1922577abba4c872ager@chromium.org// Starts initialization block mode. And turns object into slow mode. 385c838251403b0be9a882540f1922577abba4c872ager@chromium.orgobj.a = 1 395c838251403b0be9a882540f1922577abba4c872ager@chromium.orgobj.b = 2; 405c838251403b0be9a882540f1922577abba4c872ager@chromium.orgobj.c = 3; 415c838251403b0be9a882540f1922577abba4c872ager@chromium.org// Now object is turned into fast mode, but it has getter defined above... 425c838251403b0be9a882540f1922577abba4c872ager@chromium.org 435c838251403b0be9a882540f1922577abba4c872ager@chromium.org// Now assert is triggered. 445c838251403b0be9a882540f1922577abba4c872ager@chromium.orgobj.__defineGetter__('foobar', function() { return 42; }) 45