Commit 81af5bee authored by bak@chromium.org's avatar bak@chromium.org

Changed FuncNameInferrer and ScopeInfo to support zone allocation.

Yields a 2% speedup when running compiler-benchmark.

Review URL: http://codereview.chromium.org/113519

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1985 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 20b3a4de
......@@ -170,7 +170,7 @@ Handle<Code> CodeGenerator::MakeCode(FunctionLiteral* flit,
HistogramTimerScope timer(&Counters::code_creation);
CodeDesc desc;
cgen.masm()->GetCode(&desc);
ScopeInfo<> sinfo(flit->scope());
ZoneScopeInfo sinfo(flit->scope());
Code::Flags flags = Code::ComputeFlags(Code::FUNCTION);
Handle<Code> code = Factory::NewCode(desc,
&sinfo,
......
......@@ -509,8 +509,10 @@ Handle<JSFunction> Factory::NewFunctionWithPrototype(Handle<String> name,
}
Handle<Code> Factory::NewCode(const CodeDesc& desc, ScopeInfo<>* sinfo,
Code::Flags flags, Handle<Object> self_ref) {
Handle<Code> Factory::NewCode(const CodeDesc& desc,
ZoneScopeInfo* sinfo,
Code::Flags flags,
Handle<Object> self_ref) {
CALL_HEAP_FUNCTION(Heap::CreateCode(desc, sinfo, flags, self_ref), Code);
}
......
......@@ -29,6 +29,7 @@
#define V8_FACTORY_H_
#include "heap.h"
#include "zone-inl.h"
namespace v8 { namespace internal {
......@@ -202,8 +203,10 @@ class Factory : public AllStatic {
Handle<JSFunction> boilerplate,
Handle<Context> context);
static Handle<Code> NewCode(const CodeDesc& desc, ScopeInfo<>* sinfo,
Code::Flags flags, Handle<Object> self_reference);
static Handle<Code> NewCode(const CodeDesc& desc,
ZoneScopeInfo* sinfo,
Code::Flags flags,
Handle<Object> self_reference);
static Handle<Code> CopyCode(Handle<Code> code);
......
......@@ -82,9 +82,9 @@ class FuncNameInferrer BASE_EMBEDDED {
Handle<String> MakeNameFromStackHelper(int pos, Handle<String> prev);
void InferFunctionsNames();
List<int> entries_stack_;
List<Handle<String> > names_stack_;
List<FunctionLiteral*> funcs_to_infer_;
ZoneList<int> entries_stack_;
ZoneList<Handle<String> > names_stack_;
ZoneList<FunctionLiteral*> funcs_to_infer_;
Handle<String> dot_;
DISALLOW_COPY_AND_ASSIGN(FuncNameInferrer);
......
......@@ -239,6 +239,7 @@ class ObjectGroup;
class TickSample;
class VirtualMemory;
class Mutex;
class ZoneScopeInfo;
typedef bool (*WeakSlotCallback)(Object** pointer);
......
......@@ -1699,7 +1699,7 @@ void Heap::CreateFillerObjectAt(Address addr, int size) {
Object* Heap::CreateCode(const CodeDesc& desc,
ScopeInfo<>* sinfo,
ZoneScopeInfo* sinfo,
Code::Flags flags,
Handle<Object> self_reference) {
// Compute size
......
......@@ -28,6 +28,8 @@
#ifndef V8_HEAP_H_
#define V8_HEAP_H_
#include "zone-inl.h"
namespace v8 { namespace internal {
// Defines all the roots in Heap.
......@@ -570,7 +572,7 @@ class Heap : public AllStatic {
// object by containing this pointer.
// Please note this function does not perform a garbage collection.
static Object* CreateCode(const CodeDesc& desc,
ScopeInfo<>* sinfo,
ZoneScopeInfo* sinfo,
Code::Flags flags,
Handle<Object> self_reference);
......
......@@ -588,7 +588,7 @@ class CodeGenerator: public AstVisitor {
bool is_eval_; // Tells whether code is generated for eval.
Handle<Script> script_;
List<DeferredCode*> deferred_;
ZoneList<DeferredCode*> deferred_;
// Assembler
MacroAssembler* masm_; // to generate code
......
......@@ -566,5 +566,6 @@ void ScopeInfo<Allocator>::Print() {
// Make sure the classes get instantiated by the template system.
template class ScopeInfo<FreeStoreAllocationPolicy>;
template class ScopeInfo<PreallocatedStorage>;
template class ScopeInfo<ZoneListAllocationPolicy>;
} } // namespace v8::internal
......@@ -150,6 +150,18 @@ class ScopeInfo BASE_EMBEDDED {
List<Variable::Mode, Allocator > context_modes_;
};
class ZoneScopeInfo: public ScopeInfo<ZoneListAllocationPolicy> {
public:
// Create a ZoneScopeInfo instance from a scope.
explicit ZoneScopeInfo(Scope* scope)
: ScopeInfo<ZoneListAllocationPolicy>(scope) {}
// Create a ZoneScopeInfo instance from a Code object.
explicit ZoneScopeInfo(Code* code)
: ScopeInfo<ZoneListAllocationPolicy>(code) {}
};
} } // namespace v8::internal
#endif // V8_SCOPEINFO_H_
......@@ -301,6 +301,8 @@ template void Scope::CollectUsedVariables(
List<Variable*, FreeStoreAllocationPolicy>* locals);
template void Scope::CollectUsedVariables(
List<Variable*, PreallocatedStorage>* locals);
template void Scope::CollectUsedVariables(
List<Variable*, ZoneListAllocationPolicy>* locals);
void Scope::AllocateVariables(Handle<Context> context) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment