Remove CcTestArrayBufferAllocator

This is almost identical to V8's default array buffer allocator.  The only
difference is that 0 byte allocations are changed into 1 byte allocations.  We
do not seem to need this behavior, so it does not seem worth maintaining yet
another allocator.

Bug: 
Change-Id: I94f45f1276958791be9a6f2405fcfba8fa6eaa38
Reviewed-on: https://chromium-review.googlesource.com/505199
Reviewed-by: Ben Smith <binji@chromium.org>
Commit-Queue: Eric Holk <eholk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45282}
This commit is contained in:
Eric Holk 2017-05-12 13:30:31 -07:00 committed by Commit Bot
parent 68f0a47b28
commit b9e4bbb0a0

View File

@ -214,20 +214,6 @@ static void PrintTestList(CcTest* current) {
} }
class CcTestArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
virtual void* Allocate(size_t length) {
void* data = AllocateUninitialized(length == 0 ? 1 : length);
return data == NULL ? data : memset(data, 0, length);
}
virtual void* AllocateUninitialized(size_t length) {
return malloc(length == 0 ? 1 : length);
}
virtual void Free(void* data, size_t length) { free(data); }
// TODO(dslomov): Remove when v8:2823 is fixed.
virtual void Free(void* data) { UNREACHABLE(); }
};
static void SuggestTestHarness(int tests) { static void SuggestTestHarness(int tests) {
if (tests == 0) return; if (tests == 0) return;
printf("Running multiple tests in sequence is deprecated and may cause " printf("Running multiple tests in sequence is deprecated and may cause "
@ -277,8 +263,8 @@ int main(int argc, char* argv[]) {
v8::V8::RegisterDefaultSignalHandler(); v8::V8::RegisterDefaultSignalHandler();
} }
CcTestArrayBufferAllocator array_buffer_allocator; CcTest::set_array_buffer_allocator(
CcTest::set_array_buffer_allocator(&array_buffer_allocator); v8::ArrayBuffer::Allocator::NewDefaultAllocator());
i::PrintExtension print_extension; i::PrintExtension print_extension;
v8::RegisterExtension(&print_extension); v8::RegisterExtension(&print_extension);