Revision: 10969
Author: [email protected]
Date: Thu Mar 8 08:38:44 2012
Log: 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...
[email protected]
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com/9644001
http://code.google.com/p/v8/source/detail?r=10969
Modified:
/branches/bleeding_edge/src/v8natives.js
/branches/bleeding_edge/test/mjsunit/object-is.js
/branches/bleeding_edge/tools/jsmin.py
=======================================
--- /branches/bleeding_edge/src/v8natives.js Thu Mar 8 05:30:10 2012
+++ /branches/bleeding_edge/src/v8natives.js Thu Mar 8 08:38:44 2012
@@ -1261,7 +1261,7 @@
// 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);
}
=======================================
--- /branches/bleeding_edge/test/mjsunit/object-is.js Thu Mar 8 04:49:24
2012
+++ /branches/bleeding_edge/test/mjsunit/object-is.js Thu Mar 8 08:38:44
2012
@@ -32,7 +32,7 @@
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++) {
=======================================
--- /branches/bleeding_edge/tools/jsmin.py Tue Dec 7 03:01:02 2010
+++ /branches/bleeding_edge/tools/jsmin.py Thu Mar 8 08:38:44 2012
@@ -232,7 +232,9 @@
# 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,
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev