This commit is contained in:
rogerl%netscape.com 2003-04-11 21:29:50 +00:00
Родитель c251d3600f
Коммит 56427a5ece
6 изменённых файлов: 22 добавлений и 10 удалений

Просмотреть файл

@ -92,7 +92,7 @@ public:
#endif #endif
{ } { }
BytecodeContainer::~BytecodeContainer() { } BytecodeContainer::~BytecodeContainer() { String t; mSource = t; mSourceLocation = t; }
void mark(); void mark();

Просмотреть файл

@ -146,7 +146,7 @@ static int readEvalPrint(FILE *in)
js2val rval = metadata->ExecuteStmtList(RunPhase, parsedStatements); js2val rval = metadata->ExecuteStmtList(RunPhase, parsedStatements);
if (!JS2VAL_IS_VOID(rval)) if (!JS2VAL_IS_VOID(rval))
stdOut << *metadata->toString(rval) << '\n'; stdOut << *metadata->toString(rval) << '\n';
metadata->restoreCompilationUnit(oldData); metadata->restoreCompilationUnit(oldData);
} }
} }
clear(buffer); clear(buffer);
@ -414,7 +414,7 @@ int main(int argc, char **argv)
result = readEvalPrint(stdin); result = readEvalPrint(stdin);
delete metadata; delete metadata;
world->identifiers.clear(); world->identifiers.clear();
delete world; delete world;
return result; return result;
} }
catch (Exception &e) { catch (Exception &e) {

Просмотреть файл

@ -420,8 +420,8 @@ namespace MetaData {
INIT_STRINGATOM(Function), INIT_STRINGATOM(Function),
INIT_STRINGATOM(Object), INIT_STRINGATOM(Object),
INIT_STRINGATOM(object), INIT_STRINGATOM(object),
Empty_StringAtom(allocStringPtr(&world.identifiers[""])), Empty_StringAtom(allocStringPtr("")),
Dollar_StringAtom(allocStringPtr(&world.identifiers["$"])), Dollar_StringAtom(allocStringPtr("$")),
INIT_STRINGATOM(prototype), INIT_STRINGATOM(prototype),
INIT_STRINGATOM(length), INIT_STRINGATOM(length),
INIT_STRINGATOM(toString), INIT_STRINGATOM(toString),
@ -441,6 +441,12 @@ namespace MetaData {
execStackLimit = execStack + INITIAL_EXEC_STACK; execStackLimit = execStack + INITIAL_EXEC_STACK;
activationStackTop = activationStack = new ActivationFrame[MAX_ACTIVATION_STACK]; activationStackTop = activationStack = new ActivationFrame[MAX_ACTIVATION_STACK];
} }
JS2Engine::~JS2Engine()
{
delete [] execStack;
delete [] activationStack;
}
#ifdef DEBUG #ifdef DEBUG

Просмотреть файл

@ -178,7 +178,8 @@ void dumpBytecode(BytecodeContainer *bCon);
class JS2Engine { class JS2Engine {
public: public:
JS2Engine(World &world); JS2Engine(World &world);
~JS2Engine();
js2val interpret(Phase execPhase, BytecodeContainer *targetbCon, Environment *env); js2val interpret(Phase execPhase, BytecodeContainer *targetbCon, Environment *env);
js2val interpreterLoop(); js2val interpreterLoop();

Просмотреть файл

@ -153,10 +153,12 @@ namespace MetaData {
} }
catch (Exception &x) { catch (Exception &x) {
referenceArena->clear(); referenceArena->clear();
delete referenceArena;
referenceArena = oldArena; referenceArena = oldArena;
throw x; throw x;
} }
referenceArena->clear(); referenceArena->clear();
delete referenceArena;
referenceArena = oldArena; referenceArena = oldArena;
bCon->emitOp(eReturnVoid, lastPos); bCon->emitOp(eReturnVoid, lastPos);

Просмотреть файл

@ -3446,7 +3446,9 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now...
bConList.clear(); bConList.clear();
targetList.clear(); targetList.clear();
JS2Object::clear(this); // don't blow off the contents of 'this' as the destructors for JS2Object::clear(this); // don't blow off the contents of 'this' as the destructors for
// embedded objects will get messed up (as they run on exit). // embedded objects will get messed up (as they run on exit).
delete engine;
if (bCon) delete bCon;
} }
JS2Class *JS2Metadata::objectType(JS2Object *obj) JS2Class *JS2Metadata::objectType(JS2Object *obj)
@ -4678,9 +4680,10 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now...
delete obj; delete obj;
} }
else else
if (p->isString()) { if (p->isString()) {
String t;
String *s = (String *)(p + 1); String *s = (String *)(p + 1);
s->erase(); *s = t;
} }
released += returnToPond(p); released += returnToPond(p);
} }