date-local-time-slots-after-realm-time-zone-change-2.js (807B)
1 // |jit-test| tz-pacific; skip-if: typeof Intl === 'undefined' 2 3 // Create Date objects using the current local time zone, which is PST8PDT when 4 // running jit-tests. 5 var dates = [ 6 new Date(2000, 0, 1, 0), 7 new Date(2000, 0, 1, 1), 8 new Date(2000, 0, 1, 2), 9 new Date(2000, 0, 1, 3), 10 ]; 11 12 var addToHours = 0; 13 14 for (var i = 0; i < 250; ++i) { 15 // Use previously created Date objects. 16 var d = dates[i & 3]; 17 18 // |getHours| is inlined if no realm time zone override is present. 19 assertEq(d.getHours(), (i & 3) + addToHours); 20 21 if (i === 200) { 22 // Modify the realm time zone. This discards all JIT code and |getHours| is 23 // no longer inlinable. 24 setRealmTimeZone("EST5EDT"); 25 26 // The Date objects were created using PST8PDT, which is three hours behind EST5EDT. 27 addToHours = 3; 28 } 29 }