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

Unified Diff: src/handles.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/global-handles.cc ('k') | 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 7267)
+++ src/handles.h (working copy)
@@ -44,6 +44,7 @@
public:
INLINE(explicit Handle(T** location)) { location_ = location; }
INLINE(explicit Handle(T* obj));
+ INLINE(Handle(T* obj, Isolate* isolate));
INLINE(Handle()) : location_(NULL) {}
@@ -82,7 +83,7 @@
}
static Handle<T> null() { return Handle<T>(); }
- bool is_null() { return location_ == NULL; }
+ bool is_null() const { return location_ == NULL; }
// Closes the given scope, but lets this handle escape. See
// implementation in api.h.
@@ -107,34 +108,20 @@
// for which the handle scope has been deleted is undefined.
class HandleScope {
public:
- HandleScope() : prev_next_(current_.next), prev_limit_(current_.limit) {
- current_.level++;
- }
+ inline HandleScope();
+ explicit inline HandleScope(Isolate* isolate);
- ~HandleScope() {
- CloseScope();
- }
+ inline ~HandleScope();
// Counts the number of allocated handles.
static int NumberOfHandles();
// Creates a new handle with the given value.
template <typename T>
- static inline T** CreateHandle(T* value) {
- internal::Object** cur = current_.next;
- if (cur == current_.limit) cur = Extend();
- // Update the current next field, set the value in the created
- // handle, and return the result.
- ASSERT(cur < current_.limit);
- current_.next = cur + 1;
+ static inline T** CreateHandle(T* value, Isolate* isolate);
- T** result = reinterpret_cast<T**>(cur);
- *result = value;
- return result;
- }
-
// Deallocates any extensions used by the current scope.
- static void DeleteExtensions();
+ static void DeleteExtensions(Isolate* isolate);
static Address current_next_address();
static Address current_limit_address();
@@ -145,21 +132,10 @@
// a Handle backed by the parent scope holding the
// value of the argument handle.
template <typename T>
- Handle<T> CloseAndEscape(Handle<T> handle_value) {
- T* value = *handle_value;
- // Throw away all handles in the current scope.
- CloseScope();
- // Allocate one handle in the parent scope.
- ASSERT(current_.level > 0);
- Handle<T> result(CreateHandle<T>(value));
- // Reinitialize the current scope (so that it's ready
- // to be used or closed again).
- prev_next_ = current_.next;
- prev_limit_ = current_.limit;
- current_.level++;
- return result;
- }
+ Handle<T> CloseAndEscape(Handle<T> handle_value);
+ Isolate* isolate() { return isolate_; }
+
private:
// Prevent heap allocation or illegal handle scopes.
HandleScope(const HandleScope&);
@@ -167,21 +143,9 @@
void* operator new(size_t size);
void operator delete(void* size_t);
- inline void CloseScope() {
- current_.next = prev_next_;
- current_.level--;
- if (current_.limit != prev_limit_) {
- current_.limit = prev_limit_;
- DeleteExtensions();
- }
-#ifdef DEBUG
- ZapRange(prev_next_, prev_limit_);
-#endif
- }
+ inline void CloseScope();
- static v8::ImplementationUtilities::HandleScopeData current_;
- // Holds values on entry. The prev_next_ value is never NULL
- // on_entry, but is set to NULL when this scope is closed.
+ Isolate* isolate_;
Object** prev_next_;
Object** prev_limit_;
« no previous file with comments | « src/global-handles.cc ('k') | src/handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698