| 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
| 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 5 | |
| 6 | var gTestfile = 'regress-452498-053.js'; |
| 7 | //----------------------------------------------------------------------------- |
| 8 | var BUGNUMBER = 452498; |
| 9 | var summary = 'TM: upvar2 regression tests'; |
| 10 | var actual = ''; |
| 11 | var expect = ''; |
| 12 | |
| 13 | |
| 14 | //----------------------------------------------------------------------------- |
| 15 | test(); |
| 16 | //----------------------------------------------------------------------------- |
| 17 | |
| 18 | function test() |
| 19 | { |
| 20 | enterFunc ('test'); |
| 21 | printBugNumber(BUGNUMBER); |
| 22 | printStatus (summary); |
| 23 | |
| 24 | // ------- Comment #53 From Jason Orendorff |
| 25 | |
| 26 | // Assertion failure: (slot) < (uint32)(obj)->dslots[-1] |
| 27 | // at ../jsobj.cpp:5559 |
| 28 | // On the last line of BindLet, we have |
| 29 | // JS_SetReservedSlot(cx, blockObj, index, PRIVATE_TO_JSVAL(pn)); |
| 30 | // but this uses reserved slots as though they were unlimited. |
| 31 | // blockObj only has 2. |
| 32 | let (a=0, b=1, c=2) {} |
| 33 | |
| 34 | // In RecycleTree at ../jsparse.cpp:315, we hit |
| 35 | // JS_NOT_REACHED("RecycleUseDefKids"); |
| 36 | // pn->pn_type is TOK_UNARYOP |
| 37 | // pn->pn_op is JSOP_XMLNAME |
| 38 | // pn->pn_defn is 1 |
| 39 | // pn->pn_used is 1 |
| 40 | try |
| 41 | { |
| 42 | @foo; 0; |
| 43 | } |
| 44 | catch(ex) |
| 45 | { |
| 46 | } |
| 47 | // Calls LinkUseToDef with pn->pn_defn == 1. |
| 48 | // |
| 49 | // If you say "var x;" first, then run this case, it gets further, |
| 50 | // crashing in NoteLValue like the first case in comment 52. |
| 51 | // |
| 52 | try |
| 53 | { |
| 54 | for (var [x] = x in y) var x; |
| 55 | } |
| 56 | catch(ex) |
| 57 | { |
| 58 | } |
| 59 | // Assertion failure: !pn2->pn_defn, at ../jsparse.h:461 |
| 60 | // Another case where some optimization is going on. |
| 61 | try |
| 62 | { |
| 63 | if (true && @foo) ; |
| 64 | } |
| 65 | catch(ex) |
| 66 | { |
| 67 | } |
| 68 | // Assertion failure: scope->object == ctor |
| 69 | // in js_FastNewObject at ../jsbuiltins.cpp:237 |
| 70 | // |
| 71 | // With the patch, we're new-ing a different function each time, and the |
| 72 | // .prototype property is missing. |
| 73 | // |
| 74 | for (var z = 0; z < 3; z++) { (new function(){}); } |
| 75 | |
| 76 | reportCompare(expect, actual, summary); |
| 77 | |
| 78 | exitFunc ('test'); |
| 79 | } |