Revision f230a1cf deps/v8/src/date.js

View differences:

deps/v8/src/date.js
41 41
}
42 42

  
43 43

  
44
var timezone_cache_time = $NaN;
44
var timezone_cache_time = NAN;
45 45
var timezone_cache_timezone;
46 46

  
47 47
function LocalTimezone(t) {
......
66 66

  
67 67
// ECMA 262 - 15.9.1.11
68 68
function MakeTime(hour, min, sec, ms) {
69
  if (!$isFinite(hour)) return $NaN;
70
  if (!$isFinite(min)) return $NaN;
71
  if (!$isFinite(sec)) return $NaN;
72
  if (!$isFinite(ms)) return $NaN;
69
  if (!$isFinite(hour)) return NAN;
70
  if (!$isFinite(min)) return NAN;
71
  if (!$isFinite(sec)) return NAN;
72
  if (!$isFinite(ms)) return NAN;
73 73
  return TO_INTEGER(hour) * msPerHour
74 74
      + TO_INTEGER(min) * msPerMinute
75 75
      + TO_INTEGER(sec) * msPerSecond
......
90 90
//     MakeDay(2007, -33, 1) --> MakeDay(2004, 3, 1)
91 91
//     MakeDay(2007, 14, -50) --> MakeDay(2007, 8, 11)
92 92
function MakeDay(year, month, date) {
93
  if (!$isFinite(year) || !$isFinite(month) || !$isFinite(date)) return $NaN;
93
  if (!$isFinite(year) || !$isFinite(month) || !$isFinite(date)) return NAN;
94 94

  
95 95
  // Convert to integer and map -0 to 0.
96 96
  year = TO_INTEGER_MAP_MINUS_ZERO(year);
......
99 99

  
100 100
  if (year < kMinYear || year > kMaxYear ||
101 101
      month < kMinMonth || month > kMaxMonth) {
102
    return $NaN;
102
    return NAN;
103 103
  }
104 104

  
105 105
  // Now we rely on year and month being SMIs.
......
115 115
  // is no way that the time can be within range even after UTC
116 116
  // conversion we return NaN immediately instead of relying on
117 117
  // TimeClip to do it.
118
  if ($abs(time) > MAX_TIME_BEFORE_UTC) return $NaN;
118
  if ($abs(time) > MAX_TIME_BEFORE_UTC) return NAN;
119 119
  return time;
120 120
}
121 121

  
122 122

  
123 123
// ECMA 262 - 15.9.1.14
124 124
function TimeClip(time) {
125
  if (!$isFinite(time)) return $NaN;
126
  if ($abs(time) > MAX_TIME_MS) return $NaN;
125
  if (!$isFinite(time)) return NAN;
126
  if ($abs(time) > MAX_TIME_MS) return NAN;
127 127
  return TO_INTEGER(time);
128 128
}
129 129

  
......
132 132
// strings over and over again.
133 133
var Date_cache = {
134 134
  // Cached time value.
135
  time: $NaN,
135
  time: NAN,
136 136
  // String input for which the cached time is valid.
137 137
  string: null
138 138
};
......
269 269
// ECMA 262 - 15.9.4.2
270 270
function DateParse(string) {
271 271
  var arr = %DateParseString(ToString(string), parse_buffer);
272
  if (IS_NULL(arr)) return $NaN;
272
  if (IS_NULL(arr)) return NAN;
273 273

  
274 274
  var day = MakeDay(arr[0], arr[1], arr[2]);
275 275
  var time = MakeTime(arr[3], arr[4], arr[5], arr[6]);
......
671 671
function DateSetYear(year) {
672 672
  CHECK_DATE(this);
673 673
  year = ToNumber(year);
674
  if (NUMBER_IS_NAN(year)) return SET_UTC_DATE_VALUE(this, $NaN);
674
  if (NUMBER_IS_NAN(year)) return SET_UTC_DATE_VALUE(this, NAN);
675 675
  year = (0 <= TO_INTEGER(year) && TO_INTEGER(year) <= 99)
676 676
      ? 1900 + TO_INTEGER(year) : year;
677 677
  var t = LOCAL_DATE_VALUE(this);
......
746 746

  
747 747
function ResetDateCache() {
748 748
  // Reset the timezone cache:
749
  timezone_cache_time = $NaN;
749
  timezone_cache_time = NAN;
750 750
  timezone_cache_timezone = undefined;
751 751

  
752 752
  // Reset the date cache:
753 753
  cache = Date_cache;
754
  cache.time = $NaN;
754
  cache.time = NAN;
755 755
  cache.string = null;
756 756
}
757 757

  
......
762 762
  %CheckIsBootstrapping();
763 763

  
764 764
  %SetCode($Date, DateConstructor);
765
  %FunctionSetPrototype($Date, new $Date($NaN));
765
  %FunctionSetPrototype($Date, new $Date(NAN));
766 766

  
767 767
  // Set up non-enumerable properties of the Date object itself.
768 768
  InstallFunctions($Date, DONT_ENUM, $Array(

Also available in: Unified diff