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

Unified Diff: src/snapshot/mksnapshot.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 | « src/runtime/runtime-typedarray.cc ('k') | test/unittests/run-all-unittests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot/mksnapshot.cc
diff --git a/src/snapshot/mksnapshot.cc b/src/snapshot/mksnapshot.cc
index f44eca523a8d3e0660ca332ce1aa3dc73599b626..25ada29112974ff25b0d32f41a56ab3be4520fdf 100644
--- a/src/snapshot/mksnapshot.cc
+++ b/src/snapshot/mksnapshot.cc
@@ -109,6 +109,17 @@ class SnapshotWriter {
};
+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); }
+};
+
+
char* GetExtraCode(char* filename) {
if (filename == NULL || strlen(filename) == 0) return NULL;
::printf("Embedding extra script: %s\n", filename);
@@ -153,6 +164,8 @@ int main(int argc, char** argv) {
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();
{
« no previous file with comments | « src/runtime/runtime-typedarray.cc ('k') | test/unittests/run-all-unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698