Commit d73f2efc authored by ager@chromium.org's avatar ager@chromium.org

Inline a number of simple date computations.

The minifier has been updated to have better recognition of regular
expressions.

Review URL: http://codereview.chromium.org/521057

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3565 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8dd36667
This diff is collapsed.
......@@ -118,6 +118,14 @@ macro NUMBER_OF_CAPTURES(array) = ((array)[0]);
# Gets the value of a Date object. If arg is not a Date object
# a type error is thrown.
macro DATE_VALUE(arg) = (%_ClassOf(arg) === 'Date' ? %_ValueOf(arg) : ThrowDateTypeError());
macro DAY(time) = ($floor(time / 86400000));
macro MONTH_FROM_TIME(time) = (FromJulianDay(($floor(time / 86400000)) + 2440588).month);
macro DATE_FROM_TIME(time) = (FromJulianDay(($floor(time / 86400000)) + 2440588).date);
macro YEAR_FROM_TIME(time) = (FromJulianDay(($floor(time / 86400000)) + 2440588).year);
macro HOUR_FROM_TIME(time) = (Modulo($floor(time / 3600000), 24));
macro MIN_FROM_TIME(time) = (Modulo($floor(time / 60000), 60));
macro SEC_FROM_TIME(time) = (Modulo($floor(time / 1000), 60));
macro MS_FROM_TIME(time) = (Modulo(time, 1000));
# Last input and last subject of regexp matches.
macro LAST_SUBJECT(array) = ((array)[1]);
......
......@@ -230,7 +230,9 @@ class JavaScriptMinifier(object):
# A regexp that matches a literal string surrounded by 'double quotes'.
single_quoted_string = r"'(?:[^'\\]|\\.)*'"
# A regexp that matches a regexp literal surrounded by /slashes/.
slash_quoted_regexp = r"/(?:[^/\\]|\\.)+/"
# Don't allow a regexp to have a ) before the first ( since that's a
# syntax error and it's probably just two unrelated slashes.
slash_quoted_regexp = r"/(?:(?=\()|(?:[^()/\\]|\\.)+)(?:\([^/\\]|\\.)*/"
# Replace multiple spaces with a single space.
line = re.sub("|".join([double_quoted_string,
single_quoted_string,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment