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

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

Issue 106973005: Improve load elimination handling of transitioning stores. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added new cases to existing load elimination tests. Created 7 years 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/hydrogen-load-elimination.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
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 17 matching lines...) Expand all
28 // Flags: --allow-natives-syntax --load-elimination 28 // Flags: --allow-natives-syntax --load-elimination
29 29
30 // Test local load elimination of redundant loads and stores. 30 // Test local load elimination of redundant loads and stores.
31 31
32 function B(x, y) { 32 function B(x, y) {
33 this.x = x; 33 this.x = x;
34 this.y = y; 34 this.y = y;
35 return this; 35 return this;
36 } 36 }
37 37
38 function C() {
39 }
40
38 function test_load() { 41 function test_load() {
39 var a = new B(1, 2); 42 var a = new B(1, 2);
40 return a.x + a.x + a.x + a.x; 43 return a.x + a.x + a.x + a.x;
41 } 44 }
42 45
43 function test_store_load() { 46 function test_store_load() {
44 var a = new B(1, 2); 47 var a = new B(1, 2);
45 a.x = 4; 48 a.x = 4;
46 var f = a.x; 49 var f = a.x;
47 a.x = 5; 50 a.x = 5;
48 var g = a.x; 51 var g = a.x;
49 a.x = 6; 52 a.x = 6;
50 var h = a.x; 53 var h = a.x;
51 a.x = 7; 54 a.x = 7;
52 return f + g + h + a.x; 55 return f + g + h + a.x;
53 } 56 }
54 57
55 function test_nonaliasing_store1() { 58 function test_nonaliasing_store1() {
56 var a = new B(2, 3), b = new B(3, 4); 59 var a = new B(2, 3), b = new B(3, 4);
57 b.x = 4; 60 b.x = 4;
58 var f = a.x; 61 var f = a.x;
59 b.x = 5; 62 b.x = 5;
60 var g = a.x; 63 var g = a.x;
61 b.x = 6; 64 b.x = 6;
62 var h = a.x; 65 var h = a.x;
63 b.x = 7; 66 b.x = 7;
64 return f + g + h + a.x; 67 return f + g + h + a.x;
65 } 68 }
66 69
70 function test_transitioning_store1() {
71 var a = new B(2, 3);
72 var f = a.x, g = a.y;
73 var b = new B(3, 4);
74 return a.x + a.y;
75 }
76
77 function test_transitioning_store2() {
78 var b = new C();
79 var a = new B(-1, 5);
80 var f = a.x, g = a.y;
81 b.x = 9;
82 b.y = 11;
83 return a.x + a.y;
84 }
85
67 function killall() { 86 function killall() {
68 try { } catch(e) { } 87 try { } catch(e) { }
69 } 88 }
70 89
71 %NeverOptimizeFunction(killall); 90 %NeverOptimizeFunction(killall);
72 91
73 function test_store_load_kill() { 92 function test_store_load_kill() {
74 var a = new B(1, 2); 93 var a = new B(1, 2);
75 a.x = 4; 94 a.x = 4;
76 var f = a.x; 95 var f = a.x;
(...skipping 18 matching lines...) Expand all
95 function test(x, f) { 114 function test(x, f) {
96 assertEquals(x, f()); 115 assertEquals(x, f());
97 assertEquals(x, f()); 116 assertEquals(x, f());
98 %OptimizeFunctionOnNextCall(f); 117 %OptimizeFunctionOnNextCall(f);
99 assertEquals(x, f()); 118 assertEquals(x, f());
100 } 119 }
101 120
102 test(4, test_load); 121 test(4, test_load);
103 test(22, test_store_load); 122 test(22, test_store_load);
104 test(8, test_nonaliasing_store1); 123 test(8, test_nonaliasing_store1);
124 test(5, test_transitioning_store1);
125 test(4, test_transitioning_store2);
105 test(22, test_store_load_kill); 126 test(22, test_store_load_kill);
106 test(7, test_store_store); 127 test(7, test_store_store);
OLDNEW
« no previous file with comments | « src/hydrogen-load-elimination.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698