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

Side by Side Diff: test/mjsunit/thin-strings.js

Issue 2621913002: Revert of Internalize strings in-place (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « test/cctest/test-strings.cc ('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
(Empty)
1 // Copyright 2016 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: --allow-natives-syntax
6
7 function get_thin_string(a, b) {
8 var str = a + b; // Make a ConsString.
9 var o = {};
10 o[str]; // Turn it into a ThinString.
11 return str;
12 }
13
14 var str = get_thin_string("foo", "bar");
15
16 var re = /.o+ba./;
17 assertEquals(["foobar"], re.exec(str));
18 assertEquals(["foobar"], re.exec(str));
19 assertEquals(["foobar"], re.exec(str));
20
21 function CheckCS() {
22 assertEquals("o", str.substring(1, 2));
23 assertEquals("f".charCodeAt(0), str.charCodeAt(0));
24 assertEquals("f", str.split(/oo/)[0]);
25 }
26 CheckCS();
27 %OptimizeFunctionOnNextCall(CheckCS);
28 CheckCS();
29
30 function CheckTF() {
31 try {} catch(e) {} // Turbofan.
32 assertEquals("o", str.substring(1, 2));
33 assertEquals("f".charCodeAt(0), str.charCodeAt(0));
34 assertEquals("f", str.split(/oo/)[0]);
35 }
36 CheckTF();
37 %OptimizeFunctionOnNextCall(CheckTF);
38 CheckTF();
OLDNEW
« no previous file with comments | « test/cctest/test-strings.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698