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

Unified Diff: src/allocation.h

Issue 7374002: Refactor allocation policies. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 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 | src/allocation-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/allocation.h
diff --git a/src/allocation.h b/src/allocation.h
index 75aba35d8cfcf0a4111cda2a8321693eb6372c7b..ddb0d57b1ba311570836be1e00ea6de40a262bc9 100644
--- a/src/allocation.h
+++ b/src/allocation.h
@@ -103,10 +103,10 @@ char* StrNDup(const char* str, int n);
// Allocation policy for allocating in the C free store using malloc
// and free. Used as the default policy for lists.
-class FreeStoreAllocationPolicy {
+class FreeStoreAllocator {
public:
- INLINE(static void* New(size_t size)) { return Malloced::New(size); }
- INLINE(static void Delete(void* p)) { Malloced::Delete(p); }
+ INLINE(void* New(size_t size)) { return Malloced::New(size); }
+ INLINE(void Delete(void* p)) { Malloced::Delete(p); }
};
@@ -118,12 +118,6 @@ class PreallocatedStorage {
explicit PreallocatedStorage(size_t size);
size_t size() { return size_; }
- // TODO(isolates): Get rid of these-- we'll have to change the allocator
- // interface to include a pointer to an isolate to do this
- // efficiently.
- static inline void* New(size_t size);
- static inline void Delete(void* p);
-
private:
size_t size_;
PreallocatedStorage* previous_;
@@ -133,11 +127,23 @@ class PreallocatedStorage {
void Unlink();
friend class Isolate;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(PreallocatedStorage);
};
+class Isolate;
+
+
+class PreallocatedStorageAllocator {
+ public:
+ inline PreallocatedStorageAllocator();
+
+ inline void* New(size_t size);
+ inline void Delete(void* p);
+
+ private:
+ Isolate* isolate_;
+};
+
} } // namespace v8::internal
#endif // V8_ALLOCATION_H_
« no previous file with comments | « no previous file | src/allocation-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698