Closed
Bug 514884
Opened 17 years ago
Closed 17 years ago
TM: unit string and int string for '0', '1'...'9' must be the same JSString
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
| Tracking | Status | |
|---|---|---|
| status1.9.2 | --- | beta1-fixed |
People
(Reporter: wagnerg, Assigned: wagnerg)
References
Details
(Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file, 3 obsolete files)
|
2.08 KB,
patch
|
Details | Diff | Splinter Review |
2 copies break identity of atoms.
| Assignee | ||
Comment 1•17 years ago
|
||
js_NumberToString takes now the JSString from the unitString array for 0-9
| Assignee | ||
Comment 2•17 years ago
|
||
Attachment #398887 -
Attachment is obsolete: true
Comment 3•17 years ago
|
||
Maintaining the identity of atoms is not optional.
Summary: TM: unit string and int string for '0', '1'...'9' should be the same JSString → TM: unit string and int string for '0', '1'...'9' must be the same JSString
Comment 4•17 years ago
|
||
Comment on attachment 398890 [details] [diff] [review]
NumberToStringWithBase shouldn't be called from a trace
>diff -r 45772700955a js/src/jsnum.cpp
>--- a/js/src/jsnum.cpp Sat Sep 05 19:59:11 2009 +0400
>+++ b/js/src/jsnum.cpp Sat Sep 05 17:20:54 2009 -0700
>@@ -593,18 +593,17 @@ num_toPrecision(JSContext *cx, uintN arg
> if (argc == 0 || JSVAL_IS_VOID(vp[2]))
> return num_toString(cx, 0, vp);
> return num_to(cx, DTOSTR_STANDARD, DTOSTR_PRECISION, 1, MAX_PRECISION, 0,
> argc, vp);
> }
>
> #ifdef JS_TRACER
>
>-JS_DEFINE_TRCINFO_2(num_toString,
>- (3, (static, STRING, NumberToStringWithBase, CONTEXT, THIS_DOUBLE, INT32, 1, 1)),
>+JS_DEFINE_TRCINFO_1(num_toString,
> (2, (extern, STRING, js_NumberToString, CONTEXT, THIS_DOUBLE, 1, 1)))
>
> #endif /* JS_TRACER */
>
> static JSFunctionSpec number_methods[] = {
> #if JS_HAS_TOSOURCE
> JS_FN(js_toSource_str, num_toSource, 0,JSFUN_THISP_NUMBER),
> #endif
>@@ -828,17 +827,17 @@ NumberToCString(JSContext *cx, jsdouble
> if (!numStr) {
> JS_ReportOutOfMemory(cx);
> return NULL;
> }
> }
> return numStr;
> }
>
>-static JSString * JS_FASTCALL
>+static JSString *
> NumberToStringWithBase(JSContext *cx, jsdouble d, jsint base)
> {
> /*
> * The longest possible result here that would need to fit in buf is
> * (-0x80000000).toString(2), which has length 33. (This can produce
> * longer results, but in those cases buf is not used; see comment at
> * NumberToCString.)
> */
>@@ -858,16 +857,18 @@ NumberToStringWithBase(JSContext *cx, js
> }
>
> JSString * JS_FASTCALL
> js_NumberToString(JSContext *cx, jsdouble d)
> {
> jsint i;
>
> if (JSDOUBLE_IS_INT(d, i)) {
jsuint u = jsuint(i);
if (u < 10)
if (u < INT_STRING_LIMIT)
>+ if (jsuint(i) < 10) /* to avoid 2 JSString copies of 0-9 */
>+ return &JSString::unitStringTable['0' + i];
> if (jsuint(i) < INT_STRING_LIMIT)
> return &JSString::intStringTable[i];
> }
> return NumberToStringWithBase(cx, d, 10);
> }
>
> JSBool JS_FASTCALL
> js_NumberValueToCharBuffer(JSContext *cx, jsval v, JSCharBuffer &cb)
Attachment #398890 -
Flags: review+
| Assignee | ||
Comment 5•17 years ago
|
||
Attachment #398890 -
Attachment is obsolete: true
Attachment #398895 -
Flags: review?(gal)
Updated•17 years ago
|
Attachment #398895 -
Flags: review?(gal) → review+
| Assignee | ||
Comment 6•17 years ago
|
||
Attachment #398895 -
Attachment is obsolete: true
Comment 7•17 years ago
|
||
Whiteboard: fixed-in-tracemonkey
Comment 8•17 years ago
|
||
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Comment 9•17 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
•