1 // Copyright 2014 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Flags: --expose-externalize-string --expose-gc 6 7 var re = /(B)/; 8 var cons1 = "0123456789" + "ABCDEFGHIJ"; 9 var cons2 = "0123456789\u1234" + "ABCDEFGHIJ"; 10 gc(); 11 gc(); // Promote cons. 12 13 try { externalizeString(cons1, false); } catch (e) { } 14 try { externalizeString(cons2, true); } catch (e) { } 15 16 var slice1 = cons1.slice(1,-1); 17 var slice2 = cons2.slice(1,-1); 18 for (var i = 0; i < 10; i++) { 19 assertEquals(["B", "B"], re.exec(slice1)); 20 assertEquals(["B", "B"], re.exec(slice2)); 21 } 22