From 972bfb0dd939143107fdb8e1c9330090d76e9446 Mon Sep 17 00:00:00 2001 From: "bmeurer@chromium.org" Date: Fri, 2 May 2014 08:41:06 +0000 Subject: [PATCH] Make zone_allocator actually usable. R=jkummerow@chromium.org Review URL: https://codereview.chromium.org/267803005 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@21113 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/zone-allocator.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/zone-allocator.h b/src/zone-allocator.h index c6e3d7800..8501c35b2 100644 --- a/src/zone-allocator.h +++ b/src/zone-allocator.h @@ -5,6 +5,8 @@ #ifndef V8_ZONE_ALLOCATOR_H_ #define V8_ZONE_ALLOCATOR_H_ +#include + #include "zone.h" namespace v8 { @@ -34,16 +36,14 @@ class zone_allocator { pointer address(reference x) const {return &x;} const_pointer address(const_reference x) const {return &x;} - pointer allocate(size_type count, const void* hint = 0) { - size_t size = count * sizeof(value_type); - size = RoundUp(size, kPointerSize); - return static_cast(zone_->New(size)); + pointer allocate(size_type n, const void* hint = 0) { + return static_cast(zone_->NewArray( + static_cast(n))); } void deallocate(pointer p, size_type) { /* noop for Zones */ } size_type max_size() const throw() { - size_type max = static_cast(-1) / sizeof(T); - return (max > 0 ? max : 1); + return std::numeric_limits::max() / sizeof(value_type); } void construct(pointer p, const T& val) { new(static_cast(p)) T(val); -- 2.34.1