Commit dbb95bc5 authored by rossberg@chromium.org's avatar rossberg@chromium.org

Fix minifier to distinguish regexps from divisions (to some extent).

Rrraaa, I have to say, doing program rewriting via regexp rules is an inherently broken idea...

R=mstarzinger@chromium.org
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/9644001

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10969 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 068c6e50
......@@ -1261,7 +1261,7 @@ function ObjectIsExtensible(obj) {
// Harmony egal.
function ObjectIs(obj1, obj2) {
if (obj1 === obj2) {
return (obj1 !== 0) || ((1 / obj1) === (1 / obj2));
return (obj1 !== 0) || (1 / obj1 === 1 / obj2);
} else {
return (obj1 !== obj1) && (obj2 !== obj2);
}
......
......@@ -32,7 +32,7 @@ function TestEgal(expected, x, y) {
assertSame(expected, Object.is(x, y));
}
var test_set = [ {}, [], 1/0, -1/0, "s", 0, 1/(-1/0), null, undefined ];
var test_set = [ {}, [], 1/0, -1/0, "s", 0, 0/-1, null, undefined ];
print(test_set);
for (var i = 0; i < test_set.length; i++) {
for (var j = 0; j < test_set.length; j++) {
......
......@@ -232,7 +232,9 @@ class JavaScriptMinifier(object):
# A regexp that matches a regexp literal surrounded by /slashes/.
# 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"/(?:(?=\()|(?:[^()/\\]|\\.)+)(?:\([^/\\]|\\.)*/"
# Also don't allow it to come after anything that can only be the
# end of a primary expression.
slash_quoted_regexp = r"(?<![\w$'\")\]])/(?:(?=\()|(?:[^()/\\]|\\.)+)(?:\([^/\\]|\\.)*/"
# 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