Moved buffer handling to AssemblerBase.

This removed a lot of copy-n-paste code and is very handy for some upcoming
changes (regarding predictable code size).

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13034 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ce05280b
...@@ -318,44 +318,11 @@ const Instr kLdrStrInstrArgumentMask = 0x0000ffff; ...@@ -318,44 +318,11 @@ const Instr kLdrStrInstrArgumentMask = 0x0000ffff;
const Instr kLdrStrOffsetMask = 0x00000fff; const Instr kLdrStrOffsetMask = 0x00000fff;
// Spare buffer. Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size)
static const int kMinimalBufferSize = 4*KB; : AssemblerBase(isolate, buffer, buffer_size),
Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size)
: AssemblerBase(arg_isolate),
recorded_ast_id_(TypeFeedbackId::None()), recorded_ast_id_(TypeFeedbackId::None()),
positions_recorder_(this) { positions_recorder_(this) {
if (buffer == NULL) { reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_);
// Do our own buffer management.
if (buffer_size <= kMinimalBufferSize) {
buffer_size = kMinimalBufferSize;
if (isolate()->assembler_spare_buffer() != NULL) {
buffer = isolate()->assembler_spare_buffer();
isolate()->set_assembler_spare_buffer(NULL);
}
}
if (buffer == NULL) {
buffer_ = NewArray<byte>(buffer_size);
} else {
buffer_ = static_cast<byte*>(buffer);
}
buffer_size_ = buffer_size;
own_buffer_ = true;
} else {
// Use externally provided buffer instead.
ASSERT(buffer_size > 0);
buffer_ = static_cast<byte*>(buffer);
buffer_size_ = buffer_size;
own_buffer_ = false;
}
// Set up buffer pointers.
ASSERT(buffer_ != NULL);
pc_ = buffer_;
reloc_info_writer.Reposition(buffer_ + buffer_size, pc_);
num_pending_reloc_info_ = 0; num_pending_reloc_info_ = 0;
next_buffer_check_ = 0; next_buffer_check_ = 0;
const_pool_blocked_nesting_ = 0; const_pool_blocked_nesting_ = 0;
...@@ -368,14 +335,6 @@ Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size) ...@@ -368,14 +335,6 @@ Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size)
Assembler::~Assembler() { Assembler::~Assembler() {
ASSERT(const_pool_blocked_nesting_ == 0); ASSERT(const_pool_blocked_nesting_ == 0);
if (own_buffer_) {
if (isolate()->assembler_spare_buffer() == NULL &&
buffer_size_ == kMinimalBufferSize) {
isolate()->set_assembler_spare_buffer(buffer_);
} else {
DeleteArray(buffer_);
}
}
} }
......
...@@ -647,7 +647,7 @@ class Assembler : public AssemblerBase { ...@@ -647,7 +647,7 @@ class Assembler : public AssemblerBase {
// is too small, a fatal error occurs. No deallocation of the buffer is done // is too small, a fatal error occurs. No deallocation of the buffer is done
// upon destruction of the assembler. // upon destruction of the assembler.
Assembler(Isolate* isolate, void* buffer, int buffer_size); Assembler(Isolate* isolate, void* buffer, int buffer_size);
~Assembler(); virtual ~Assembler();
// 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
...@@ -1276,8 +1276,6 @@ class Assembler : public AssemblerBase { ...@@ -1276,8 +1276,6 @@ class Assembler : public AssemblerBase {
void db(uint8_t data); void db(uint8_t data);
void dd(uint32_t data); void dd(uint32_t data);
int pc_offset() const { return pc_ - buffer_; }
PositionsRecorder* positions_recorder() { return &positions_recorder_; } PositionsRecorder* positions_recorder() { return &positions_recorder_; }
// Read/patch instructions // Read/patch instructions
...@@ -1380,13 +1378,6 @@ class Assembler : public AssemblerBase { ...@@ -1380,13 +1378,6 @@ class Assembler : public AssemblerBase {
} }
private: private:
// Code buffer:
// The buffer into which code and relocation info are generated.
byte* buffer_;
int buffer_size_;
// True if the assembler owns the buffer, false if buffer is external.
bool own_buffer_;
int next_buffer_check_; // pc offset of next buffer check int next_buffer_check_; // pc offset of next buffer check
// Code generation // Code generation
...@@ -1395,7 +1386,6 @@ class Assembler : public AssemblerBase { ...@@ -1395,7 +1386,6 @@ class Assembler : public AssemblerBase {
// not have to check for overflow. The same is true for writes of large // not have to check for overflow. The same is true for writes of large
// relocation info entries. // relocation info entries.
static const int kGap = 32; static const int kGap = 32;
byte* pc_; // the program counter; moves forward
// Constant pool generation // Constant pool generation
// Pools are emitted in the instruction stream, preferably after unconditional // Pools are emitted in the instruction stream, preferably after unconditional
......
...@@ -106,7 +106,7 @@ const char* const RelocInfo::kFillerCommentString = "DEOPTIMIZATION PADDING"; ...@@ -106,7 +106,7 @@ const char* const RelocInfo::kFillerCommentString = "DEOPTIMIZATION PADDING";
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Implementation of AssemblerBase // Implementation of AssemblerBase
AssemblerBase::AssemblerBase(Isolate* isolate) AssemblerBase::AssemblerBase(Isolate* isolate, void* buffer, int buffer_size)
: isolate_(isolate), : isolate_(isolate),
jit_cookie_(0), jit_cookie_(0),
emit_debug_code_(FLAG_debug_code), emit_debug_code_(FLAG_debug_code),
...@@ -114,6 +114,40 @@ AssemblerBase::AssemblerBase(Isolate* isolate) ...@@ -114,6 +114,40 @@ AssemblerBase::AssemblerBase(Isolate* isolate)
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);
} }
if (buffer == NULL) {
// Do our own buffer management.
if (buffer_size <= kMinimalBufferSize) {
buffer_size = kMinimalBufferSize;
if (isolate->assembler_spare_buffer() != NULL) {
buffer = isolate->assembler_spare_buffer();
isolate->set_assembler_spare_buffer(NULL);
}
}
if (buffer == NULL) buffer = NewArray<byte>(buffer_size);
own_buffer_ = true;
} else {
// Use externally provided buffer instead.
ASSERT(buffer_size > 0);
own_buffer_ = false;
}
buffer_ = static_cast<byte*>(buffer);
buffer_size_ = buffer_size;
pc_ = buffer_;
}
AssemblerBase::~AssemblerBase() {
if (own_buffer_) {
if (isolate() != NULL &&
isolate()->assembler_spare_buffer() == NULL &&
buffer_size_ == kMinimalBufferSize) {
isolate()->set_assembler_spare_buffer(buffer_);
} else {
DeleteArray(buffer_);
}
}
} }
......
...@@ -56,7 +56,8 @@ struct StatsCounter; ...@@ -56,7 +56,8 @@ struct StatsCounter;
class AssemblerBase: public Malloced { class AssemblerBase: public Malloced {
public: public:
explicit AssemblerBase(Isolate* isolate); AssemblerBase(Isolate* isolate, void* buffer, int buffer_size);
virtual ~AssemblerBase();
Isolate* isolate() const { return isolate_; } Isolate* isolate() const { return isolate_; }
int jit_cookie() const { return jit_cookie_; } int jit_cookie() const { return jit_cookie_; }
...@@ -71,6 +72,20 @@ class AssemblerBase: public Malloced { ...@@ -71,6 +72,20 @@ class AssemblerBase: public Malloced {
// cross-snapshotting. // cross-snapshotting.
static void QuietNaN(HeapObject* nan) { } static void QuietNaN(HeapObject* nan) { }
int pc_offset() const { return static_cast<int>(pc_ - buffer_); }
static const int kMinimalBufferSize = 4*KB;
protected:
// The buffer into which code and relocation info are generated. It could
// either be owned by the assembler or be provided externally.
byte* buffer_;
int buffer_size_;
bool own_buffer_;
// The program counter, which points into the buffer above and moves forward.
byte* pc_;
private: private:
Isolate* isolate_; Isolate* isolate_;
int jit_cookie_; int jit_cookie_;
......
...@@ -312,47 +312,19 @@ Register Operand::reg() const { ...@@ -312,47 +312,19 @@ Register Operand::reg() const {
static void InitCoverageLog(); static void InitCoverageLog();
#endif #endif
Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size) Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size)
: AssemblerBase(arg_isolate), : AssemblerBase(isolate, buffer, buffer_size),
positions_recorder_(this) { positions_recorder_(this) {
if (buffer == NULL) {
// Do our own buffer management.
if (buffer_size <= kMinimalBufferSize) {
buffer_size = kMinimalBufferSize;
if (isolate()->assembler_spare_buffer() != NULL) {
buffer = isolate()->assembler_spare_buffer();
isolate()->set_assembler_spare_buffer(NULL);
}
}
if (buffer == NULL) {
buffer_ = NewArray<byte>(buffer_size);
} else {
buffer_ = static_cast<byte*>(buffer);
}
buffer_size_ = buffer_size;
own_buffer_ = true;
} else {
// Use externally provided buffer instead.
ASSERT(buffer_size > 0);
buffer_ = static_cast<byte*>(buffer);
buffer_size_ = buffer_size;
own_buffer_ = false;
}
// Clear the buffer in debug mode unless it was provided by the // Clear the buffer in debug mode unless it was provided by the
// caller in which case we can't be sure it's okay to overwrite // caller in which case we can't be sure it's okay to overwrite
// existing code in it; see CodePatcher::CodePatcher(...). // existing code in it; see CodePatcher::CodePatcher(...).
#ifdef DEBUG #ifdef DEBUG
if (own_buffer_) { if (own_buffer_) {
memset(buffer_, 0xCC, buffer_size); // int3 memset(buffer_, 0xCC, buffer_size_); // int3
} }
#endif #endif
// Set up buffer pointers. reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_);
ASSERT(buffer_ != NULL);
pc_ = buffer_;
reloc_info_writer.Reposition(buffer_ + buffer_size, pc_);
#ifdef GENERATED_CODE_COVERAGE #ifdef GENERATED_CODE_COVERAGE
InitCoverageLog(); InitCoverageLog();
...@@ -360,18 +332,6 @@ Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size) ...@@ -360,18 +332,6 @@ Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size)
} }
Assembler::~Assembler() {
if (own_buffer_) {
if (isolate()->assembler_spare_buffer() == NULL &&
buffer_size_ == kMinimalBufferSize) {
isolate()->set_assembler_spare_buffer(buffer_);
} else {
DeleteArray(buffer_);
}
}
}
void Assembler::GetCode(CodeDesc* desc) { void Assembler::GetCode(CodeDesc* desc) {
// Finalize code (at this point overflow() may be true, but the gap ensures // Finalize code (at this point overflow() may be true, but the gap ensures
// that we are still not overlapping instructions and relocation info). // that we are still not overlapping instructions and relocation info).
......
...@@ -582,7 +582,7 @@ class Assembler : public AssemblerBase { ...@@ -582,7 +582,7 @@ class Assembler : public AssemblerBase {
// upon destruction of the assembler. // upon destruction of the assembler.
// TODO(vitalyr): the assembler does not need an isolate. // TODO(vitalyr): the assembler does not need an isolate.
Assembler(Isolate* isolate, void* buffer, int buffer_size); Assembler(Isolate* isolate, void* buffer, int buffer_size);
~Assembler(); virtual ~Assembler() { }
// 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
...@@ -1091,8 +1091,6 @@ class Assembler : public AssemblerBase { ...@@ -1091,8 +1091,6 @@ class Assembler : public AssemblerBase {
void db(uint8_t data); void db(uint8_t data);
void dd(uint32_t data); void dd(uint32_t data);
int pc_offset() const { return pc_ - buffer_; }
// Check if there is less than kGap bytes available in the buffer. // Check if there is less than kGap bytes available in the buffer.
// If this is the case, we need to grow the buffer before emitting // If this is the case, we need to grow the buffer before emitting
// an instruction or relocation information. // an instruction or relocation information.
...@@ -1111,7 +1109,6 @@ class Assembler : public AssemblerBase { ...@@ -1111,7 +1109,6 @@ class Assembler : public AssemblerBase {
// Avoid overflows for displacements etc. // Avoid overflows for displacements etc.
static const int kMaximalBufferSize = 512*MB; static const int kMaximalBufferSize = 512*MB;
static const int kMinimalBufferSize = 4*KB;
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; }
...@@ -1177,15 +1174,7 @@ class Assembler : public AssemblerBase { ...@@ -1177,15 +1174,7 @@ class Assembler : public AssemblerBase {
friend class CodePatcher; friend class CodePatcher;
friend class EnsureSpace; friend class EnsureSpace;
// Code buffer:
// The buffer into which code and relocation info are generated.
byte* buffer_;
int buffer_size_;
// True if the assembler owns the buffer, false if buffer is external.
bool own_buffer_;
// code generation // code generation
byte* pc_; // the program counter; moves forward
RelocInfoWriter reloc_info_writer; RelocInfoWriter reloc_info_writer;
PositionsRecorder positions_recorder_; PositionsRecorder positions_recorder_;
......
...@@ -267,44 +267,11 @@ const Instr kLwSwInstrArgumentMask = ~kLwSwInstrTypeMask; ...@@ -267,44 +267,11 @@ const Instr kLwSwInstrArgumentMask = ~kLwSwInstrTypeMask;
const Instr kLwSwOffsetMask = kImm16Mask; const Instr kLwSwOffsetMask = kImm16Mask;
// Spare buffer. Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size)
static const int kMinimalBufferSize = 4 * KB; : AssemblerBase(isolate, buffer, buffer_size),
Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size)
: AssemblerBase(arg_isolate),
recorded_ast_id_(TypeFeedbackId::None()), recorded_ast_id_(TypeFeedbackId::None()),
positions_recorder_(this) { positions_recorder_(this) {
if (buffer == NULL) { reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_);
// Do our own buffer management.
if (buffer_size <= kMinimalBufferSize) {
buffer_size = kMinimalBufferSize;
if (isolate()->assembler_spare_buffer() != NULL) {
buffer = isolate()->assembler_spare_buffer();
isolate()->set_assembler_spare_buffer(NULL);
}
}
if (buffer == NULL) {
buffer_ = NewArray<byte>(buffer_size);
} else {
buffer_ = static_cast<byte*>(buffer);
}
buffer_size_ = buffer_size;
own_buffer_ = true;
} else {
// Use externally provided buffer instead.
ASSERT(buffer_size > 0);
buffer_ = static_cast<byte*>(buffer);
buffer_size_ = buffer_size;
own_buffer_ = false;
}
// Set up buffer pointers.
ASSERT(buffer_ != NULL);
pc_ = buffer_;
reloc_info_writer.Reposition(buffer_ + buffer_size, pc_);
last_trampoline_pool_end_ = 0; last_trampoline_pool_end_ = 0;
no_trampoline_pool_before_ = 0; no_trampoline_pool_before_ = 0;
...@@ -323,18 +290,6 @@ Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size) ...@@ -323,18 +290,6 @@ Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size)
} }
Assembler::~Assembler() {
if (own_buffer_) {
if (isolate()->assembler_spare_buffer() == NULL &&
buffer_size_ == kMinimalBufferSize) {
isolate()->set_assembler_spare_buffer(buffer_);
} else {
DeleteArray(buffer_);
}
}
}
void Assembler::GetCode(CodeDesc* desc) { void Assembler::GetCode(CodeDesc* desc) {
ASSERT(pc_ <= reloc_info_writer.pos()); // No overlap. ASSERT(pc_ <= reloc_info_writer.pos()); // No overlap.
// Set up code descriptor. // Set up code descriptor.
......
...@@ -523,7 +523,7 @@ class Assembler : public AssemblerBase { ...@@ -523,7 +523,7 @@ class Assembler : public AssemblerBase {
// is too small, a fatal error occurs. No deallocation of the buffer is done // is too small, a fatal error occurs. No deallocation of the buffer is done
// upon destruction of the assembler. // upon destruction of the assembler.
Assembler(Isolate* isolate, void* buffer, int buffer_size); Assembler(Isolate* isolate, void* buffer, int buffer_size);
~Assembler(); virtual ~Assembler() { }
// 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
...@@ -943,8 +943,6 @@ class Assembler : public AssemblerBase { ...@@ -943,8 +943,6 @@ class Assembler : public AssemblerBase {
void db(uint8_t data); void db(uint8_t data);
void dd(uint32_t data); void dd(uint32_t data);
int32_t pc_offset() const { return pc_ - buffer_; }
PositionsRecorder* positions_recorder() { return &positions_recorder_; } PositionsRecorder* positions_recorder() { return &positions_recorder_; }
// Postpone the generation of the trampoline pool for the specified number of // Postpone the generation of the trampoline pool for the specified number of
...@@ -1087,13 +1085,6 @@ class Assembler : public AssemblerBase { ...@@ -1087,13 +1085,6 @@ class Assembler : public AssemblerBase {
} }
private: private:
// Code buffer:
// The buffer into which code and relocation info are generated.
byte* buffer_;
int buffer_size_;
// True if the assembler owns the buffer, false if buffer is external.
bool own_buffer_;
// Buffer size and constant pool distance are checked together at regular // Buffer size and constant pool distance are checked together at regular
// intervals of kBufferCheckInterval emitted bytes. // intervals of kBufferCheckInterval emitted bytes.
static const int kBufferCheckInterval = 1*KB/2; static const int kBufferCheckInterval = 1*KB/2;
...@@ -1104,7 +1095,6 @@ class Assembler : public AssemblerBase { ...@@ -1104,7 +1095,6 @@ class Assembler : public AssemblerBase {
// not have to check for overflow. The same is true for writes of large // not have to check for overflow. The same is true for writes of large
// relocation info entries. // relocation info entries.
static const int kGap = 32; static const int kGap = 32;
byte* pc_; // The program counter - moves forward.
// Repeated checking whether the trampoline pool should be emitted is rather // Repeated checking whether the trampoline pool should be emitted is rather
......
...@@ -346,48 +346,20 @@ bool Operand::AddressUsesRegister(Register reg) const { ...@@ -346,48 +346,20 @@ bool Operand::AddressUsesRegister(Register reg) const {
static void InitCoverageLog(); static void InitCoverageLog();
#endif #endif
Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size) Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size)
: AssemblerBase(arg_isolate), : AssemblerBase(isolate, buffer, buffer_size),
code_targets_(100), code_targets_(100),
positions_recorder_(this) { positions_recorder_(this) {
if (buffer == NULL) {
// Do our own buffer management.
if (buffer_size <= kMinimalBufferSize) {
buffer_size = kMinimalBufferSize;
if (isolate() != NULL && isolate()->assembler_spare_buffer() != NULL) {
buffer = isolate()->assembler_spare_buffer();
isolate()->set_assembler_spare_buffer(NULL);
}
}
if (buffer == NULL) {
buffer_ = NewArray<byte>(buffer_size);
} else {
buffer_ = static_cast<byte*>(buffer);
}
buffer_size_ = buffer_size;
own_buffer_ = true;
} else {
// Use externally provided buffer instead.
ASSERT(buffer_size > 0);
buffer_ = static_cast<byte*>(buffer);
buffer_size_ = buffer_size;
own_buffer_ = false;
}
// Clear the buffer in debug mode unless it was provided by the // Clear the buffer in debug mode unless it was provided by the
// caller in which case we can't be sure it's okay to overwrite // caller in which case we can't be sure it's okay to overwrite
// existing code in it. // existing code in it.
#ifdef DEBUG #ifdef DEBUG
if (own_buffer_) { if (own_buffer_) {
memset(buffer_, 0xCC, buffer_size); // int3 memset(buffer_, 0xCC, buffer_size_); // int3
} }
#endif #endif
// Set up buffer pointers. reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_);
ASSERT(buffer_ != NULL);
pc_ = buffer_;
reloc_info_writer.Reposition(buffer_ + buffer_size, pc_);
#ifdef GENERATED_CODE_COVERAGE #ifdef GENERATED_CODE_COVERAGE
...@@ -396,19 +368,6 @@ Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size) ...@@ -396,19 +368,6 @@ Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size)
} }
Assembler::~Assembler() {
if (own_buffer_) {
if (isolate() != NULL &&
isolate()->assembler_spare_buffer() == NULL &&
buffer_size_ == kMinimalBufferSize) {
isolate()->set_assembler_spare_buffer(buffer_);
} else {
DeleteArray(buffer_);
}
}
}
void Assembler::GetCode(CodeDesc* desc) { void Assembler::GetCode(CodeDesc* desc) {
// Finalize code (at this point overflow() may be true, but the gap ensures // Finalize code (at this point overflow() may be true, but the gap ensures
// that we are still not overlapping instructions and relocation info). // that we are still not overlapping instructions and relocation info).
......
...@@ -556,7 +556,7 @@ class Assembler : public AssemblerBase { ...@@ -556,7 +556,7 @@ class Assembler : public AssemblerBase {
// is too small, a fatal error occurs. No deallocation of the buffer is done // is too small, a fatal error occurs. No deallocation of the buffer is done
// upon destruction of the assembler. // upon destruction of the assembler.
Assembler(Isolate* isolate, void* buffer, int buffer_size); Assembler(Isolate* isolate, void* buffer, int buffer_size);
~Assembler(); virtual ~Assembler() { }
// 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
...@@ -1416,8 +1416,6 @@ class Assembler : public AssemblerBase { ...@@ -1416,8 +1416,6 @@ class Assembler : public AssemblerBase {
void db(uint8_t data); void db(uint8_t data);
void dd(uint32_t data); void dd(uint32_t data);
int pc_offset() const { return static_cast<int>(pc_ - buffer_); }
PositionsRecorder* positions_recorder() { return &positions_recorder_; } PositionsRecorder* positions_recorder() { return &positions_recorder_; }
// Check if there is less than kGap bytes available in the buffer. // Check if there is less than kGap bytes available in the buffer.
...@@ -1436,7 +1434,6 @@ class Assembler : public AssemblerBase { ...@@ -1436,7 +1434,6 @@ class Assembler : public AssemblerBase {
// Avoid overflows for displacements etc. // Avoid overflows for displacements etc.
static const int kMaximalBufferSize = 512*MB; static const int kMaximalBufferSize = 512*MB;
static const int kMinimalBufferSize = 4*KB;
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; }
...@@ -1628,15 +1625,7 @@ class Assembler : public AssemblerBase { ...@@ -1628,15 +1625,7 @@ class Assembler : public AssemblerBase {
friend class EnsureSpace; friend class EnsureSpace;
friend class RegExpMacroAssemblerX64; friend class RegExpMacroAssemblerX64;
// Code buffer:
// The buffer into which code and relocation info are generated.
byte* buffer_;
int buffer_size_;
// True if the assembler owns the buffer, false if buffer is external.
bool own_buffer_;
// code generation // code generation
byte* pc_; // the program counter; moves forward
RelocInfoWriter reloc_info_writer; RelocInfoWriter reloc_info_writer;
List< Handle<Code> > code_targets_; List< Handle<Code> > code_targets_;
......
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