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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 71 } |
72 | 72 |
73 | 73 |
74 // Keep track of all declared benchmark suites. | 74 // Keep track of all declared benchmark suites. |
75 BenchmarkSuite.suites = []; | 75 BenchmarkSuite.suites = []; |
76 | 76 |
77 | 77 |
78 // Scores are not comparable across versions. Bump the version if | 78 // Scores are not comparable across versions. Bump the version if |
79 // you're making changes that will affect that scores, e.g. if you add | 79 // you're making changes that will affect that scores, e.g. if you add |
80 // a new benchmark or change an existing one. | 80 // a new benchmark or change an existing one. |
81 BenchmarkSuite.version = '4'; | 81 BenchmarkSuite.version = '5'; |
82 | 82 |
83 | 83 |
84 // To make the benchmark results predictable, we replace Math.random | 84 // To make the benchmark results predictable, we replace Math.random |
85 // with a 100% deterministic alternative. | 85 // with a 100% deterministic alternative. |
86 Math.random = (function() { | 86 Math.random = (function() { |
87 var seed = 49734321; | 87 var seed = 49734321; |
88 return function() { | 88 return function() { |
89 // Robert Jenkins' 32 bit integer hash function. | 89 // Robert Jenkins' 32 bit integer hash function. |
90 seed = ((seed + 0x7ed55d16) + (seed << 12)) & 0xffffffff; | 90 seed = ((seed + 0x7ed55d16) + (seed << 12)) & 0xffffffff; |
91 seed = ((seed ^ 0xc761c23c) ^ (seed >>> 19)) & 0xffffffff; | 91 seed = ((seed ^ 0xc761c23c) ^ (seed >>> 19)) & 0xffffffff; |
92 seed = ((seed + 0x165667b1) + (seed << 5)) & 0xffffffff; | 92 seed = ((seed + 0x165667b1) + (seed << 5)) & 0xffffffff; |
93 seed = ((seed + 0xd3a2646c) ^ (seed << 9)) & 0xffffffff; | 93 seed = ((seed + 0xd3a2646c) ^ (seed << 9)) & 0xffffffff; |
94 seed = ((seed + 0xd3a2646c) ^ (seed << 9)) & 0xffffffff; | |
95 seed = ((seed + 0xfd7046c5) + (seed << 3)) & 0xffffffff; | 94 seed = ((seed + 0xfd7046c5) + (seed << 3)) & 0xffffffff; |
96 seed = ((seed ^ 0xb55a4f09) ^ (seed >>> 16)) & 0xffffffff; | 95 seed = ((seed ^ 0xb55a4f09) ^ (seed >>> 16)) & 0xffffffff; |
97 return (seed & 0xfffffff) / 0x10000000; | 96 return (seed & 0xfffffff) / 0x10000000; |
98 }; | 97 }; |
99 })(); | 98 })(); |
100 | 99 |
101 | 100 |
102 // Runs all registered benchmark suites and optionally yields between | 101 // Runs all registered benchmark suites and optionally yields between |
103 // each individual benchmark to avoid running for too long in the | 102 // each individual benchmark to avoid running for too long in the |
104 // context of browsers. Once done, the final score is reported to the | 103 // context of browsers. Once done, the final score is reported to the |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 } catch (e) { | 255 } catch (e) { |
257 suite.NotifyError(e); | 256 suite.NotifyError(e); |
258 return null; | 257 return null; |
259 } | 258 } |
260 return RunNextSetup; | 259 return RunNextSetup; |
261 } | 260 } |
262 | 261 |
263 // Start out running the setup. | 262 // Start out running the setup. |
264 return RunNextSetup(); | 263 return RunNextSetup(); |
265 } | 264 } |
OLD | NEW |