Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: test/mjsunit/string-slices.js

Issue 804993002: Internalize strings being stored into uninitialized property cells (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comment Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/regress/regress-crbug-320922.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 assertEquals("\u03B1\u03B4\u03B5", utf.substring(0,1) + utf.substring(5,3)); 186 assertEquals("\u03B1\u03B4\u03B5", utf.substring(0,1) + utf.substring(5,3));
187 assertEquals("", ascii.substring(16) + utf.substring(16)); 187 assertEquals("", ascii.substring(16) + utf.substring(16));
188 assertEquals("bcdef\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9", 188 assertEquals("bcdef\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9",
189 ascii.substring(1,6) + utf.substring(3,9)); 189 ascii.substring(1,6) + utf.substring(3,9));
190 assertEquals("\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9abcdefghijklmnop", 190 assertEquals("\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9abcdefghijklmnop",
191 utf.substring(3,9) + ascii); 191 utf.substring(3,9) + ascii);
192 assertEquals("\u03B2\u03B3\u03B4\u03B5\u03B4\u03B5\u03B6\u03B7", 192 assertEquals("\u03B2\u03B3\u03B4\u03B5\u03B4\u03B5\u03B6\u03B7",
193 utf.substring(5,1) + utf.substring(3,7)); 193 utf.substring(5,1) + utf.substring(3,7));
194 194
195 // Externalizing strings. 195 // Externalizing strings.
196 var a = "123456789" + "qwertyuiopasdfghjklzxcvbnm"; 196 var a = "internalized dummy";
197 a = "123456789" + "qwertyuiopasdfghjklzxcvbnm";
197 var b = "23456789qwertyuiopasdfghjklzxcvbn" 198 var b = "23456789qwertyuiopasdfghjklzxcvbn"
198 assertEquals(a.slice(1,-1), b); 199 assertEquals(a.slice(1,-1), b);
199 200
200 assertTrue(isOneByteString(a)); 201 assertTrue(isOneByteString(a));
201 externalizeString(a, true); 202 externalizeString(a, true);
202 assertFalse(isOneByteString(a)); 203 assertFalse(isOneByteString(a));
203 204
204 assertEquals(a.slice(1,-1), b); 205 assertEquals(a.slice(1,-1), b);
205 assertTrue(/3456789qwe/.test(a)); 206 assertTrue(/3456789qwe/.test(a));
206 assertEquals(5, a.indexOf("678")); 207 assertEquals(5, a.indexOf("678"));
(...skipping 20 matching lines...) Expand all
227 var s1 = "12345678901234567890"; 228 var s1 = "12345678901234567890";
228 var s2 = "abcdefghijklmnopqrstuvwxyz"; 229 var s2 = "abcdefghijklmnopqrstuvwxyz";
229 var c1 = s1 + s2; 230 var c1 = s1 + s2;
230 var c2 = s1 + c1 + s2; 231 var c2 = s1 + c1 + s2;
231 assertEquals("234567890123456789", c1.substring(1, 19)); 232 assertEquals("234567890123456789", c1.substring(1, 19));
232 assertEquals("bcdefghijklmno", c1.substring(21, 35)); 233 assertEquals("bcdefghijklmno", c1.substring(21, 35));
233 assertEquals("2345678901234567890abcdefghijklmno", c1.substring(1, 35)); 234 assertEquals("2345678901234567890abcdefghijklmno", c1.substring(1, 35));
234 assertEquals("234567890123456789", c2.substring(1, 19)); 235 assertEquals("234567890123456789", c2.substring(1, 19));
235 assertEquals("bcdefghijklmno", c2.substring(41, 55)); 236 assertEquals("bcdefghijklmno", c2.substring(41, 55));
236 assertEquals("2345678901234567890abcdefghijklmno", c2.substring(21, 55)); 237 assertEquals("2345678901234567890abcdefghijklmno", c2.substring(21, 55));
OLDNEW
« no previous file with comments | « test/mjsunit/regress/regress-crbug-320922.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698