Closed
Bug 515199
Opened 16 years ago
Closed 16 years ago
js_GetGCThingTraceKind must check for JSString::isStatic and return JSTRACE_STRING if so
Categories
(Core :: JavaScript Engine, defect, P1)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
status1.9.2 | --- | beta1-fixed |
People
(Reporter: igor, Assigned: igor)
References
Details
(Keywords: regression, Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file, 1 obsolete file)
7.69 KB,
patch
|
igor
:
review+
|
Details | Diff | Splinter Review |
Assignee | ||
Comment 1•16 years ago
|
||
The patch adds the missing check for static strings in js_GetGCThingTraceKind and consolidate the check in few other places.
Attachment #399600 -
Flags: review?(brendan)
Comment 2•16 years ago
|
||
Comment on attachment 399600 [details] [diff] [review]
v1
>- static inline bool isUnitString(JSString *str) {
>- return unitStringTable <= str && str < &unitStringTable[UNIT_STRING_LIMIT];
>+ static inline bool isUnitString(void *ptr) {
>+ jsuword delta = reinterpret_cast<jsuword>(ptr) -
>+ reinterpret_cast<jsuword>(unitStringTable);
>+ if (delta >= UNIT_STRING_LIMIT * sizeof(JSString))
>+ return false;
You know I am the original byte delta unsigned less-than test-monger, over against the prettier number-line range test visible above in the - lines. Others may lament the loss of that range test, but I think your assert below justifies the hand-coded optimization:
>+
>+ /*
>+ * If ptr points inside the static array, it must point to the string.
..12345678901234567890123456789012345678901234567890123456789012345678901234567890
This comment could fit on one line with /* and */ if you s/point to the string/be well-aligned/.
>+ * If ptr points inside the static array, it must point to the string.
Ditto comment nit.
Thanks for cleaning up. I hope none of this bites back via Shark. Setting JSVAL_STRING in the tvr is a fast minor cycle op, often it hides in memory latency in the instruction schedule. Whereas the two-table range test must cost more when marking.
Speaking of which, if we put the two tables together (adjacent) in the source file, they might be adjacent in memory and the compiler (or one of us, hand-coding) could optimize isStatic better.
Doesn't matter without some profiling evidence, just thought I'd mention it. There's no standard way to guarantee the tables are adjacent without making them the same array, of course. Which could be done, same element type (JSString)!
/be
Attachment #399600 -
Flags: review?(brendan) → review+
Comment 3•16 years ago
|
||
*this* assert below:
JS_ASSERT(delta % sizeof(JSString) == 0);
/be
Assignee | ||
Comment 4•16 years ago
|
||
(In reply to comment #2)
> Thanks for cleaning up. I hope none of this bites back via Shark. Setting
> JSVAL_STRING in the tvr is a fast minor cycle op, often it hides in memory
> latency in the instruction schedule.
See bug 515605 about avoiding js_GetGCThingTraceKind for tvr and local roots.
> Speaking of which, if we put the two tables together (adjacent) in the source
> file, they might be adjacent in memory and the compiler (or one of us,
> hand-coding) could optimize isStatic better.
I would like to the static area for all common atoms and double constants like 0/0 and oo. With that extra checks will mounts without using one common area.
Assignee | ||
Comment 5•16 years ago
|
||
The new version uses better comments.
Attachment #399600 -
Attachment is obsolete: true
Attachment #399704 -
Flags: review+
Assignee | ||
Comment 6•16 years ago
|
||
Whiteboard: fixed-in-tracemonkey
Comment 7•16 years ago
|
||
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Updated•16 years ago
|
status1.9.2:
--- → beta1-fixed
Flags: wanted1.9.2+
You need to log in
before you can comment on or make changes to this bug.
Description
•