From 44e8762bb21ab3cbc6fabb0be625f40f83866bb6 Mon Sep 17 00:00:00 2001 From: "rogerl%netscape.com" Date: Fri, 11 Apr 2003 22:20:10 +0000 Subject: [PATCH] Leakage. --- js2/src/bytecodecontainer.h | 2 +- js2/src/epimetheus.cpp | 4 +++- js2/src/js2metadata.cpp | 10 +++++++--- js2/src/js2metadata.h | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/js2/src/bytecodecontainer.h b/js2/src/bytecodecontainer.h index 821d2afdcb0f..df20039b1f88 100644 --- a/js2/src/bytecodecontainer.h +++ b/js2/src/bytecodecontainer.h @@ -92,7 +92,7 @@ public: #endif { } - BytecodeContainer::~BytecodeContainer() { String t; mSource = t; mSourceLocation = t; } + BytecodeContainer::~BytecodeContainer() { } void mark(); diff --git a/js2/src/epimetheus.cpp b/js2/src/epimetheus.cpp index 86efce0ae808..adfcd7dfd0c5 100644 --- a/js2/src/epimetheus.cpp +++ b/js2/src/epimetheus.cpp @@ -141,11 +141,13 @@ static int readEvalPrint(FILE *in) stdOut << '\n'; } if (parsedStatements) { - MetaData::CompilationData *oldData = metadata->startCompilationUnit(NULL, buffer, ConsoleName); + MetaData::CompilationData *oldData = metadata->startCompilationUnit(NULL, buffer, ConsoleName); + MetaData::BytecodeContainer *bCon = metadata->bCon; metadata->ValidateStmtList(parsedStatements); js2val rval = metadata->ExecuteStmtList(RunPhase, parsedStatements); if (!JS2VAL_IS_VOID(rval)) stdOut << *metadata->toString(rval) << '\n'; + delete bCon; metadata->restoreCompilationUnit(oldData); } } diff --git a/js2/src/js2metadata.cpp b/js2/src/js2metadata.cpp index 76fa63567712..45bd835cd0a7 100644 --- a/js2/src/js2metadata.cpp +++ b/js2/src/js2metadata.cpp @@ -4342,11 +4342,12 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now... DEFINE_ROOTKEEPER(rk2, argsObj); // Add the 'arguments' property - String *name = &meta->world.identifiers["arguments"]; - ASSERT(localBindings[*name] == NULL); - LocalBindingEntry *lbe = new LocalBindingEntry(*name); + String name(widenCString("arguments")); + ASSERT(localBindings[name] == NULL); + LocalBindingEntry *lbe = new LocalBindingEntry(name); LocalBinding *sb = new LocalBinding(ReadAccess, new Variable(meta->arrayClass, OBJECT_TO_JS2VAL(argsObj), true), false); lbe->bindingList.push_back(LocalBindingEntry::NamespaceBinding(meta->publicNamespace, sb)); + localBindings.insert(name, lbe); uint32 i; for (i = 0; (i < argCount); i++) { @@ -4377,6 +4378,9 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now... GCMARKVALUE(thisObject); } + ParameterFrame::~ParameterFrame() + { + } /************************************************************************************ * diff --git a/js2/src/js2metadata.h b/js2/src/js2metadata.h index f94f97dc2f79..62483eb7b61d 100644 --- a/js2/src/js2metadata.h +++ b/js2/src/js2metadata.h @@ -560,7 +560,7 @@ public: template class BindingEntry { public: - BindingEntry(const String s) : name(s) { } + BindingEntry(const String &s) : name(s) { } BindingEntry *clone(); void clear(); @@ -1102,7 +1102,7 @@ public: virtual void instantiate(Environment *env); void assignArguments(JS2Metadata *meta, JS2Object *fnObj, js2val *argBase, uint32 argCount, uint32 length); virtual void markChildren(); - virtual ~ParameterFrame() { } + virtual ~ParameterFrame(); }; class BlockFrame : public NonWithFrame {