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

Unified Diff: test/cctest/cctest.cc

Issue 768543002: [WIP] TrapHandler 2014/11/27. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month 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/v8.cc ('k') | test/cctest/compiler/simplified-graph-builder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/cctest.cc
diff --git a/test/cctest/cctest.cc b/test/cctest/cctest.cc
index 170aa5a8a5fdc59a9e03d15f5fd264697c4774ba..d0bad6c349d5518a8551dd22529213adc091eff7 100644
--- a/test/cctest/cctest.cc
+++ b/test/cctest/cctest.cc
@@ -35,6 +35,7 @@
#include "test/cctest/trace-extension.h"
#if V8_OS_WIN
+#include <malloc.h>
#include <windows.h> // NOLINT
#if V8_CC_MSVC
#include <crtdbg.h>
@@ -129,11 +130,33 @@ static void PrintTestList(CcTest* current) {
class CcTestArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
- virtual void* Allocate(size_t length) { return malloc(length); }
- virtual void* AllocateUninitialized(size_t length) { return malloc(length); }
- virtual void Free(void* data, size_t length) { free(data); }
- // TODO(dslomov): Remove when v8:2823 is fixed.
- virtual void Free(void* data) { UNREACHABLE(); }
+ 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 Allocate(length, 8);
+ }
+ virtual void* Allocate(size_t length, size_t alignment) {
+#if V8_OS_ANDROID
+ return memalign(alignment, length);
+#elif V8_OS_WIN
+ return _aligned_malloc(length, alignment);
+#else
+ void* ptr = NULL;
+ posix_memalign(&ptr, alignment, length);
+ return ptr;
+#endif
+ }
+ virtual void Free(void* data, size_t) { Free(data); }
+ virtual void Free(void* data) {
+#if V8_OS_WIN
+ _aligned_free(data);
+#else
+ free(data);
+#endif
+ }
};
« no previous file with comments | « src/v8.cc ('k') | test/cctest/compiler/simplified-graph-builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698