/js/src/jit-test/tests/jaeger/propertyOptimize-4.js

http://github.com/zpao/v8monkey · JavaScript · 17 lines · 12 code · 3 blank · 2 comment · 0 complexity · 1a8739028e467c82b934b18fc4cb306a MD5 · raw file

  1. // Make sure new script properties can be invalidated on specialized prototype
  2. // types while they are still being constructed.
  3. function Foo(a, b, c) {
  4. this.x = a + b;
  5. this.y = c;
  6. }
  7. updated = false;
  8. var o = {valueOf: function() {
  9. Object.defineProperty(Object.prototype, 'y', {set:function() { updated = true; }})
  10. }};
  11. function Bar() {}
  12. Bar.prototype = new Foo(o, 1, 2);
  13. assertEq(updated, true);
  14. assertEq(Bar.prototype.y, undefined);