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

Side by Side Diff: test/mjsunit/compiler/boolean-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 | « src/objects-inl.h ('k') | test/mjsunit/compiler/symbol-protototype.js » ('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 function test1(s) {
8 return s.toString;
9 }
10 assertSame(test1(false), Boolean.prototype.toString);
11 assertSame(test1(true), Boolean.prototype.toString);
12 %OptimizeFunctionOnNextCall(test1);
13 assertSame(test1(false), Boolean.prototype.toString);
14 assertSame(test1(true), Boolean.prototype.toString);
15
16 function test2(s) {
17 return s.valueOf;
18 }
19 assertSame(test2(false), Boolean.prototype.valueOf);
20 assertSame(test2(true), Boolean.prototype.valueOf);
21 %OptimizeFunctionOnNextCall(test2);
22 assertSame(test2(false), Boolean.prototype.valueOf);
23 assertSame(test2(true), Boolean.prototype.valueOf);
24
25 Boolean.prototype.foo = 42;
26 function test3(s) {
27 return s["foo"];
28 }
29 assertEquals(test3(false), 42);
30 assertEquals(test3(true), 42);
31 %OptimizeFunctionOnNextCall(test3);
32 assertEquals(test3(false), 42);
33 assertEquals(test3(true), 42);
34
35 Boolean.prototype.bar = function bar() { "use strict"; return this; }
36 function test4(s) {
37 return s.bar();
38 }
39 assertEquals(test4(false), false);
40 assertEquals(test4(true), true);
41 %OptimizeFunctionOnNextCall(test4);
42 assertEquals(test4(false), false);
43 assertEquals(test4(true), true);
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | test/mjsunit/compiler/symbol-protototype.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698