Revision: 16031
Author: [email protected]
Date: Fri Aug 2 05:19:22 2013
Log: Add size_t length argument to v8::ArrayBuffer::Allocator::Free.
The previous implementation of Free is a deprecated overload now.
[email protected]
Review URL: https://codereview.chromium.org/21803002
http://code.google.com/p/v8/source/detail?r=16031
Modified:
/branches/bleeding_edge/include/v8.h
/branches/bleeding_edge/src/api.cc
/branches/bleeding_edge/src/d8.cc
/branches/bleeding_edge/src/runtime.cc
/branches/bleeding_edge/test/cctest/cctest.cc
=======================================
--- /branches/bleeding_edge/include/v8.h Thu Aug 1 01:52:21 2013
+++ /branches/bleeding_edge/include/v8.h Fri Aug 2 05:19:22 2013
@@ -2425,10 +2425,20 @@
}
/**
- * Free the memory pointed to |data|. That memory is guaranteed to be
- * previously allocated by |Allocate|.
+ * Free the memory block of size |length|, pointed to by |data|.
+ * That memory is guaranteed to be previously allocated by |Allocate|.
*/
- virtual void Free(void* data) = 0;
+ virtual void Free(void* data, size_t length) {
+ // Override with call to |Free(void*)| for compatibility
+ // with legacy version.
+ Free(data);
+ }
+
+ /**
+ * Deprecated. Never called directly by V8.
+ * For compatibility with legacy version of this interface.
+ */
+ virtual void Free(void* data);
};
/**
=======================================
--- /branches/bleeding_edge/src/api.cc Thu Aug 1 12:21:16 2013
+++ /branches/bleeding_edge/src/api.cc Fri Aug 2 05:19:22 2013
@@ -3069,6 +3069,12 @@
"v8::ArrayBuffer::Cast()",
"Could not convert to ArrayBuffer");
}
+
+
+void v8::ArrayBuffer::Allocator::Free(void* data) {
+ API_Fatal("v8::ArrayBuffer::Allocator::Free",
+ "Override Allocator::Free(void*, size_t)");
+}
void v8::ArrayBufferView::CheckCast(Value* that) {
=======================================
--- /branches/bleeding_edge/src/d8.cc Fri Aug 2 02:35:44 2013
+++ /branches/bleeding_edge/src/d8.cc Fri Aug 2 05:19:22 2013
@@ -1635,7 +1635,9 @@
virtual void* AllocateUninitialized(size_t length) {
return malloc(length);
}
- virtual void Free(void* data) { free(data); }
+ virtual void Free(void* data, size_t) { free(data); }
+ // TODO(dslomov): Remove when v8:2823 is fixed.
+ virtual void Free(void* data) { UNREACHABLE(); }
};
=======================================
--- /branches/bleeding_edge/src/runtime.cc Thu Aug 1 12:25:27 2013
+++ /branches/bleeding_edge/src/runtime.cc Fri Aug 2 05:19:22 2013
@@ -689,7 +689,9 @@
isolate->heap()->AdjustAmountOfExternalAllocatedMemory(
-static_cast<intptr_t>(allocated_length));
CHECK(V8::ArrayBufferAllocator() != NULL);
- V8::ArrayBufferAllocator()->Free(phantom_array_buffer->backing_store());
+ V8::ArrayBufferAllocator()->Free(
+ phantom_array_buffer->backing_store(),
+ allocated_length);
}
=======================================
--- /branches/bleeding_edge/test/cctest/cctest.cc Tue Jun 11 03:41:14 2013
+++ /branches/bleeding_edge/test/cctest/cctest.cc Fri Aug 2 05:19:22 2013
@@ -99,9 +99,10 @@
class CcTestArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
- public:
virtual void* Allocate(size_t length) { return malloc(length); }
- virtual void Free(void* data) { free(data); }
+ virtual void Free(void* data, size_t length) { free(data); }
+ // TODO(dslomov): Remove when v8:2823 is fixed.
+ virtual void Free(void* data) { UNREACHABLE(); }
};
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.