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

Side by Side Diff: test/mjsunit/field-type-tracking.js

Issue 236843002: Revert "Track field types." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/stub-cache-x64.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 2014 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 --nostress-opt --track-field-types
6
7 (function() {
8 var o = { text: "Hello World!" };
9 function A() {
10 this.a = o;
11 }
12 function readA(x) {
13 return x.a;
14 }
15 var a = new A();
16 assertUnoptimized(readA);
17 readA(a); readA(a); readA(a);
18 %OptimizeFunctionOnNextCall(readA);
19 assertEquals(readA(a), o);
20 assertOptimized(readA);
21
22 var b = new A();
23 b.b = o;
24 assertEquals(readA(b), o);
25 assertUnoptimized(readA);
26 %OptimizeFunctionOnNextCall(readA);
27 assertEquals(readA(a), o);
28 assertOptimized(readA);
29 assertEquals(readA(a), o);
30 assertEquals(readA(b), o);
31 assertOptimized(readA);
32
33 function readAFromB(x) {
34 return x.a;
35 }
36 assertUnoptimized(readAFromB);
37 readAFromB(b); readAFromB(b); readAFromB(b);
38 %OptimizeFunctionOnNextCall(readAFromB);
39 assertEquals(readAFromB(b), o);
40 assertOptimized(readAFromB);
41
42 var c = new A();
43 c.c = o;
44 assertOptimized(readA);
45 assertOptimized(readAFromB);
46 c.a = [1];
47 assertUnoptimized(readA);
48 assertUnoptimized(readAFromB);
49 assertEquals(readA(a), o);
50 assertEquals(readA(b), o);
51 assertEquals(readA(c), [1]);
52 assertEquals(readAFromB(b), o);
53
54 %OptimizeFunctionOnNextCall(readA);
55 assertEquals(readA(a), o);
56 %OptimizeFunctionOnNextCall(readAFromB);
57 assertEquals(readAFromB(b), o);
58 assertOptimized(readA);
59 a.a = [1];
60 assertEquals(readA(a), [1]);
61 assertEquals(readA(b), o);
62 assertEquals(readA(c), [1]);
63 assertOptimized(readA);
64 b.a = [1];
65 assertEquals(readA(a), [1]);
66 assertEquals(readA(b), [1]);
67 assertEquals(readA(c), [1]);
68 assertOptimized(readA);
69 assertOptimized(readAFromB);
70 })();
71
72 (function() {
73 function A() { this.x = 0; }
74 A.prototype = {y: 20};
75 function B(o) { return o.a.y; }
76 function C() { this.a = new A(); }
77
78 B(new C());
79 B(new C());
80 %OptimizeFunctionOnNextCall(B);
81 var c = new C();
82 assertEquals(20, B(c));
83 assertOptimized(B);
84 c.a.y = 10;
85 assertEquals(10, B(c));
86 assertUnoptimized(B);
87
88 var c = new C();
89 %OptimizeFunctionOnNextCall(B);
90 assertEquals(20, B(c));
91 assertOptimized(B);
92 c.a.y = 30;
93 assertEquals(30, B(c));
94 assertOptimized(B);
95 })();
96
97 (function() {
98 var x = new Object();
99 x.a = 1 + "Long string that results in a cons string";
100 x = JSON.parse('{"a":"Short"}');
101 })();
102
103 (function() {
104 var x = {y: {z: 1}};
105 x.y.z = 1.1;
106 })();
OLDNEW
« no previous file with comments | « src/x64/stub-cache-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698