MissingPropertyCache4.js 762 B

123456789101112131415
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. function fn() {
  6. var o = {};
  7. var p = {};
  8. o.__proto__ = p;
  9. o.pizza; // Fill missing property cache
  10. p.__proto__ = { pizza: 'pizza' }; // Add property to o's prototype chain: should invalidate cache
  11. return o.pizza; // Look for property again
  12. }
  13. if (fn() === 'pizza')
  14. WScript.Echo('pass');