Comment #4 on issue 1813 by [email protected]: String new RegExp('\n').toString() returns is invalid RegularExpressionLiteral
http://code.google.com/p/v8/issues/detail?id=1813
The patch looks good, but I think we might want to delay escaping the RegExp until someone actually accesses the source attribute (e.g., through the toString method).
Creating and using RegExps without using their .source property is the common case, and some code creates a LOT of them (e.g., the Chrome AdBlock extension with all filters enabled, where most of the RegExps will contain a slash).
We can save the memory overhead of the escaped string, and the time to create it, if it isn't needed.
-- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
