author | Luke Wagner <lw@mozilla.com> |
Mon, 24 Jan 2011 09:47:25 -0800 | |
changeset 61229 | 9de332a8e330844d52d9ebd4ab1255a7acb2bc5d |
parent 61228 | 3d6533055424fa46de6e9ac797e61aad3ad37501 |
child 61230 | f3b470fb91a9741c87994f5d4b4d79dc17c06a8c |
push id | 18277 |
push user | cleary@mozilla.com |
push date | Tue, 25 Jan 2011 03:52:51 +0000 |
treeherder | mozilla-central@7ee91bd90e7a [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | pbiggar |
bugs | 626526 |
milestone | 2.0b10pre |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
js/src/jsarray.cpp | file | annotate | diff | comparison | revisions | |
js/src/jscntxt.cpp | file | annotate | diff | comparison | revisions | |
js/src/jscntxt.h | file | annotate | diff | comparison | revisions |
--- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -1216,18 +1216,17 @@ array_toString_sub(JSContext *cx, JSObje sep = , seplen = 1; } /* * Use HashTable entry as the cycle indicator. On first visit, create the * entry, and, when leaving, remove the entry. */ - typedef js::HashSet<JSObject *> ObjSet; - ObjSet::AddPtr hashp = cx->busyArrays.lookupForAdd(obj); + BusyArraysMap::AddPtr hashp = cx->busyArrays.lookupForAdd(obj); uint32 genBefore; if (!hashp) { /* Not in hash table, so not a cycle. */ if (!cx->busyArrays.add(hashp, obj)) return false; genBefore = cx->busyArrays.generation(); } else { /* Cycle, so return empty string. */
--- a/js/src/jscntxt.cpp +++ b/js/src/jscntxt.cpp @@ -741,16 +741,21 @@ js_NewContext(JSRuntime *rt, size_t stac JS_InitArenaPool(&cx->tempPool, "temp", TEMP_POOL_CHUNK_SIZE, sizeof(jsdouble), &cx->scriptStackQuota); JS_InitArenaPool(&cx->regExpPool, "regExp", TEMP_POOL_CHUNK_SIZE, sizeof(int), &cx->scriptStackQuota); JS_ASSERT(cx->resolveFlags == 0); + if (!cx->busyArrays.init()) { + FreeContext(cx); + return NULL; + } + #ifdef JS_THREADSAFE if (!js_InitContextThread(cx)) { FreeContext(cx); return NULL; } #endif /* @@ -836,22 +841,16 @@ js_NewContext(JSRuntime *rt, size_t stac } cxCallback = rt->cxCallback; if (cxCallback && !cxCallback(cx, JSCONTEXT_NEW)) { js_DestroyContext(cx, JSDCM_NEW_FAILED); return NULL; } - /* Using ContextAllocPolicy, so init after JSContext is ready. */ - if (!cx->busyArrays.init()) { - FreeContext(cx); - return NULL; - } - return cx; } #if defined DEBUG && defined XP_UNIX # include <stdio.h> class JSAutoFile { public: @@ -1989,17 +1988,17 @@ DSTOffsetCache::DSTOffsetCache() { purge(); } JSContext::JSContext(JSRuntime *rt) : runtime(rt), compartment(NULL), regs(NULL), - busyArrays(thisInInitializer()) + busyArrays() {} void JSContext::resetCompartment() { JSObject *scopeobj; if (hasfp()) { scopeobj = &fp()->scopeChain();
--- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -1628,16 +1628,20 @@ VersionHasFlags(JSVersion version) } static inline bool VersionIsKnown(JSVersion version) { return VersionNumber(version) != JSVERSION_UNKNOWN; } +typedef js::HashSet<JSObject *, + js::DefaultHasher<JSObject *>, + js::SystemAllocPolicy> BusyArraysMap; + } /* namespace js */ struct JSContext { explicit JSContext(JSRuntime *rt); /* JSRuntime contextList linkage. */ JSCList link; @@ -1727,17 +1731,17 @@ struct JSContext /* Temporary arena pool used while evaluate regular expressions. */ JSArenaPool regExpPool; /* Top-level object and pointer to top stack frame's scope chain. */ JSObject *globalObject; /* State for object and array toSource conversion. */ JSSharpObjectMap sharpObjectMap; - js::HashSet<JSObject *> busyArrays; + js::BusyArraysMap busyArrays; /* Argument formatter support for JS_{Convert,Push}Arguments{,VA}. */ JSArgumentFormatMap *argumentFormatMap; /* Last message string and log file for debugging. */ char *lastMessage; #ifdef DEBUG void *logfp; @@ -2128,19 +2132,16 @@ struct JSContext private: /* * The allocation code calls the function to indicate either OOM failure * when p is null or that a memory pressure counter has reached some * threshold when p is not null. The function takes the pointer and not * a boolean flag to minimize the amount of code in its inlined callers. */ JS_FRIEND_API(void) checkMallocGCPressure(void *p); - - /* To silence MSVC warning about using 'this' in a member initializer. */ - JSContext *thisInInitializer() { return this; } }; /* struct JSContext */ #ifdef JS_THREADSAFE # define JS_THREAD_ID(cx) ((cx)->thread ? (cx)->thread->id : 0) #endif #if defined JS_THREADSAFE && defined DEBUG