Bug 696261: Correct references to 'tempPool' in comments; it's now 'tempLifoAlloc'. r=cdleary

This commit is contained in:
Jim Blandy 2011-10-21 16:53:30 -07:00
parent d914c7c079
commit 483651d34c
8 changed files with 36 additions and 30 deletions

View File

@ -425,7 +425,7 @@ BytecodeCompiler::compileFunctionBody(JSContext *cx, JSFunction *fun, JSPrincipa
if (nargs) {
/*
* NB: do not use AutoLocalNameArray because it will release space
* allocated from cx->tempPool by DefineArg.
* allocated from cx->tempLifoAlloc by DefineArg.
*/
Vector<JSAtom *> names(cx);
if (!funcg.bindings.getLocalNameArray(cx, &names)) {

View File

@ -678,9 +678,10 @@ struct CodeGenerator : public TreeContext
}
/*
* Note that cgs are magic: they own the arena "top-of-stack" space above
* their tempMark points. This means that you cannot alloc from tempPool
* and save the pointer beyond the next CodeGenerator destructor call.
* Note that cgs are magic: they own the arena "top-of-stack" space
* above their tempMark points. This means that you cannot alloc from
* tempLifoAlloc and save the pointer beyond the next CodeGenerator
* destructor call.
*/
~CodeGenerator();

View File

@ -176,10 +176,11 @@ Parser::newObjectBox(JSObject *obj)
JS_ASSERT(obj);
/*
* We use JSContext.tempPool to allocate parsed objects and place them on
* a list in this Parser to ensure GC safety. Thus the tempPool arenas
* containing the entries must be alive until we are done with scanning,
* parsing and code generation for the whole script or top-level function.
* We use JSContext.tempLifoAlloc to allocate parsed objects and place them
* on a list in this Parser to ensure GC safety. Thus the tempLifoAlloc
* arenas containing the entries must be alive until we are done with
* scanning, parsing and code generation for the whole script or top-level
* function.
*/
ObjectBox *objbox = context->tempLifoAlloc().new_<ObjectBox>();
if (!objbox) {
@ -201,10 +202,11 @@ Parser::newFunctionBox(JSObject *obj, ParseNode *fn, TreeContext *tc)
JS_ASSERT(obj->isFunction());
/*
* We use JSContext.tempPool to allocate parsed objects and place them on
* a list in this Parser to ensure GC safety. Thus the tempPool arenas
* containing the entries must be alive until we are done with scanning,
* parsing and code generation for the whole script or top-level function.
* We use JSContext.tempLifoAlloc to allocate parsed objects and place them
* on a list in this Parser to ensure GC safety. Thus the tempLifoAlloc
* arenas containing the entries must be alive until we are done with
* scanning, parsing and code generation for the whole script or top-level
* function.
*/
FunctionBox *funbox = context->tempLifoAlloc().newPod<FunctionBox>();
if (!funbox) {

View File

@ -102,7 +102,7 @@ struct Parser : private AutoGCRooter
JSContext *const context; /* FIXME Bug 551291: use AutoGCRooter::context? */
void *tempFreeList[NUM_TEMP_FREELISTS];
TokenStream tokenStream;
void *tempPoolMark; /* initial JSContext.tempPool mark */
void *tempPoolMark; /* initial JSContext.tempLifoAlloc mark */
JSPrincipals *principals; /* principals associated with source */
StackFrame *const callerFrame; /* scripted caller frame for eval and dbgapi */
JSObject *const callerVarObj; /* callerFrame's varObj */
@ -125,10 +125,11 @@ struct Parser : private AutoGCRooter
friend struct BytecodeCompiler;
/*
* Initialize a parser. Parameters are passed on to init tokenStream.
* The compiler owns the arena pool "tops-of-stack" space above the current
* JSContext.tempPool mark. This means you cannot allocate from tempPool
* and save the pointer beyond the next Parser destructor invocation.
* Initialize a parser. Parameters are passed on to init tokenStream. The
* compiler owns the arena pool "tops-of-stack" space above the current
* JSContext.tempLifoAlloc mark. This means you cannot allocate from
* tempLifoAlloc and save the pointer beyond the next Parser destructor
* invocation.
*/
bool init(const jschar *base, size_t length, const char *filename, uintN lineno,
JSVersion version);
@ -150,7 +151,8 @@ struct Parser : private AutoGCRooter
#endif
/*
* Allocate a new parsed object or function container from cx->tempPool.
* Allocate a new parsed object or function container from
* cx->tempLifoAlloc.
*/
ObjectBox *newObjectBox(JSObject *obj);

View File

@ -384,7 +384,7 @@ class TokenStream
* first call |close| then call the destructor. If |init| fails, do not call
* |close|.
*
* This class uses JSContext.tempPool to allocate internal buffers. The
* This class uses JSContext.tempLifoAlloc to allocate internal buffers. The
* caller should JS_ARENA_MARK before calling |init| and JS_ARENA_RELEASE
* after calling |close|.
*/

View File

@ -2181,8 +2181,8 @@ Function(JSContext *cx, uintN argc, Value *vp)
/*
* Allocate a string to hold the concatenated arguments, including room
* for a terminating 0. Mark cx->tempPool for later release, to free
* collected_args and its tokenstream in one swoop.
* for a terminating 0. Mark cx->tempLifeAlloc for later release, to
* free collected_args and its tokenstream in one swoop.
*/
LifoAllocScope las(&cx->tempLifoAlloc());
jschar *cp = cx->tempLifoAlloc().newArray<jschar>(args_length + 1);

View File

@ -4067,10 +4067,10 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
LOAD_FUNCTION(0);
/*
* All allocation when decompiling is LIFO, using malloc
* or, more commonly, arena-allocating from cx->tempPool.
* Therefore after InitSprintStack succeeds, we must
* release to mark before returning.
* All allocation when decompiling is LIFO, using malloc or,
* more commonly, arena-allocating from cx->tempLifoAlloc
* Therefore after InitSprintStack succeeds, we must release
* to mark before returning.
*/
LifoAllocScope las(&cx->tempLifoAlloc());
if (fun->script()->bindings.hasLocalNames()) {
@ -4179,9 +4179,9 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
}
/*
* Alas, we have to malloc a copy of the result left on
* the top of ss2 because both ss and ss2 arena-allocate
* from cx's tempPool.
* Alas, we have to malloc a copy of the result left on the
* top of ss2 because both ss and ss2 arena-allocate from
* cx's tempLifoAlloc
*/
rval = JS_strdup(cx, PopStr(&ss2, op));
las.releaseEarly();

View File

@ -648,8 +648,9 @@ js_XDRAtom(JSXDRState *xdr, JSAtom **atomp)
chars = stackChars;
} else {
/*
* This is very uncommon. Don't use the tempPool arena for this as
* most allocations here will be bigger than tempPool's arenasize.
* This is very uncommon. Don't use the tempLifoAlloc arena for this as
* most allocations here will be bigger than tempLifoAlloc's default
* chunk size.
*/
chars = (jschar *) cx->malloc_(nchars * sizeof(jschar));
if (!chars)