Index: src/handles.h |
=================================================================== |
--- src/handles.h (revision 1538) |
+++ src/handles.h (working copy) |
@@ -118,7 +118,16 @@ |
static int NumberOfHandles(); |
// Creates a new handle with the given value. |
- static void** CreateHandle(void* value); |
+ static inline void** CreateHandle(void* value) { |
+ void** result = current_.next; |
+ if (result == current_.limit) result = Extend(); |
+ // Update the current next field, set the value in the created |
+ // handle, and return the result. |
+ ASSERT(result < current_.limit); |
+ current_.next = result + 1; |
+ *result = value; |
+ return result; |
+ } |
private: |
// Prevent heap allocation or illegal handle scopes. |
@@ -150,6 +159,9 @@ |
#endif |
} |
+ // Extend the handle scope making room for more handles. |
+ static void** Extend(); |
+ |
// Deallocates any extensions used by the current scope. |
static void DeleteExtensions(); |