Commit 05e87841 authored by ager@chromium.org's avatar ager@chromium.org

Allow the optimizing compiler to use an existing macro assembler.

This is the first towards using the optimizing compiler for split
compilation bailouts.
Review URL: http://codereview.chromium.org/557079

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3756 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 2a8034c8
......@@ -121,12 +121,13 @@ CodeGenState::~CodeGenState() {
// -------------------------------------------------------------------------
// CodeGenerator implementation
CodeGenerator::CodeGenerator(int buffer_size, Handle<Script> script,
CodeGenerator::CodeGenerator(MacroAssembler* masm,
Handle<Script> script,
bool is_eval)
: is_eval_(is_eval),
script_(script),
deferred_(8),
masm_(new MacroAssembler(NULL, buffer_size)),
masm_(masm),
scope_(NULL),
frame_(NULL),
allocator_(NULL),
......
......@@ -203,8 +203,7 @@ class CodeGenerator: public AstVisitor {
private:
// Construction/Destruction
CodeGenerator(int buffer_size, Handle<Script> script, bool is_eval);
virtual ~CodeGenerator() { delete masm_; }
CodeGenerator(MacroAssembler* masm, Handle<Script> script, bool is_eval);
// Accessors
Scope* scope() const { return scope_; }
......
......@@ -225,7 +225,8 @@ Handle<Code> CodeGenerator::MakeCode(FunctionLiteral* fun,
MakeCodePrologue(fun);
// Generate code.
const int kInitialBufferSize = 4 * KB;
CodeGenerator cgen(kInitialBufferSize, script, is_eval);
MacroAssembler masm(NULL, kInitialBufferSize);
CodeGenerator cgen(&masm, script, is_eval);
CodeGeneratorScope scope(&cgen);
cgen.GenCode(fun, info);
if (cgen.HasStackOverflow()) {
......
......@@ -103,13 +103,13 @@ CodeGenState::~CodeGenState() {
// -------------------------------------------------------------------------
// CodeGenerator implementation
CodeGenerator::CodeGenerator(int buffer_size,
CodeGenerator::CodeGenerator(MacroAssembler* masm,
Handle<Script> script,
bool is_eval)
: is_eval_(is_eval),
script_(script),
deferred_(8),
masm_(new MacroAssembler(NULL, buffer_size)),
masm_(masm),
scope_(NULL),
frame_(NULL),
allocator_(NULL),
......
......@@ -343,8 +343,7 @@ class CodeGenerator: public AstVisitor {
private:
// Construction/Destruction
CodeGenerator(int buffer_size, Handle<Script> script, bool is_eval);
virtual ~CodeGenerator() { delete masm_; }
CodeGenerator(MacroAssembler* masm, Handle<Script> script, bool is_eval);
// Accessors
Scope* scope() const { return scope_; }
......
......@@ -246,13 +246,13 @@ class FloatingPointHelper : public AllStatic {
// -----------------------------------------------------------------------------
// CodeGenerator implementation.
CodeGenerator::CodeGenerator(int buffer_size,
CodeGenerator::CodeGenerator(MacroAssembler* masm,
Handle<Script> script,
bool is_eval)
: is_eval_(is_eval),
script_(script),
deferred_(8),
masm_(new MacroAssembler(NULL, buffer_size)),
masm_(masm),
scope_(NULL),
frame_(NULL),
allocator_(NULL),
......
......@@ -343,8 +343,7 @@ class CodeGenerator: public AstVisitor {
private:
// Construction/Destruction
CodeGenerator(int buffer_size, Handle<Script> script, bool is_eval);
virtual ~CodeGenerator() { delete masm_; }
CodeGenerator(MacroAssembler* masm, Handle<Script> script, bool is_eval);
// Accessors
Scope* scope() const { return scope_; }
......
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