Improved frame merge code generated by the code generator.
Optimized String.prototype.replace.
Implemented __defineGetter__ and __defineSetter__ for properties with integer keys on non-array objects.
Improved debugger and profiler support.
Fixed a number of portability issues to allow compilation for smaller ARM devices.
Exposed object cloning through the API.
Implemented hidden properties. This is used to expose an identity hash for objects through the API.
Implemented restarting of regular expressions if their input string changes representation during preemption.
Fixed a code generator bug that could cause assignments in loops to be ignored if using continue to break out of the loop (issue 284).
git-svn-id: http://v8.googlecode.com/svn/trunk@1598 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/dateparser.cc b/src/dateparser.cc
index 4b64785..a1ae55d 100644
--- a/src/dateparser.cc
+++ b/src/dateparser.cc
@@ -31,84 +31,6 @@
namespace v8 { namespace internal {
-
-bool DateParser::Parse(String* str, FixedArray* out) {
- ASSERT(out->length() == OUTPUT_SIZE);
-
- InputReader in(str);
- TimeZoneComposer tz;
- TimeComposer time;
- DayComposer day;
-
- while (!in.IsEnd()) {
- if (in.IsAsciiDigit()) {
- // Parse a number (possibly with 1 or 2 trailing colons).
- int n = in.ReadUnsignedNumber();
- if (in.Skip(':')) {
- if (in.Skip(':')) {
- // n + "::"
- if (!time.IsEmpty()) return false;
- time.Add(n);
- time.Add(0);
- } else {
- // n + ":"
- if (!time.Add(n)) return false;
- }
- } else if (tz.IsExpecting(n)) {
- tz.SetAbsoluteMinute(n);
- } else if (time.IsExpecting(n)) {
- time.AddFinal(n);
- // Require end or white space immediately after finalizing time.
- if (!in.IsEnd() && !in.SkipWhiteSpace()) return false;
- } else {
- if (!day.Add(n)) return false;
- in.Skip('-'); // Ignore suffix '-' for year, month, or day.
- }
- } else if (in.IsAsciiAlphaOrAbove()) {
- // Parse a "word" (sequence of chars. >= 'A').
- uint32_t pre[KeywordTable::kPrefixLength];
- int len = in.ReadWord(pre, KeywordTable::kPrefixLength);
- int index = KeywordTable::Lookup(pre, len);
- KeywordType type = KeywordTable::GetType(index);
-
- if (type == AM_PM && !time.IsEmpty()) {
- time.SetHourOffset(KeywordTable::GetValue(index));
- } else if (type == MONTH_NAME) {
- day.SetNamedMonth(KeywordTable::GetValue(index));
- in.Skip('-'); // Ignore suffix '-' for month names
- } else if (type == TIME_ZONE_NAME && in.HasReadNumber()) {
- tz.Set(KeywordTable::GetValue(index));
- } else {
- // Garbage words are illegal if no number read yet.
- if (in.HasReadNumber()) return false;
- }
- } else if (in.IsAsciiSign() && (tz.IsUTC() || !time.IsEmpty())) {
- // Parse UTC offset (only after UTC or time).
- tz.SetSign(in.GetAsciiSignValue());
- in.Next();
- int n = in.ReadUnsignedNumber();
- if (in.Skip(':')) {
- tz.SetAbsoluteHour(n);
- tz.SetAbsoluteMinute(kNone);
- } else {
- tz.SetAbsoluteHour(n / 100);
- tz.SetAbsoluteMinute(n % 100);
- }
- } else if (in.Is('(')) {
- // Ignore anything from '(' to a matching ')' or end of string.
- in.SkipParentheses();
- } else if ((in.IsAsciiSign() || in.Is(')')) && in.HasReadNumber()) {
- // Extra sign or ')' is illegal if no number read yet.
- return false;
- } else {
- // Ignore other characters.
- in.Next();
- }
- }
- return day.Write(out) && time.Write(out) && tz.Write(out);
-}
-
-
bool DateParser::DayComposer::Write(FixedArray* output) {
int year = 0; // Default year is 0 (=> 2000) for KJS compatibility.
int month = kNone;
@@ -192,7 +114,6 @@
return true;
}
-
bool DateParser::TimeZoneComposer::Write(FixedArray* output) {
if (sign_ != kNone) {
if (hour_ == kNone) hour_ = 0;
@@ -210,9 +131,8 @@
return true;
}
-
-const int8_t
-DateParser::KeywordTable::array[][DateParser::KeywordTable::kEntrySize] = {
+const int8_t DateParser::KeywordTable::
+ array[][DateParser::KeywordTable::kEntrySize] = {
{'j', 'a', 'n', DateParser::MONTH_NAME, 1},
{'f', 'e', 'b', DateParser::MONTH_NAME, 2},
{'m', 'a', 'r', DateParser::MONTH_NAME, 3},