Closed
Bug 76976
Opened 24 years ago
Closed 24 years ago
RegExp.prototype.lastIndex now stops at 2^30 -1 (was 2^32-1)
Categories
(Core :: JavaScript Engine, defect, P1)
Tracking
()
VERIFIED
FIXED
mozilla0.9
People
(Reporter: pschwartau, Assigned: brendan)
Details
(Keywords: js1.5)
Attachments
(1 file)
964 bytes,
patch
|
Details | Diff | Splinter Review |
The fix for bug 76233 "Deadlock between regular expressions and GC"
is causing js/tests/ecma_2/RegExp/properties-002.js to fail.
This test sets regexp.lastIndex to high values:
re = /abc/;
re.lastIndex = Math.pow(2,31);
re.lastIndex = Math.pow(2,32)-1;
re.lastIndex = Math.pow(2,31)-1;
re.lastIndex = Math.pow(2,30)-1;
re.lastIndex = Math.pow(2,30);
But it now fails to recover any value higher than 2^30 -1:
FAILED! re.lastIndex = 0 expected: 2147483648
FAILED! re.lastIndex = -1 expected: 4294967295
FAILED! re.lastIndex = -1 expected: 2147483647
PASSED! re.lastIndex = 1073741823 PASSED!
FAILED! re.lastIndex = undefined expected: 1073741824
If I back out the changes made for bug 76233, the test passes:
PASSED! re.lastIndex = 2147483648 PASSED!
PASSED! re.lastIndex = 4294967295 PASSED!
PASSED! re.lastIndex = 2147483647 PASSED!
PASSED! re.lastIndex = 1073741823 PASSED!
PASSED! re.lastIndex = 1073741824 PASSED!
I observed that re.lastIndex used to cycle at 2^32:
js> re.lastIndex=Math.pow(2,32)-1
4294967295
js> re.lastIndex
4294967295
js> re.lastIndex=Math.pow(2,32)
4294967296
js> re.lastIndex
0
Whereas now it is becoming undefined at 2^30:
js> var re = /abc/
js> re.lastIndex = Math.pow(2,30)-1
1073741823
js> re.lastIndex
1073741823
js> re.lastIndex = Math.pow(2,30)
1073741824
js> re.lastIndex
js> re.lastIndex == undefined
true
I haven't found any ECMA spec for this, so it may not be a valid bug.
In any case, the behavior has changed...
Assignee | ||
Comment 1•24 years ago
|
||
Dammit, my deadlock avoidance change was not supposed to do that. Stupid jsval
int domain limits!
/be
Assignee: rogerl → brendan
Keywords: js1.5,
mozilla0.9.1
Priority: -- → P1
Target Milestone: --- → mozilla0.9.1
Assignee | ||
Comment 3•24 years ago
|
||
Assignee | ||
Comment 4•24 years ago
|
||
Screw it, I should not have busted this in 0.9. Going for 0.9.
/be
Keywords: mozilla0.9.1 → mozilla0.9
Target Milestone: mozilla0.9.1 → mozilla0.9
Comment 5•24 years ago
|
||
Get it into 0.9.
Comment 6•24 years ago
|
||
r=shaver. (Who reviewed that silliness? =) )
Assignee | ||
Comment 7•24 years ago
|
||
You and beard reviewed the correct fix, then I checked in the wrong patch! I
suck! Thanks.
/be
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 8•24 years ago
|
||
Verified Fixed with debug, optimized JS shells on WinNT and Linux.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•