Reviewers: jasvir,
Description:
* moved benchmark examples into a subdir "sunspider"
* all the benchmark examples relied on including a script
<script src="sunspider-record-result.js"></script>
I'm not clear how the cajoler is supposed to resolve those
relative links; deferring that to later. for now I'm just
inlining the record() function.
* date-format-xparb relies extensively on eval(), it defines functions
using eval. it woulld need to be completely rewritten to work, so I
just removed it from the list of examples.
* date-format-tofte uses eval() to run functions in the local scope.
I replaced that eval with a lookup table.
* date-format-tofte tries to verify if Date#getFullYear works, in a
way that fails if you're in the wrong timezone, and then falls back
to getYear, which is deprecated, and not available in es53. the code
should be using Date#getUTCFullYear, but for some reason none of the
UTC
methods are whitelisted in es53.js (maybe pending implementation of
compatibility shims?) I changed the benchmark so that the getFullYear
test succeeds.
* date-format-tofte uses Date#setTime, which for some reason didn't
get whitelisted in es53.js, so I added it to the whitelist. afaik
setTime works on all browsers, so it doesn't need a compatibility
shim.
* string-tagcloud tries to define Object.prototype.toJSONString, which
fails. I ripped out all that code and used the JSON object instead.
* string-validate-input tries to assign some globals without declaring
them, which fails in es53, so I added 'var'.
with this change, every benchmark example works for me (though it's
not clear if all the benchmarks work correctly, which is a problem with
sunspider itself.)
Please review this at http://codereview.appspot.com/4298058/
Affected files:
M build.xml
M src/com/google/caja/demos/playground/client/ui/Example.java
D src/com/google/caja/demos/playground/setup-valija.js
M src/com/google/caja/es53.js
M third_party/js/sunspider-benchmark/3d-cube.html
M third_party/js/sunspider-benchmark/3d-morph.html
M third_party/js/sunspider-benchmark/3d-raytrace.html
M third_party/js/sunspider-benchmark/access-binary-trees.html
M third_party/js/sunspider-benchmark/access-fannkuch.html
M third_party/js/sunspider-benchmark/access-nbody.html
M third_party/js/sunspider-benchmark/access-nsieve.html
M third_party/js/sunspider-benchmark/bitops-3bit-bits-in-byte.html
M third_party/js/sunspider-benchmark/bitops-bits-in-byte.html
M third_party/js/sunspider-benchmark/bitops-bitwise-and.html
M third_party/js/sunspider-benchmark/bitops-nsieve-bits.html
M third_party/js/sunspider-benchmark/controlflow-recursive.html
M third_party/js/sunspider-benchmark/crypto-aes.html
M third_party/js/sunspider-benchmark/crypto-md5.html
M third_party/js/sunspider-benchmark/crypto-sha1.html
M third_party/js/sunspider-benchmark/date-format-tofte.html
M third_party/js/sunspider-benchmark/date-format-xparb.html
M third_party/js/sunspider-benchmark/math-cordic.html
M third_party/js/sunspider-benchmark/math-partial-sums.html
M third_party/js/sunspider-benchmark/math-spectral-norm.html
M third_party/js/sunspider-benchmark/regexp-dna.html
M third_party/js/sunspider-benchmark/string-base64.html
M third_party/js/sunspider-benchmark/string-fasta.html
M third_party/js/sunspider-benchmark/string-tagcloud.html
M third_party/js/sunspider-benchmark/string-unpack-code.html
M third_party/js/sunspider-benchmark/string-validate-input.html