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

Side by Side Diff: test/mjsunit/array-bounds-check-removal.js

Issue 10581014: BoundsCheck should be extended to support array_bounds_checks_elimination (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 6 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/lithium-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
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 check_test_minus(7,true); 116 check_test_minus(7,true);
117 test_minus(7,false); 117 test_minus(7,false);
118 check_test_minus(7,false); 118 check_test_minus(7,false);
119 119
120 // Optimization status: 120 // Optimization status:
121 // YES: 1 121 // YES: 1
122 // NO: 2 122 // NO: 2
123 // ALWAYS: 3 123 // ALWAYS: 3
124 // NEVER: 4 124 // NEVER: 4
125 125
126 if (false) { 126 if (true) {
127 test_base(5,true); 127 test_base(5,true);
128 test_base(6,true); 128 test_base(6,true);
129 test_base(5,false); 129 test_base(5,false);
130 test_base(6,false); 130 test_base(6,false);
131 %OptimizeFunctionOnNextCall(test_base); 131 %OptimizeFunctionOnNextCall(test_base);
132 test_base(-2,true); 132 test_base(-2,true);
133 assertTrue(%GetOptimizationStatus(test_base) != 1); 133 assertTrue(%GetOptimizationStatus(test_base) != 1);
134 134
135 test_base(5,true); 135 test_base(5,true);
136 test_base(6,true); 136 test_base(6,true);
137 test_base(5,false); 137 test_base(5,false);
138 test_base(6,false); 138 test_base(6,false);
139 %OptimizeFunctionOnNextCall(test_base); 139 %OptimizeFunctionOnNextCall(test_base);
140 test_base(2048,true); 140 test_base(2048,true);
141 assertTrue(%GetOptimizationStatus(test_base) != 1); 141 assertTrue(%GetOptimizationStatus(test_base) != 1);
142 } 142 }
143 143
144 gc(); 144 gc();
145 145
146 var b1 = new Array(2000);
147 var b2 = new Array(200);
148
149 function test_bounds_calc_overflow(a,base) {
150 a[base + 11] = 3;
151 a[base] = 4;
152 a[base + 999] = 5;
153 }
154
155 var i;
156 var b0 = new Array(10000);
157 for (i = 0; i < b0.length; i++)
158 b0[i] = 0xFEED;
159
160 test_bounds_calc_overflow(b1, 10);
161 %OptimizeFunctionOnNextCall(test_bounds_calc_overflow);
162 test_bounds_calc_overflow(b2, 0);
163
164 for (i = 0; i < b0.length; i++)
165 assertEquals(0xFEED, b0[i]);
166 assertEquals(1000, b2.length);
167 assertEquals(5, b2[999]);
168 assertTrue(%GetOptimizationStatus(test_bounds_calc_overflow) != 1);
OLDNEW
« no previous file with comments | « src/x64/lithium-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698