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

Unified Diff: test/mjsunit/string-replace-with-empty.js

Issue 4116005: Make ExternalizeStringExtension free its data on exit to please (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/string-externalize.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/string-replace-with-empty.js
===================================================================
--- test/mjsunit/string-replace-with-empty.js (revision 5717)
+++ test/mjsunit/string-replace-with-empty.js (working copy)
@@ -25,33 +25,45 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --expose-externalize-string
+// Flags: --expose-externalize-string --expose-gc
-assertEquals("0123", "aa0bb1cc2dd3".replace(/[a-z]/g, ""));
-assertEquals("0123", "\u1234a0bb1cc2dd3".replace(/[\u1234a-z]/g, ""));
+function test() {
+ assertEquals("0123", "aa0bb1cc2dd3".replace(/[a-z]/g, ""));
+ assertEquals("0123", "\u1234a0bb1cc2dd3".replace(/[\u1234a-z]/g, ""));
-var expected = "0123";
-var cons = "a0b1c2d3";
-for (var i = 0; i < 5; i++) {
- expected += expected;
- cons += cons;
+ var expected = "0123";
+ var cons = "a0b1c2d3";
+ for (var i = 0; i < 5; i++) {
+ expected += expected;
+ cons += cons;
+ }
+ assertEquals(expected, cons.replace(/[a-z]/g, ""));
+ cons = "\u12340b1c2d3";
+ for (var i = 0; i < 5; i++) {
+ cons += cons;
+ }
+ assertEquals(expected, cons.replace(/[\u1234a-z]/g, ""));
+
+ cons = "a0b1c2d3";
+ for (var i = 0; i < 5; i++) {
+ cons += cons;
+ }
+ externalizeString(cons, true/* force two-byte */);
+ assertEquals(expected, cons.replace(/[a-z]/g, ""));
+ cons = "\u12340b1c2d3";
+ for (var i = 0; i < 5; i++) {
+ cons += cons;
+ }
+ externalizeString(cons);
+ assertEquals(expected, cons.replace(/[\u1234a-z]/g, ""));
}
-assertEquals(expected, cons.replace(/[a-z]/g, ""));
-cons = "\u12340b1c2d3";
-for (var i = 0; i < 5; i++) {
- cons += cons;
-}
-assertEquals(expected, cons.replace(/[\u1234a-z]/g, ""));
-cons = "a0b1c2d3";
-for (var i = 0; i < 5; i++) {
- cons += cons;
-}
-externalizeString(cons, true/* force two-byte */);
-assertEquals(expected, cons.replace(/[a-z]/g, ""));
-cons = "\u12340b1c2d3";
-for (var i = 0; i < 5; i++) {
- cons += cons;
-}
-externalizeString(cons);
-assertEquals(expected, cons.replace(/[\u1234a-z]/g, ""));
+test();
+
+// Clear the regexp cache to allow the GC to work.
+"foo".replace(/foo/g, "");
+
+// GC in order to free up things on the C side so we don't get
+// a memory leak. This makes valgrind happy.
+gc();
+gc();
« no previous file with comments | « test/mjsunit/string-externalize.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698