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

Unified Diff: test/cctest/interpreter/generate-bytecode-expectations.cc

Issue 2101413002: Provide a convenience array buffer allocator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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
« include/v8.h ('K') | « src/api.cc ('k') | test/fuzzer/fuzzer-support.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/interpreter/generate-bytecode-expectations.cc
diff --git a/test/cctest/interpreter/generate-bytecode-expectations.cc b/test/cctest/interpreter/generate-bytecode-expectations.cc
index 53f2e3fce3e532731d5220e19d8b19e0a8c0647a..9c4bb153223d6d77f4ae5f3eb96a48fbf228c79c 100644
--- a/test/cctest/interpreter/generate-bytecode-expectations.cc
+++ b/test/cctest/interpreter/generate-bytecode-expectations.cc
@@ -93,17 +93,6 @@ class ProgramOptions final {
std::string test_function_name_;
};
-class ArrayBufferAllocator final : public v8::ArrayBuffer::Allocator {
- public:
- void* Allocate(size_t length) override {
- void* data = AllocateUninitialized(length);
- if (data != nullptr) memset(data, 0, length);
- return data;
- }
- void* AllocateUninitialized(size_t length) override { return malloc(length); }
- void Free(void* data, size_t) override { free(data); }
-};
-
class V8InitializationScope final {
public:
explicit V8InitializationScope(const char* exec_path);
@@ -114,6 +103,7 @@ class V8InitializationScope final {
private:
v8::base::SmartPointer<v8::Platform> platform_;
+ v8::base::SmartPointer<v8::ArrayBuffer::Allocator> allocator_;
v8::Isolate* isolate_;
DISALLOW_COPY_AND_ASSIGN(V8InitializationScope);
@@ -363,9 +353,9 @@ V8InitializationScope::V8InitializationScope(const char* exec_path)
v8::V8::InitializePlatform(platform_.get());
v8::V8::Initialize();
- ArrayBufferAllocator allocator;
v8::Isolate::CreateParams create_params;
- create_params.array_buffer_allocator = &allocator;
+ allocator_.Reset(v8::ArrayBuffer::Allocator::NewSimpleAllocator());
+ create_params.array_buffer_allocator = allocator_.get();
isolate_ = v8::Isolate::New(create_params);
}
« include/v8.h ('K') | « src/api.cc ('k') | test/fuzzer/fuzzer-support.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698