1196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// Copyright 2014 the V8 project authors. All rights reserved. 2196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// Redistribution and use in source and binary forms, with or without 3196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// modification, are permitted provided that the following conditions are 4196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// met: 5196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// 6196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// * Redistributions of source code must retain the above copyright 7196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// notice, this list of conditions and the following disclaimer. 8196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// * Redistributions in binary form must reproduce the above 9196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// copyright notice, this list of conditions and the following 10196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// disclaimer in the documentation and/or other materials provided 11196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// with the distribution. 12196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// * Neither the name of Google Inc. nor the names of its 13196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// contributors may be used to endorse or promote products derived 14196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// from this software without specific prior written permission. 15196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// 16196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org 28196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org// Flags: --expose-debug-as debug 29196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org 30196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.orgvar handle1 = debug.MakeMirror(123).handle(); 31196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.orgassertEquals("number", debug.LookupMirror(handle1).type()); 32196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org 33196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.orgdebug.ToggleMirrorCache(false); 34196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.orgvar handle2 = debug.MakeMirror(123).handle(); 35196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.orgassertEquals(undefined, handle2); 36196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.orgassertThrows(function() { debug.LookupMirror(handle2) }); 37196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.org 38196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.orgdebug.ToggleMirrorCache(true); 39196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.orgvar handle3 = debug.MakeMirror(123).handle(); 40196eb601290dc49c3754da728dc58700dff2de1bmachenbach@chromium.orgassertEquals("number", debug.LookupMirror(handle3).type()); 41