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

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

Issue 8680010: Add external strings support to regexp in generated code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixing small mistakes Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 old_length = str2.length - realTwoByteExternalString.length; 80 old_length = str2.length - realTwoByteExternalString.length;
81 for (var i = 0; i < old_length; i++) { 81 for (var i = 0; i < old_length; i++) {
82 assertEquals(String.fromCharCode(i & 0x7f), str2[i]); 82 assertEquals(String.fromCharCode(i & 0x7f), str2[i]);
83 } 83 }
84 for (var i = old_length; i < str.length; i++) { 84 for (var i = old_length; i < str.length; i++) {
85 assertEquals("\u1234", str2[i]); 85 assertEquals("\u1234", str2[i]);
86 } 86 }
87 87
88 // Flattened string should still be two-byte. 88 // Flattened string should still be two-byte.
89 assertFalse(isAsciiString(str2)); 89 assertFalse(isAsciiString(str2));
90
91 // Test buffered external strings.
92 var charat_str = new Array(5);
93 charat_str[0] = "0123456789ABCDEF0123456789ABCDEF\
94 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF\
95 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF\
96 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF\
97 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF";
98 charat_str[1] = "0123456789ABCDEF";
99 for (var i = 0; i < 6; i++) charat_str[1] += charat_str[1];
100 try { // String can only be externalized once
101 externalizeString(charat_str[0], false);
102 externalizeString(charat_str[1], true);
103 } catch (ex) { }
104 charat_str[2] = charat_str[0].slice(0, -1);
105 charat_str[3] = charat_str[1].slice(0, -1);
106 charat_str[4] = charat_str[0] + charat_str[0];
107
108 for (var i = 0; i < 5; i++) {
109 assertEquals('B', charat_str[i].charAt(6*16 + 11));
110 assertEquals('C', charat_str[i].charAt(6*16 + 12));
111 assertEquals('A', charat_str[i].charAt(3*16 + 10));
112 assertEquals('B', charat_str[i].charAt(3*16 + 11));
113 }
114
115 charat_short = "012";
116 try { // String can only be externalized once
117 externalizeString(charat_short, true);
118 } catch (ex) { }
119 assertEquals("1", charat_short.charAt(1));
120 } 90 }
121 91
122 // Run the test many times to ensure IC-s don't break things. 92 // Run the test many times to ensure IC-s don't break things.
123 for (var i = 0; i < 10; i++) { 93 for (var i = 0; i < 10; i++) {
124 test(); 94 test();
125 } 95 }
126 96
127 // Clean up string to make Valgrind happy. 97 // Clean up string to make Valgrind happy.
128 gc(); 98 gc();
129 gc(); 99 gc();
OLDNEW
« src/arm/code-stubs-arm.cc ('K') | « test/mjsunit/string-external-cached.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698