OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 X = initial_X; | 138 X = initial_X; |
139 }; | 139 }; |
140 | 140 |
141 for (var i = 0; i < 10; i++) fieldTest(i); | 141 for (var i = 0; i < 10; i++) fieldTest(i); |
142 } | 142 } |
143 | 143 |
144 runTest(); | 144 runTest(); |
145 | 145 |
146 | 146 |
147 // ---------------------------------------------------------------------- | 147 // ---------------------------------------------------------------------- |
| 148 // Indexed access. |
| 149 // ---------------------------------------------------------------------- |
| 150 runTest = function() { |
| 151 var o = [ 42, 43 ]; |
| 152 |
| 153 var initial_X = 0; |
| 154 var X = initial_X; |
| 155 var Y = 1; |
| 156 |
| 157 function fieldTest(change_index) { |
| 158 for (var i = 0; i < 10; i++) { |
| 159 var property = o[X]; |
| 160 if (i <= change_index) { |
| 161 assertEquals(42, property); |
| 162 } else { |
| 163 assertEquals(43, property); |
| 164 } |
| 165 if (i == change_index) X = Y; |
| 166 } |
| 167 X = initial_X; |
| 168 }; |
| 169 |
| 170 for (var i = 0; i < 10; i++) fieldTest(i); |
| 171 } |
| 172 |
| 173 runTest(); |
| 174 |
| 175 |
| 176 // ---------------------------------------------------------------------- |
148 // Constant function access. | 177 // Constant function access. |
149 // ---------------------------------------------------------------------- | 178 // ---------------------------------------------------------------------- |
150 runTest = function() { | 179 runTest = function() { |
151 function fun() { }; | 180 function fun() { }; |
152 | 181 |
153 var o = new Object(); | 182 var o = new Object(); |
154 o.f = fun; | 183 o.f = fun; |
155 o.x = 42; | 184 o.x = 42; |
156 | 185 |
157 var initial_F = 'f'; | 186 var initial_F = 'f'; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 } | 227 } |
199 if (i == change_index) X = Y; | 228 if (i == change_index) X = Y; |
200 } | 229 } |
201 X = initial_X; | 230 X = initial_X; |
202 }; | 231 }; |
203 | 232 |
204 for (var i = 0; i < 10; i++) fieldTest(i); | 233 for (var i = 0; i < 10; i++) fieldTest(i); |
205 } | 234 } |
206 | 235 |
207 runTest(); | 236 runTest(); |
OLD | NEW |