diff -r 0f330cf7e09a -r af1ed58252ac jitcraft/BytecodeCompiler.cpp --- a/jitcraft/BytecodeCompiler.cpp Tue Jul 03 00:28:21 2012 -0700 +++ b/jitcraft/BytecodeCompiler.cpp Tue Jul 03 00:32:19 2012 -0700 @@ -530,7 +530,6 @@ static inline ArrayMap * BuildArrayMap(Zone *zone, Handle type) { - // :TODO: use local Local contained(zone); if (type->levels() > 1) { Local containedType(zone, type->contained()); @@ -545,7 +544,6 @@ void BytecodeCompiler::visit(StringLiteral *node) { - // :TODO: remove this Local Local type(zone_, node->type()); Local map(zone_, BuildArrayMap(zone_, type)); if (!map) @@ -569,7 +567,6 @@ Local type(zone_, var->type()); if (type->isArray()) { - // :TODO: use Local Local map(zone_, BuildArrayMap(zone_, type)); __ newarray_lifo(map); @@ -594,14 +591,13 @@ void BytecodeCompiler::visit(CallExpression *node) { - // :TODO: use Local - Type *funType = node->callee()->type(); + Local funType(zone_, node->callee()->type()); for (size_t i = 0; i < node->arguments()->size(); i++) { Expression *arg = node->arguments()->at(i); - Type *given = arg->type(); - Type *actual = Type::cast(funType->parameters()->at(i)); + Local given(zone_, arg->type()); + Local actual(zone_, Type::cast(funType->parameters()->at(i))); if (actual->isReference()) { if (given->isReference()) { // The input type is already a reference, so we're just passing @@ -656,7 +652,7 @@ BytecodeCompiler::visit(FunctionStatement *node) { BytecodeCompiler child(zone_, tree_, module_); - Function *fun = child.compileFunction(module_, node); + Local fun(zone_, child.compileFunction(module_, node)); if (!fun) return; @@ -676,7 +672,6 @@ // Note: No need to record a life slot here, since it's part of the Frame. AutoEnterScope functionScope(this, node->scope()); - // :TODO: use locals locals_ = FixedArray::New(zone_, node->scope()->maxContainedLocals(), Heap::Tenure_Old); node->body()->accept(this); @@ -686,13 +681,13 @@ if (__ oom()) return NULL; - ByteArray *bytes = ByteArray::New(zone_, __ length() * sizeof(bytecode), Heap::Tenure_Old); + Local bytes(zone_, ByteArray::New(zone_, __ length() * sizeof(bytecode), Heap::Tenure_Old)); if (!bytes) return NULL; memcpy(bytes->raw(), __ buffer(), __ length()); unsigned nargs = node->scope()->numArguments(); - FixedArray *args = FixedArray::New(zone_, nargs, Heap::Tenure_Old); + Local args(zone_, FixedArray::New(zone_, nargs, Heap::Tenure_Old)); if (!args) return NULL; @@ -702,18 +697,18 @@ for (size_t i = 0; i < node->scope()->maxContainedLocals(); i++) assert(locals_->at(i)); - FixedArray *objects = FixedArray::New(zone_, __ objects()->size(), Heap::Tenure_Old); + Local objects(zone_, FixedArray::New(zone_, __ objects()->size(), Heap::Tenure_Old)); if (!objects) return NULL; for (size_t i = 0; i < __ objects()->size(); i++) objects->set(zone_, i, __ objects()->at(i)); - Code *code = Code::New(zone_, bytes, locals_, objects, __ maxStackDepth(), module_); + Local code(zone_, Code::New(zone_, bytes, locals_, objects, __ maxStackDepth(), module_)); if (!code) return NULL; - Function *fun = Function::New(zone_, module_, code, node->fun()->type(), node->pos()); + Local fun(zone_, Function::New(zone_, module_, code, node->fun()->type(), node->pos())); if (!fun) return NULL; @@ -723,7 +718,6 @@ Module * BytecodeCompiler::compile() { - // :TODO: root module_ = Module::New(zone_, tree_->scope()->numFunctions()); if (!module_) return NULL;