Issue 132: Treatment of RegExp is different between JavaScriptCore and v8
http://code.google.com/p/v8/issues/detail?id=132

New issue report by polarjs:
This issue was discovered while investigating ecma_2/RegExp/regress-001.js
of the mozilla JS tests.  Here's a piece of test code that reduces the  
issue:

==== BEGIN ==================================
var a = new RegExp("[a-km-z]+");
print("a = " + a);
print("typeof a = " + (typeof a));
print("typeof RegExp = " + (typeof RegExp));

var b = a.exec("hello");
print("b = " + b);

var c = /[a-km-z]+/.exec("hello");
print("c = " + c);

// Using RegExp instances as functions:
var d = a("hello");
print("d = " + d);

var e = /[a-km-z]+/("hello");
print("e = " + e);
==== END ==================================

Running JavaScriptCore, the results are:
=======================================
a = /[a-km-z]+/
typeof a = function
typeof RegExp = function
b = he
c = he
d = he
e = he

Running v8 bleeding edge, I get:
===============================
a = /[a-km-z]+/
typeof a = object
typeof RegExp = function
b = he
c = he
mlam-test3.js:13: TypeError: Property 'a' of object [object global] is not
a function
var d = a("hello");
         ^

JavaScriptCore sets the typeof a RegExp to "function" while v8 sets it to
"object".  This allows JavaScriptCore to evaluate case 'd' and 'e' in the
test case, but v8 fails with a TypeError.  Is this inconsistency deliberate?

I see that ECMA-262 Ed.3 clause 15.10.6 says that the RegExp prototype
object is Object.  Is this the reason for this inconsistency with
JavaScriptCore?

Tested with revision 631 of v8 bleeding edge.



Issue attributes:
        Status: New
        Owner: ----

-- 
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to