copyprop.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 TestCacheAtWrite(expvalue)
  6. {
  7. var temp = expvalue;
  8. var startvalue = expvalue;
  9. for(var k=0;k<3;k++)
  10. {
  11. if(k>=2)
  12. {
  13. //donot update the cache the next two times
  14. startvalue = temp;
  15. WScript.Echo("startvalue: "+startvalue);
  16. }
  17. else
  18. {
  19. //Keep updating the cache for the first two times
  20. expvalue = startvalue;
  21. }
  22. startvalue++;
  23. }
  24. }
  25. TestCacheAtWrite(0);
  26. // Test a loop nest with a cycle of assignments.
  27. function testcycle(){
  28. var obj0 = {};
  29. var obj1 = {};
  30. var ary = new Array(10);
  31. var ui16 = new Uint16Array(256);
  32. var c = 1;
  33. obj1.length >>>=1;
  34. var __loopvar4 = 0;
  35. while(((obj1.prop0 &= (c %= 1))) && __loopvar4 < 3) {
  36. __loopvar4++;
  37. }
  38. for(var __loopvar1 = 0; __loopvar1 < 3; __loopvar1++) {
  39. b =c;
  40. var __loopvar2 = 0;
  41. for(var strvar0 in ui16 ) {
  42. if(__loopvar2++ > 3) break;
  43. d =b;
  44. ary[(15)] = (b-- );
  45. obj0.prop0 =(obj1.length++ );
  46. c =d;
  47. }
  48. }
  49. WScript.Echo("d = " + (d|0));
  50. };
  51. testcycle();
  52. function testcycle2(){
  53. var obj0 = {};
  54. var obj1 = {};
  55. var func0 = function(p0){
  56. obj0.prop0;
  57. }
  58. obj1.method0 = func0;
  59. var obj3 = obj0;
  60. var i = 0;
  61. while(i < 3) {
  62. i++;
  63. obj0 = obj3;
  64. obj3 = obj1;
  65. }
  66. obj0.method0()
  67. };
  68. // generate profile
  69. testcycle2();
  70. // run JITted code
  71. testcycle2();