Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Unified Diff: tools/parser-shell.cc

Issue 1110603005: Remove support for malloc'd typed arrays (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/unittests/run-all-unittests.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « test/unittests/run-all-unittests.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698