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

Side by Side Diff: test/mjsunit/compiler/string-length.js

Issue 1224083002: Revert of [turbofan] Optimize string "length" property access based on types. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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 | « src/compiler/pipeline.cc ('k') | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | 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 2015 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 assertEquals(0, "".length);
8 assertEquals(1, "a".length);
9 assertEquals(2, ("a" + "b").length);
10
11 function id(x) { return x; }
12
13 function f1(x) {
14 return x.length;
15 }
16 assertEquals(0, f1(""));
17 assertEquals(1, f1("a"));
18 %OptimizeFunctionOnNextCall(f1);
19 assertEquals(2, f1("a" + "b"));
20 assertEquals(3, f1(id("a") + id("b" + id("c"))))
21
22 function f2(x, y, z) {
23 x = x ? "" + y : "" + z;
24 return x.length;
25 }
26 assertEquals(0, f2(true, "", "a"));
27 assertEquals(1, f2(false, "", "a"));
28 %OptimizeFunctionOnNextCall(f2);
29 assertEquals(0, f2(true, "", "a"));
30 assertEquals(1, f2(false, "", "a"));
31 assertEquals(3, f2(true, id("a") + id("b" + id("c")), ""));
OLDNEW
« no previous file with comments | « src/compiler/pipeline.cc ('k') | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698