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

Unified Diff: src/allocation.h

Issue 6685088: Merge isolates to bleeding_edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 9 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 | « src/accessors.cc ('k') | src/allocation.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/allocation.h
===================================================================
--- src/allocation.h (revision 7267)
+++ src/allocation.h (working copy)
@@ -43,31 +43,18 @@
// the C++ heap only!
class NativeAllocationChecker {
public:
- typedef enum { ALLOW, DISALLOW } NativeAllocationAllowed;
- explicit inline NativeAllocationChecker(NativeAllocationAllowed allowed)
- : allowed_(allowed) {
+ enum NativeAllocationAllowed { ALLOW, DISALLOW };
#ifdef DEBUG
- if (allowed == DISALLOW) {
- allocation_disallowed_++;
- }
-#endif
- }
- ~NativeAllocationChecker() {
-#ifdef DEBUG
- if (allowed_ == DISALLOW) {
- allocation_disallowed_--;
- }
-#endif
- ASSERT(allocation_disallowed_ >= 0);
- }
- static inline bool allocation_allowed() {
- return allocation_disallowed_ == 0;
- }
+ explicit NativeAllocationChecker(NativeAllocationAllowed allowed);
+ ~NativeAllocationChecker();
+ static bool allocation_allowed();
private:
- // This static counter ensures that NativeAllocationCheckers can be nested.
- static int allocation_disallowed_;
// This flag applies to this particular instance.
NativeAllocationAllowed allowed_;
+#else
+ explicit inline NativeAllocationChecker(NativeAllocationAllowed allowed) {}
+ static inline bool allocation_allowed() { return true; }
+#endif
};
@@ -146,27 +133,27 @@
// Allocation policy for allocating in preallocated space.
// Used as an allocation policy for ScopeInfo when generating
// stack traces.
-class PreallocatedStorage : public AllStatic {
+class PreallocatedStorage {
public:
explicit PreallocatedStorage(size_t size);
size_t size() { return size_; }
- static void* New(size_t size);
- static void Delete(void* p);
- // Preallocate a set number of bytes.
- static void Init(size_t 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_;
PreallocatedStorage* next_;
- static bool preallocated_;
- static PreallocatedStorage in_use_list_;
- static PreallocatedStorage free_list_;
-
void LinkTo(PreallocatedStorage* other);
void Unlink();
+
+ friend class Isolate;
+
DISALLOW_IMPLICIT_CONSTRUCTORS(PreallocatedStorage);
};
« no previous file with comments | « src/accessors.cc ('k') | src/allocation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698