Refactoring: Make emit_debug_code flag handling architecture-independent.

Review URL: https://codereview.chromium.org/11312165

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12921 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a28bc2fd
...@@ -325,8 +325,7 @@ static const int kMinimalBufferSize = 4*KB; ...@@ -325,8 +325,7 @@ static const int kMinimalBufferSize = 4*KB;
Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size) Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size)
: AssemblerBase(arg_isolate), : AssemblerBase(arg_isolate),
recorded_ast_id_(TypeFeedbackId::None()), recorded_ast_id_(TypeFeedbackId::None()),
positions_recorder_(this), positions_recorder_(this) {
emit_debug_code_(FLAG_debug_code) {
if (buffer == NULL) { if (buffer == NULL) {
// Do our own buffer management. // Do our own buffer management.
if (buffer_size <= kMinimalBufferSize) { if (buffer_size <= kMinimalBufferSize) {
......
...@@ -649,9 +649,6 @@ class Assembler : public AssemblerBase { ...@@ -649,9 +649,6 @@ class Assembler : public AssemblerBase {
Assembler(Isolate* isolate, void* buffer, int buffer_size); Assembler(Isolate* isolate, void* buffer, int buffer_size);
~Assembler(); ~Assembler();
// Overrides the default provided by FLAG_debug_code.
void set_emit_debug_code(bool value) { emit_debug_code_ = value; }
// GetCode emits any pending (non-emitted) code and fills the descriptor // GetCode emits any pending (non-emitted) code and fills the descriptor
// desc. GetCode() is idempotent; it returns the same result if no other // desc. GetCode() is idempotent; it returns the same result if no other
// Assembler functions are invoked in between GetCode() calls. // Assembler functions are invoked in between GetCode() calls.
...@@ -1338,8 +1335,6 @@ class Assembler : public AssemblerBase { ...@@ -1338,8 +1335,6 @@ class Assembler : public AssemblerBase {
// the relocation info. // the relocation info.
TypeFeedbackId recorded_ast_id_; TypeFeedbackId recorded_ast_id_;
bool emit_debug_code() const { return emit_debug_code_; }
int buffer_space() const { return reloc_info_writer.pos() - pc_; } int buffer_space() const { return reloc_info_writer.pos() - pc_; }
// Decode branch instruction at pos and return branch target pos // Decode branch instruction at pos and return branch target pos
...@@ -1490,9 +1485,6 @@ class Assembler : public AssemblerBase { ...@@ -1490,9 +1485,6 @@ class Assembler : public AssemblerBase {
friend class BlockConstPoolScope; friend class BlockConstPoolScope;
PositionsRecorder positions_recorder_; PositionsRecorder positions_recorder_;
bool emit_debug_code_;
friend class PositionsRecorder; friend class PositionsRecorder;
friend class EnsureSpace; friend class EnsureSpace;
}; };
......
...@@ -109,6 +109,7 @@ const char* const RelocInfo::kFillerCommentString = "DEOPTIMIZATION PADDING"; ...@@ -109,6 +109,7 @@ const char* const RelocInfo::kFillerCommentString = "DEOPTIMIZATION PADDING";
AssemblerBase::AssemblerBase(Isolate* isolate) AssemblerBase::AssemblerBase(Isolate* isolate)
: isolate_(isolate), : isolate_(isolate),
jit_cookie_(0), jit_cookie_(0),
emit_debug_code_(FLAG_debug_code),
predictable_code_size_(false) { predictable_code_size_(false) {
if (FLAG_mask_constants_with_cookie && isolate != NULL) { if (FLAG_mask_constants_with_cookie && isolate != NULL) {
jit_cookie_ = V8::RandomPrivate(isolate); jit_cookie_ = V8::RandomPrivate(isolate);
......
...@@ -61,6 +61,9 @@ class AssemblerBase: public Malloced { ...@@ -61,6 +61,9 @@ class AssemblerBase: public Malloced {
Isolate* isolate() const { return isolate_; } Isolate* isolate() const { return isolate_; }
int jit_cookie() const { return jit_cookie_; } int jit_cookie() const { return jit_cookie_; }
bool emit_debug_code() const { return emit_debug_code_; }
void set_emit_debug_code(bool value) { emit_debug_code_ = value; }
bool predictable_code_size() const { return predictable_code_size_; } bool predictable_code_size() const { return predictable_code_size_; }
void set_predictable_code_size(bool value) { predictable_code_size_ = value; } void set_predictable_code_size(bool value) { predictable_code_size_ = value; }
...@@ -71,6 +74,7 @@ class AssemblerBase: public Malloced { ...@@ -71,6 +74,7 @@ class AssemblerBase: public Malloced {
private: private:
Isolate* isolate_; Isolate* isolate_;
int jit_cookie_; int jit_cookie_;
bool emit_debug_code_;
bool predictable_code_size_; bool predictable_code_size_;
}; };
......
...@@ -314,8 +314,7 @@ static void InitCoverageLog(); ...@@ -314,8 +314,7 @@ static void InitCoverageLog();
Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size) Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size)
: AssemblerBase(arg_isolate), : AssemblerBase(arg_isolate),
positions_recorder_(this), positions_recorder_(this) {
emit_debug_code_(FLAG_debug_code) {
if (buffer == NULL) { if (buffer == NULL) {
// Do our own buffer management. // Do our own buffer management.
if (buffer_size <= kMinimalBufferSize) { if (buffer_size <= kMinimalBufferSize) {
......
...@@ -584,9 +584,6 @@ class Assembler : public AssemblerBase { ...@@ -584,9 +584,6 @@ class Assembler : public AssemblerBase {
Assembler(Isolate* isolate, void* buffer, int buffer_size); Assembler(Isolate* isolate, void* buffer, int buffer_size);
~Assembler(); ~Assembler();
// Overrides the default provided by FLAG_debug_code.
void set_emit_debug_code(bool value) { emit_debug_code_ = value; }
// GetCode emits any pending (non-emitted) code and fills the descriptor // GetCode emits any pending (non-emitted) code and fills the descriptor
// desc. GetCode() is idempotent; it returns the same result if no other // desc. GetCode() is idempotent; it returns the same result if no other
// Assembler functions are invoked in between GetCode() calls. // Assembler functions are invoked in between GetCode() calls.
...@@ -1120,8 +1117,6 @@ class Assembler : public AssemblerBase { ...@@ -1120,8 +1117,6 @@ class Assembler : public AssemblerBase {
void set_byte_at(int pos, byte value) { buffer_[pos] = value; } void set_byte_at(int pos, byte value) { buffer_[pos] = value; }
protected: protected:
bool emit_debug_code() const { return emit_debug_code_; }
void movsd(XMMRegister dst, const Operand& src); void movsd(XMMRegister dst, const Operand& src);
void movsd(const Operand& dst, XMMRegister src); void movsd(const Operand& dst, XMMRegister src);
...@@ -1194,9 +1189,6 @@ class Assembler : public AssemblerBase { ...@@ -1194,9 +1189,6 @@ class Assembler : public AssemblerBase {
RelocInfoWriter reloc_info_writer; RelocInfoWriter reloc_info_writer;
PositionsRecorder positions_recorder_; PositionsRecorder positions_recorder_;
bool emit_debug_code_;
friend class PositionsRecorder; friend class PositionsRecorder;
}; };
......
...@@ -274,8 +274,7 @@ static const int kMinimalBufferSize = 4 * KB; ...@@ -274,8 +274,7 @@ static const int kMinimalBufferSize = 4 * KB;
Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size) Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size)
: AssemblerBase(arg_isolate), : AssemblerBase(arg_isolate),
recorded_ast_id_(TypeFeedbackId::None()), recorded_ast_id_(TypeFeedbackId::None()),
positions_recorder_(this), positions_recorder_(this) {
emit_debug_code_(FLAG_debug_code) {
if (buffer == NULL) { if (buffer == NULL) {
// Do our own buffer management. // Do our own buffer management.
if (buffer_size <= kMinimalBufferSize) { if (buffer_size <= kMinimalBufferSize) {
......
...@@ -525,9 +525,6 @@ class Assembler : public AssemblerBase { ...@@ -525,9 +525,6 @@ class Assembler : public AssemblerBase {
Assembler(Isolate* isolate, void* buffer, int buffer_size); Assembler(Isolate* isolate, void* buffer, int buffer_size);
~Assembler(); ~Assembler();
// Overrides the default provided by FLAG_debug_code.
void set_emit_debug_code(bool value) { emit_debug_code_ = value; }
// Dummy for cross platform compatibility. // Dummy for cross platform compatibility.
void set_predictable_code_size(bool value) { } void set_predictable_code_size(bool value) { }
...@@ -1033,8 +1030,6 @@ class Assembler : public AssemblerBase { ...@@ -1033,8 +1030,6 @@ class Assembler : public AssemblerBase {
// the relocation info. // the relocation info.
TypeFeedbackId recorded_ast_id_; TypeFeedbackId recorded_ast_id_;
bool emit_debug_code() const { return emit_debug_code_; }
int32_t buffer_space() const { return reloc_info_writer.pos() - pc_; } int32_t buffer_space() const { return reloc_info_writer.pos() - pc_; }
// Decode branch instruction at pos and return branch target pos. // Decode branch instruction at pos and return branch target pos.
...@@ -1285,7 +1280,6 @@ class Assembler : public AssemblerBase { ...@@ -1285,7 +1280,6 @@ class Assembler : public AssemblerBase {
friend class BlockTrampolinePoolScope; friend class BlockTrampolinePoolScope;
PositionsRecorder positions_recorder_; PositionsRecorder positions_recorder_;
bool emit_debug_code_;
friend class PositionsRecorder; friend class PositionsRecorder;
friend class EnsureSpace; friend class EnsureSpace;
}; };
......
...@@ -349,8 +349,7 @@ static void InitCoverageLog(); ...@@ -349,8 +349,7 @@ static void InitCoverageLog();
Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size) Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size)
: AssemblerBase(arg_isolate), : AssemblerBase(arg_isolate),
code_targets_(100), code_targets_(100),
positions_recorder_(this), positions_recorder_(this) {
emit_debug_code_(FLAG_debug_code) {
if (buffer == NULL) { if (buffer == NULL) {
// Do our own buffer management. // Do our own buffer management.
if (buffer_size <= kMinimalBufferSize) { if (buffer_size <= kMinimalBufferSize) {
......
...@@ -558,9 +558,6 @@ class Assembler : public AssemblerBase { ...@@ -558,9 +558,6 @@ class Assembler : public AssemblerBase {
Assembler(Isolate* isolate, void* buffer, int buffer_size); Assembler(Isolate* isolate, void* buffer, int buffer_size);
~Assembler(); ~Assembler();
// Overrides the default provided by FLAG_debug_code.
void set_emit_debug_code(bool value) { emit_debug_code_ = value; }
// GetCode emits any pending (non-emitted) code and fills the descriptor // GetCode emits any pending (non-emitted) code and fills the descriptor
// desc. GetCode() is idempotent; it returns the same result if no other // desc. GetCode() is idempotent; it returns the same result if no other
// Assembler functions are invoked in between GetCode() calls. // Assembler functions are invoked in between GetCode() calls.
...@@ -1444,9 +1441,6 @@ class Assembler : public AssemblerBase { ...@@ -1444,9 +1441,6 @@ class Assembler : public AssemblerBase {
byte byte_at(int pos) { return buffer_[pos]; } byte byte_at(int pos) { return buffer_[pos]; }
void set_byte_at(int pos, byte value) { buffer_[pos] = value; } void set_byte_at(int pos, byte value) { buffer_[pos] = value; }
protected:
bool emit_debug_code() const { return emit_debug_code_; }
private: private:
byte* addr_at(int pos) { return buffer_ + pos; } byte* addr_at(int pos) { return buffer_ + pos; }
uint32_t long_at(int pos) { uint32_t long_at(int pos) {
...@@ -1648,9 +1642,6 @@ class Assembler : public AssemblerBase { ...@@ -1648,9 +1642,6 @@ class Assembler : public AssemblerBase {
List< Handle<Code> > code_targets_; List< Handle<Code> > code_targets_;
PositionsRecorder positions_recorder_; PositionsRecorder positions_recorder_;
bool emit_debug_code_;
friend class PositionsRecorder; friend class PositionsRecorder;
}; };
......
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