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

Unified Diff: src/d8.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/bootstrapper.cc ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index 8c6d6bacac3ab1a03c51e5c25178da4d440b57dd..ff6e1d3aa7d4144c07459cdb2c80f65bbccabcd0 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -166,11 +166,9 @@ Persistent<Context> Shell::utility_context_;
Persistent<Context> Shell::evaluation_context_;
ShellOptions Shell::options;
const char* Shell::kPrompt = "d8> ";
-
-
-#ifndef V8_SHARED
const int MB = 1024 * 1024;
+#ifndef V8_SHARED
bool CounterMap::Match(void* key1, void* key2) {
const char* name1 = reinterpret_cast<const char*>(key1);
const char* name2 = reinterpret_cast<const char*>(key2);
@@ -1599,8 +1597,14 @@ class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
class MockArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
public:
- void* Allocate(size_t) override { return malloc(1); }
- void* AllocateUninitialized(size_t length) override { return malloc(1); }
+ void* Allocate(size_t length) override {
+ size_t actual_length = length > 10 * MB ? 1 : length;
+ void* data = AllocateUninitialized(actual_length);
+ return data == NULL ? data : memset(data, 0, actual_length);
+ }
+ void* AllocateUninitialized(size_t length) override {
+ return length > 10 * MB ? malloc(1) : malloc(length);
+ }
void Free(void* p, size_t) override { free(p); }
};
« no previous file with comments | « src/bootstrapper.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698