Move JSC::parseDate() from DateConversion to JSDateMath
https://bugs.webkit.org/show_bug.cgi?id=91982
Reviewed by Geoffrey Garen.
Moveing this function into the other files removes the dependency
on JSC spcific classes in DateConversion.{cpp|h}.
* runtime/DateConversion.cpp:
* runtime/DateConversion.h:
(JSC):
* runtime/JSDateMath.cpp:
(JSC::parseDate):
(JSC):
* runtime/JSDateMath.h:
(JSC):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123376 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/runtime/JSDateMath.cpp b/Source/JavaScriptCore/runtime/JSDateMath.cpp
index dbe7488..0dbeea4 100644
--- a/Source/JavaScriptCore/runtime/JSDateMath.cpp
+++ b/Source/JavaScriptCore/runtime/JSDateMath.cpp
@@ -259,4 +259,16 @@
return ms - (offset * WTF::msPerMinute);
}
+double parseDate(ExecState* exec, const UString& date)
+{
+ if (date == exec->globalData().cachedDateString)
+ return exec->globalData().cachedDateStringValue;
+ double value = parseES5DateFromNullTerminatedCharacters(date.utf8().data());
+ if (isnan(value))
+ value = parseDateFromNullTerminatedCharacters(exec, date.utf8().data());
+ exec->globalData().cachedDateString = date;
+ exec->globalData().cachedDateStringValue = value;
+ return value;
+}
+
} // namespace JSC