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