mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 23:23:33 +00:00
What a dork, I didn't test-build on Linux!
This commit is contained in:
parent
90207e0395
commit
4736a63576
@ -370,7 +370,7 @@ js_AtomizeHashedKey(JSContext *cx, jsval key, JSHashNumber keyHash, uintN flags)
|
||||
JSAtom *atom;
|
||||
|
||||
state = &cx->runtime->atomState;
|
||||
JS_LOCK(&state->lock,cx);
|
||||
JS_LOCK(&state->lock, cx);
|
||||
table = state->table;
|
||||
hep = JS_HashTableRawLookup(table, keyHash, (void *)key);
|
||||
if ((he = *hep) == NULL) {
|
||||
@ -444,7 +444,7 @@ js_AtomizeDouble(JSContext *cx, jsdouble d, uintN flags)
|
||||
keyHash = HASH_DOUBLE(dp);
|
||||
key = DOUBLE_TO_JSVAL(dp);
|
||||
state = &cx->runtime->atomState;
|
||||
JS_LOCK(&state->lock,cx);
|
||||
JS_LOCK(&state->lock, cx);
|
||||
table = state->table;
|
||||
hep = JS_HashTableRawLookup(table, keyHash, (void *)key);
|
||||
if ((he = *hep) == NULL) {
|
||||
@ -454,7 +454,7 @@ js_AtomizeDouble(JSContext *cx, jsdouble d, uintN flags)
|
||||
JS_UNLOCK(&state->lock,cx);
|
||||
if (!js_NewDoubleValue(cx, d, &key))
|
||||
return NULL;
|
||||
JS_LOCK(&state->lock,cx);
|
||||
JS_LOCK(&state->lock, cx);
|
||||
#ifdef JS_THREADSAFE
|
||||
if (state->tablegen != gen) {
|
||||
hep = JS_HashTableRawLookup(table, keyHash, (void *)key);
|
||||
@ -492,7 +492,7 @@ js_AtomizeString(JSContext *cx, JSString *str, uintN flags)
|
||||
keyHash = js_HashString(str);
|
||||
key = STRING_TO_JSVAL(str);
|
||||
state = &cx->runtime->atomState;
|
||||
JS_LOCK(&state->lock,cx);
|
||||
JS_LOCK(&state->lock, cx);
|
||||
table = state->table;
|
||||
hep = JS_HashTableRawLookup(table, keyHash, (void *)key);
|
||||
if ((he = *hep) == NULL) {
|
||||
@ -500,16 +500,14 @@ js_AtomizeString(JSContext *cx, JSString *str, uintN flags)
|
||||
#ifdef JS_THREADSAFE
|
||||
uint32 gen = state->tablegen;
|
||||
#endif
|
||||
JS_UNLOCK(&state->lock,cx);
|
||||
if (flags & ATOM_NOCOPY) {
|
||||
str = js_NewString(cx, str->chars, str->length, 0);
|
||||
} else {
|
||||
str = js_NewStringCopyN(cx, str->chars, str->length, 0);
|
||||
}
|
||||
JS_UNLOCK(&state->lock, cx);
|
||||
str = (flags & ATOM_NOCOPY)
|
||||
? js_NewString(cx, str->chars, str->length, 0)
|
||||
: js_NewStringCopyN(cx, str->chars, str->length, 0);
|
||||
if (!str)
|
||||
return NULL;
|
||||
key = STRING_TO_JSVAL(str);
|
||||
JS_LOCK(&state->lock,cx);
|
||||
JS_LOCK(&state->lock, cx);
|
||||
#ifdef JS_THREADSAFE
|
||||
if (state->tablegen != gen) {
|
||||
hep = JS_HashTableRawLookup(table, keyHash, (void *)key);
|
||||
@ -548,7 +546,7 @@ js_Atomize(JSContext *cx, const char *bytes, size_t length, uintN flags)
|
||||
/*
|
||||
* Avoiding the malloc in js_InflateString on shorter strings saves us
|
||||
* over 20,000 malloc calls on mozilla browser startup. This compares to
|
||||
* only 131 calls where the string is longer than a 32 char buffer.
|
||||
* only 131 calls where the string is longer than a 31 char (net) buffer.
|
||||
* The vast majority of atomized strings are already in the hashtable. So
|
||||
* js_AtomizeString rarely has to copy the temp string we make.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user