зеркало из https://github.com/mozilla/gecko-dev.git
Use class statics for the unit and int string tables (513530 followup, r=gwagner).
This commit is contained in:
Родитель
49fe9bab87
Коммит
601e1f1204
|
@ -864,7 +864,7 @@ js_NumberToString(JSContext *cx, jsdouble d)
|
||||||
|
|
||||||
if (JSDOUBLE_IS_INT(d, i)) {
|
if (JSDOUBLE_IS_INT(d, i)) {
|
||||||
if (jsuint(i) < INT_STRING_LIMIT)
|
if (jsuint(i) < INT_STRING_LIMIT)
|
||||||
return &js_IntStrings[i];
|
return &JSString::intStringTable[i];
|
||||||
}
|
}
|
||||||
return NumberToStringWithBase(cx, d, 10);
|
return NumberToStringWithBase(cx, d, 10);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1549,7 +1549,7 @@ JSScope::clear(JSContext *cx)
|
||||||
|
|
||||||
JSClass *clasp = object->getClass();
|
JSClass *clasp = object->getClass();
|
||||||
JSObject *proto = object->getProto();
|
JSObject *proto = object->getProto();
|
||||||
uint32 newShape;
|
uint32 newShape = 0;
|
||||||
if (proto && clasp == proto->getClass()) {
|
if (proto && clasp == proto->getClass()) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
bool ok =
|
bool ok =
|
||||||
|
|
|
@ -2434,7 +2434,7 @@ static const jschar UnitStringData[] = {
|
||||||
|
|
||||||
#define U(c) { 1 | JSString::ATOMIZED, {(jschar *)UnitStringData + (c) * 2} }
|
#define U(c) { 1 | JSString::ATOMIZED, {(jschar *)UnitStringData + (c) * 2} }
|
||||||
|
|
||||||
JSString js_UnitStrings[] = {
|
JSString JSString::unitStringTable[] = {
|
||||||
U(0x00), U(0x01), U(0x02), U(0x03), U(0x04), U(0x05), U(0x06), U(0x07),
|
U(0x00), U(0x01), U(0x02), U(0x03), U(0x04), U(0x05), U(0x06), U(0x07),
|
||||||
U(0x08), U(0x09), U(0x0a), U(0x0b), U(0x0c), U(0x0d), U(0x0e), U(0x0f),
|
U(0x08), U(0x09), U(0x0a), U(0x0b), U(0x0c), U(0x0d), U(0x0e), U(0x0f),
|
||||||
U(0x10), U(0x11), U(0x12), U(0x13), U(0x14), U(0x15), U(0x16), U(0x17),
|
U(0x10), U(0x11), U(0x12), U(0x13), U(0x14), U(0x15), U(0x16), U(0x17),
|
||||||
|
@ -2526,7 +2526,7 @@ static const jschar Hundreds[] = {
|
||||||
#define L2(c) { 2 | JSString::ATOMIZED, {(jschar *)Hundreds + 41 + (c - 10) * 4} } /* length 2: 10..99 */
|
#define L2(c) { 2 | JSString::ATOMIZED, {(jschar *)Hundreds + 41 + (c - 10) * 4} } /* length 2: 10..99 */
|
||||||
#define L3(c) { 3 | JSString::ATOMIZED, {(jschar *)Hundreds + (c - 100) * 4} } /* length 3: 100..255 */
|
#define L3(c) { 3 | JSString::ATOMIZED, {(jschar *)Hundreds + (c - 100) * 4} } /* length 3: 100..255 */
|
||||||
|
|
||||||
JSString js_IntStrings[] = {
|
JSString JSString::intStringTable[] = {
|
||||||
L1(0x00), L1(0x01), L1(0x02), L1(0x03), L1(0x04), L1(0x05), L1(0x06), L1(0x07),
|
L1(0x00), L1(0x01), L1(0x02), L1(0x03), L1(0x04), L1(0x05), L1(0x06), L1(0x07),
|
||||||
L1(0x08), L1(0x09), L2(0x0a), L2(0x0b), L2(0x0c), L2(0x0d), L2(0x0e), L2(0x0f),
|
L1(0x08), L1(0x09), L2(0x0a), L2(0x0b), L2(0x0c), L2(0x0d), L2(0x0e), L2(0x0f),
|
||||||
L2(0x10), L2(0x11), L2(0x12), L2(0x13), L2(0x14), L2(0x15), L2(0x16), L2(0x17),
|
L2(0x10), L2(0x11), L2(0x12), L2(0x13), L2(0x14), L2(0x15), L2(0x16), L2(0x17),
|
||||||
|
|
|
@ -65,9 +65,6 @@ enum {
|
||||||
INT_STRING_LIMIT = 256U
|
INT_STRING_LIMIT = 256U
|
||||||
};
|
};
|
||||||
|
|
||||||
extern JSString js_UnitStrings[];
|
|
||||||
extern JSString js_IntStrings[];
|
|
||||||
|
|
||||||
extern jschar *
|
extern jschar *
|
||||||
js_GetDependentStringChars(JSString *str);
|
js_GetDependentStringChars(JSString *str);
|
||||||
|
|
||||||
|
@ -164,7 +161,7 @@ struct JSString {
|
||||||
return (mLength & flag) != 0;
|
return (mLength & flag) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum
|
enum
|
||||||
#if defined(_MSC_VER) && defined(_WIN64)
|
#if defined(_MSC_VER) && defined(_WIN64)
|
||||||
: size_t /* VC++ 64-bit incorrectly defaults this enum's size to int. */
|
: size_t /* VC++ 64-bit incorrectly defaults this enum's size to int. */
|
||||||
|
@ -365,10 +362,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool isStatic(JSString *s) {
|
static inline bool isStatic(JSString *s) {
|
||||||
return (s >= js_UnitStrings && s < &js_UnitStrings[UNIT_STRING_LIMIT]) ||
|
return (s >= unitStringTable && s < &unitStringTable[UNIT_STRING_LIMIT]) ||
|
||||||
(s >= js_IntStrings && s < &js_IntStrings[INT_STRING_LIMIT]);
|
(s >= intStringTable && s < &intStringTable[INT_STRING_LIMIT]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static JSString unitStringTable[];
|
||||||
|
static JSString intStringTable[];
|
||||||
|
|
||||||
static JSString *unitString(jschar c);
|
static JSString *unitString(jschar c);
|
||||||
static JSString *getUnitString(JSContext *cx, JSString *str, size_t index);
|
static JSString *getUnitString(JSContext *cx, JSString *str, size_t index);
|
||||||
};
|
};
|
||||||
|
|
|
@ -48,7 +48,7 @@ inline JSString *
|
||||||
JSString::unitString(jschar c)
|
JSString::unitString(jschar c)
|
||||||
{
|
{
|
||||||
JS_ASSERT(c < UNIT_STRING_LIMIT);
|
JS_ASSERT(c < UNIT_STRING_LIMIT);
|
||||||
return js_UnitStrings + c;
|
return &unitStringTable[c];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline JSString *
|
inline JSString *
|
||||||
|
|
Загрузка…
Ссылка в новой задаче