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

Side by Side Diff: test/mjsunit/compiler/load-elimination.js

Issue 185653004: Experimental parser: merge to r19637 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 37
38 function C() { 38 function C() {
39 } 39 }
40 40
41 function test_load() { 41 function test_load() {
42 var a = new B(1, 2); 42 var a = new B(1, 2);
43 return a.x + a.x + a.x + a.x; 43 return a.x + a.x + a.x + a.x;
44 } 44 }
45 45
46
47 function test_load_from_different_contexts() {
48 var r = 1;
49 this.f = function() {
50 var fr = r;
51 this.g = function(flag) {
52 var gr;
53 if (flag) {
54 gr = r;
55 } else {
56 gr = r;
57 }
58 return gr + r + fr;
59 };
60 };
61 this.f();
62 return this.g(true);
63 }
64
65
46 function test_store_load() { 66 function test_store_load() {
47 var a = new B(1, 2); 67 var a = new B(1, 2);
48 a.x = 4; 68 a.x = 4;
49 var f = a.x; 69 var f = a.x;
50 a.x = 5; 70 a.x = 5;
51 var g = a.x; 71 var g = a.x;
52 a.x = 6; 72 a.x = 6;
53 var h = a.x; 73 var h = a.x;
54 a.x = 7; 74 a.x = 7;
55 return f + g + h + a.x; 75 return f + g + h + a.x;
(...skipping 20 matching lines...) Expand all
76 96
77 function test_transitioning_store2() { 97 function test_transitioning_store2() {
78 var b = new C(); 98 var b = new C();
79 var a = new B(-1, 5); 99 var a = new B(-1, 5);
80 var f = a.x, g = a.y; 100 var f = a.x, g = a.y;
81 b.x = 9; 101 b.x = 9;
82 b.y = 11; 102 b.y = 11;
83 return a.x + a.y; 103 return a.x + a.y;
84 } 104 }
85 105
106 var false_v = false;
107 function test_transitioning_store3() {
108 var o = new C();
109 var v = o;
110 if (false_v) v = 0;
111 v.x = 20;
112 return o.x;
113 }
114
86 function killall() { 115 function killall() {
87 try { } catch(e) { } 116 try { } catch(e) { }
88 } 117 }
89 118
90 %NeverOptimizeFunction(killall); 119 %NeverOptimizeFunction(killall);
91 120
92 function test_store_load_kill() { 121 function test_store_load_kill() {
93 var a = new B(1, 2); 122 var a = new B(1, 2);
94 a.x = 4; 123 a.x = 4;
95 var f = a.x; 124 var f = a.x;
(...skipping 16 matching lines...) Expand all
112 } 141 }
113 142
114 function test(x, f) { 143 function test(x, f) {
115 assertEquals(x, f()); 144 assertEquals(x, f());
116 assertEquals(x, f()); 145 assertEquals(x, f());
117 %OptimizeFunctionOnNextCall(f); 146 %OptimizeFunctionOnNextCall(f);
118 assertEquals(x, f()); 147 assertEquals(x, f());
119 } 148 }
120 149
121 test(4, test_load); 150 test(4, test_load);
151 test(3, new test_load_from_different_contexts().g);
122 test(22, test_store_load); 152 test(22, test_store_load);
123 test(8, test_nonaliasing_store1); 153 test(8, test_nonaliasing_store1);
124 test(5, test_transitioning_store1); 154 test(5, test_transitioning_store1);
125 test(4, test_transitioning_store2); 155 test(4, test_transitioning_store2);
156 test(20, test_transitioning_store3);
126 test(22, test_store_load_kill); 157 test(22, test_store_load_kill);
127 test(7, test_store_store); 158 test(7, test_store_store);
OLDNEW
« no previous file with comments | « test/mjsunit/compiler/escape-analysis-arguments.js ('k') | test/mjsunit/compiler/regress-arguments.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698