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

Unified Diff: src/handles.h

Issue 49001: Inline the fast path for handle creation.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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 | « no previous file | src/handles.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « no previous file | src/handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698