Commit a6384ade authored by verwaest@chromium.org's avatar verwaest@chromium.org

Get rid of the "spare buffer" cache.

BUG=
R=ishell@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22943 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 25b978cb
......@@ -3202,8 +3202,8 @@ void Assembler::GrowBuffer() {
// Compute new buffer size.
CodeDesc desc; // the new buffer
if (buffer_size_ < 4*KB) {
desc.buffer_size = 4*KB;
if (buffer_size_ == 0) {
desc.buffer_size = kMinimalBufferSize;
} else if (buffer_size_ < 1*MB) {
desc.buffer_size = 2*buffer_size_;
} else {
......
......@@ -2771,8 +2771,8 @@ void Assembler::GrowBuffer() {
// Compute new buffer size.
CodeDesc desc; // the new buffer
if (buffer_size_ < 4 * KB) {
desc.buffer_size = 4 * KB;
if (buffer_size_ == 0) {
desc.buffer_size = kMinimalBufferSize;
} else if (buffer_size_ < 1 * MB) {
desc.buffer_size = 2 * buffer_size_;
} else {
......
......@@ -136,14 +136,7 @@ AssemblerBase::AssemblerBase(Isolate* isolate, void* buffer, int buffer_size)
}
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);
buffer = NewArray<byte>(buffer_size);
own_buffer_ = true;
} else {
// Use externally provided buffer instead.
......@@ -158,15 +151,7 @@ AssemblerBase::AssemblerBase(Isolate* isolate, void* buffer, int buffer_size)
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_);
}
}
if (own_buffer_) DeleteArray(buffer_);
}
......
......@@ -2497,8 +2497,8 @@ void Assembler::GrowBuffer() {
// Compute new buffer size.
CodeDesc desc; // the new buffer
if (buffer_size_ < 4*KB) {
desc.buffer_size = 4*KB;
if (buffer_size_ == 0) {
desc.buffer_size = kMinimalBufferSize;
} else {
desc.buffer_size = 2*buffer_size_;
}
......@@ -2528,12 +2528,7 @@ void Assembler::GrowBuffer() {
desc.reloc_size);
// Switch buffers.
if (isolate()->assembler_spare_buffer() == NULL &&
buffer_size_ == kMinimalBufferSize) {
isolate()->set_assembler_spare_buffer(buffer_);
} else {
DeleteArray(buffer_);
}
DeleteArray(buffer_);
buffer_ = desc.buffer;
buffer_size_ = desc.buffer_size;
pc_ += pc_delta;
......
......@@ -1645,9 +1645,6 @@ Isolate::~Isolate() {
delete entry_stack_;
entry_stack_ = NULL;
delete[] assembler_spare_buffer_;
assembler_spare_buffer_ = NULL;
delete unicode_cache_;
unicode_cache_ = NULL;
......
......@@ -340,8 +340,6 @@ typedef List<HeapObject*> DebugObjectCache;
V(int, serialize_partial_snapshot_cache_capacity, 0) \
V(Object**, serialize_partial_snapshot_cache, NULL) \
/* Assembler state. */ \
/* A previously allocated buffer of kMinimalBufferSize bytes, or NULL. */ \
V(byte*, assembler_spare_buffer, NULL) \
V(FatalErrorCallback, exception_behavior, NULL) \
V(LogEventCallback, event_logger, NULL) \
V(AllowCodeGenerationFromStringsCallback, allow_code_gen_callback, NULL) \
......
......@@ -331,8 +331,8 @@ void Assembler::GrowBuffer() {
// Compute new buffer size.
CodeDesc desc; // the new buffer
if (buffer_size_ < 4*KB) {
desc.buffer_size = 4*KB;
if (buffer_size_ == 0) {
desc.buffer_size = kMinimalBufferSize;
} else {
desc.buffer_size = 2*buffer_size_;
}
......@@ -364,13 +364,7 @@ void Assembler::GrowBuffer() {
desc.reloc_size);
// Switch buffers.
if (isolate() != NULL &&
isolate()->assembler_spare_buffer() == NULL &&
buffer_size_ == kMinimalBufferSize) {
isolate()->set_assembler_spare_buffer(buffer_);
} else {
DeleteArray(buffer_);
}
DeleteArray(buffer_);
buffer_ = desc.buffer;
buffer_size_ = desc.buffer_size;
pc_ += pc_delta;
......
......@@ -1910,13 +1910,7 @@ void Assembler::GrowBuffer() {
MemMove(rc_delta + reloc_info_writer.pos(), reloc_info_writer.pos(),
desc.reloc_size);
// Switch buffers.
if (isolate()->assembler_spare_buffer() == NULL &&
buffer_size_ == kMinimalBufferSize) {
isolate()->set_assembler_spare_buffer(buffer_);
} else {
DeleteArray(buffer_);
}
DeleteArray(buffer_);
buffer_ = desc.buffer;
buffer_size_ = desc.buffer_size;
pc_ += pc_delta;
......
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