Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 o.c = 3; | 235 o.c = 3; |
| 236 o.d = 4; | 236 o.d = 4; |
| 237 o.e = 5; | 237 o.e = 5; |
| 238 o.f = 6; | 238 o.f = 6; |
| 239 return o; | 239 return o; |
| 240 }, function (t) { | 240 }, function (t) { |
| 241 var r = []; | 241 var r = []; |
| 242 for (var i in t) r.push(i + t[i]); | 242 for (var i in t) r.push(i + t[i]); |
| 243 return r.join(''); | 243 return r.join(''); |
| 244 }); | 244 }); |
| 245 | |
| 246 // Test OSR inside for each. | |
|
fschneider
2012/02/22 15:29:59
s/for each/for-in/
| |
| 247 function osr (t) { | |
| 248 var sum = 0; | |
| 249 for (var x in t) { | |
| 250 for (var i = 0; i < t[x].length; i++) { | |
| 251 sum += t[x][i]; | |
| 252 } | |
| 253 } | |
| 254 return sum; | |
| 255 } | |
| 256 | |
| 257 function test_osr() { | |
| 258 with ({}) {} // Disable optimizations of this function. | |
| 259 var arr = new Array(1000000); | |
| 260 for (var i = 0; i < arr.length; i++) arr[i] = i; | |
| 261 osr({x: arr}); | |
| 262 } | |
| 263 | |
| 264 test_osr(); | |
| OLD | NEW |