Move class declaration of Comment from codegen-inl.h to codegen.h

-inl.h files should only contains small inline functions and
no class declarations. Implementation moved to codegen.cc since
it's not a performance critical class (only used in DEBUG mode).
 
Review URL: http://codereview.chromium.org/585004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3812 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent f332ab96
...@@ -49,47 +49,9 @@ ...@@ -49,47 +49,9 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
#define __ ACCESS_MASM(masm_)
Handle<Script> CodeGenerator::script() { return info_->script(); } Handle<Script> CodeGenerator::script() { return info_->script(); }
bool CodeGenerator::is_eval() { return info_->is_eval(); } bool CodeGenerator::is_eval() { return info_->is_eval(); }
// -----------------------------------------------------------------------------
// Support for "structured" code comments.
//
// By selecting matching brackets in disassembler output,
// code segments can be identified more easily.
#ifdef DEBUG
class Comment BASE_EMBEDDED {
public:
Comment(MacroAssembler* masm, const char* msg) : masm_(masm), msg_(msg) {
__ RecordComment(msg);
}
~Comment() {
if (msg_[0] == '[') __ RecordComment("]");
}
private:
MacroAssembler* masm_;
const char* msg_;
};
#else
class Comment BASE_EMBEDDED {
public:
Comment(MacroAssembler*, const char*) {}
};
#endif // DEBUG
#undef __
} } // namespace v8::internal } } // namespace v8::internal
#endif // V8_CODEGEN_INL_H_ #endif // V8_CODEGEN_INL_H_
...@@ -42,6 +42,24 @@ ...@@ -42,6 +42,24 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
#define __ ACCESS_MASM(masm_)
#ifdef DEBUG
Comment::Comment(MacroAssembler* masm, const char* msg)
: masm_(masm), msg_(msg) {
__ RecordComment(msg);
}
Comment::~Comment() {
if (msg_[0] == '[') __ RecordComment("]");
}
#endif // DEBUG
#undef __
CodeGenerator* CodeGeneratorScope::top_ = NULL; CodeGenerator* CodeGeneratorScope::top_ = NULL;
......
...@@ -98,6 +98,29 @@ namespace v8 { ...@@ -98,6 +98,29 @@ namespace v8 {
namespace internal { namespace internal {
// Support for "structured" code comments.
#ifdef DEBUG
class Comment BASE_EMBEDDED {
public:
Comment(MacroAssembler* masm, const char* msg);
~Comment();
private:
MacroAssembler* masm_;
const char* msg_;
};
#else
class Comment BASE_EMBEDDED {
public:
Comment(MacroAssembler*, const char*) {}
};
#endif // DEBUG
// Code generation can be nested. Code generation scopes form a stack // Code generation can be nested. Code generation scopes form a stack
// of active code generators. // of active code generators.
class CodeGeneratorScope BASE_EMBEDDED { class CodeGeneratorScope BASE_EMBEDDED {
......
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