Index: tools/parser-shell.cc |
diff --git a/tools/parser-shell.cc b/tools/parser-shell.cc |
index 3fe735986b2d1f006e282edd6d8952732e633593..e2cae0fbe7dd4a6318991e5661e5f699235e1ed1 100644 |
--- a/tools/parser-shell.cc |
+++ b/tools/parser-shell.cc |
@@ -45,6 +45,16 @@ |
using namespace v8::internal; |
+class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { |
+ public: |
+ virtual void* Allocate(size_t length) { |
+ void* data = AllocateUninitialized(length); |
+ return data == NULL ? data : memset(data, 0, length); |
+ } |
+ virtual void* AllocateUninitialized(size_t length) { return malloc(length); } |
+ virtual void Free(void* data, size_t) { free(data); } |
+}; |
+ |
class StringResource8 : public v8::String::ExternalOneByteStringResource { |
public: |
StringResource8(const char* data, int length) |
@@ -131,6 +141,8 @@ int main(int argc, char* argv[]) { |
v8::V8::InitializeICU(); |
v8::Platform* platform = v8::platform::CreateDefaultPlatform(); |
v8::V8::InitializePlatform(platform); |
+ ArrayBufferAllocator array_buffer_allocator; |
+ v8::V8::SetArrayBufferAllocator(&array_buffer_allocator); |
v8::V8::Initialize(); |
Encoding encoding = LATIN1; |
std::vector<std::string> fnames; |