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

Unified Diff: src/zone-allocator.h

Issue 267803005: Make zone_allocator actually usable. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/zone-allocator.h
diff --git a/src/zone-allocator.h b/src/zone-allocator.h
index c6e3d780022cc6f131bdf72fa173f4f0b806cec4..8501c35b2729cd0df739b85f731e3646e738ffd5 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 <limits>
+
#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<pointer>(zone_->New(size));
+ pointer allocate(size_type n, const void* hint = 0) {
+ return static_cast<pointer>(zone_->NewArray<value_type>(
+ static_cast<int>(n)));
}
void deallocate(pointer p, size_type) { /* noop for Zones */ }
size_type max_size() const throw() {
- size_type max = static_cast<size_type>(-1) / sizeof(T);
- return (max > 0 ? max : 1);
+ return std::numeric_limits<int>::max() / sizeof(value_type);
}
void construct(pointer p, const T& val) {
new(static_cast<void*>(p)) T(val);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698