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

Side by Side Diff: test/mjsunit/compiler/symbol-protototype.js

Issue 1409163007: [turbofan] We can inline property access for all primitives. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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/compiler/boolean-protototype.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
(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 function test1(s) {
8 return s.toString;
9 }
10 assertSame(test1(Symbol()), Symbol.prototype.toString);
11 assertSame(test1(Symbol()), Symbol.prototype.toString);
12 %OptimizeFunctionOnNextCall(test1);
13 assertSame(test1(Symbol()), Symbol.prototype.toString);
14
15 function test2(s) {
16 return s.valueOf;
17 }
18 assertSame(test2(Symbol()), Symbol.prototype.valueOf);
19 assertSame(test2(Symbol()), Symbol.prototype.valueOf);
20 %OptimizeFunctionOnNextCall(test2);
21 assertSame(test2(Symbol()), Symbol.prototype.valueOf);
22
23 Symbol.prototype.foo = 1;
24 function test3(s) {
25 return s["foo"];
26 }
27 assertEquals(test3(Symbol()), 1);
28 assertEquals(test3(Symbol()), 1);
29 %OptimizeFunctionOnNextCall(test3);
30 assertEquals(test3(Symbol()), 1);
31
32 Symbol.prototype.bar = function() { "use strict"; return this; }
33 function test4(s) {
34 return s.bar();
35 }
36 var s = Symbol("foo");
37 assertEquals(test4(s), s);
38 assertEquals(test4(s), s);
39 %OptimizeFunctionOnNextCall(test4);
40 assertEquals(test4(s), s);
OLDNEW
« no previous file with comments | « test/mjsunit/compiler/boolean-protototype.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698