/js/src/jit-test/tests/jaeger/bug670885.js

http://github.com/zpao/v8monkey · JavaScript · 16 lines · 14 code · 0 blank · 2 comment · 1 complexity · 9a65a78f316cc24b5e030bd8f33e0e8e MD5 · raw file

  1. // arr is an Int8Array, then changes to Int16Array.
  2. // This should trigger recompilation of f.
  3. var arr = new Int8Array(100);
  4. var arr16 = new Int16Array(100);
  5. arr16[2] = 12345;
  6. function f(a) {
  7. var x;
  8. for(var i=0; i<30; i++) {
  9. x = a[2];
  10. }
  11. return x;
  12. }
  13. assertEq(f(arr), 0);
  14. assertEq(f(arr), 0);
  15. this.arr = arr16;
  16. assertEq(f(arr), 12345);