/js/src/jit-test/tests/basic/testArrayInWithIndexedProto.js

http://github.com/zpao/v8monkey · JavaScript · 24 lines · 17 code · 3 blank · 4 comment · 2 complexity · 3a80644958fa0705004de82ba96f3ebd MD5 · raw file

  1. function testArrayInWithIndexedProto()
  2. {
  3. Array.prototype[0] = "Got me";
  4. var zeroPresent, zeroPresent2;
  5. // Need to go to 18 because in the failure mode this is
  6. // testing we have various side-exits in there due to interp and
  7. // tracer not agreeing that confuse the issue and cause us to not
  8. // hit the bad case within 9 iterations.
  9. for (var j = 0; j < 18; ++j) {
  10. zeroPresent = 0 in [];
  11. }
  12. var arr = [1, 2];
  13. delete arr[0];
  14. for (var j = 0; j < 18; ++j) {
  15. zeroPresent2 = 0 in arr;
  16. }
  17. return [zeroPresent, zeroPresent2];
  18. }
  19. var [ret, ret2] = testArrayInWithIndexedProto();
  20. assertEq(ret, true);
  21. assertEq(ret2, true);