Index: src/handles.h |
=================================================================== |
--- src/handles.h (revision 3427) |
+++ src/handles.h (working copy) |
@@ -107,8 +107,11 @@ |
// for which the handle scope has been deleted is undefined. |
class HandleScope { |
public: |
- HandleScope() : previous_(current_) { |
- current_.extensions = 0; |
+ HandleScope() { |
+ ImplementationUtilities::HandleScopeData& current = |
+ v8_context()->handle_scope_data_; |
+ previous_ = current; |
+ current.extensions = 0; |
} |
~HandleScope() { |
@@ -121,12 +124,14 @@ |
// 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(); |
+ ImplementationUtilities::HandleScopeData& current = |
+ v8_context()->handle_scope_data_; |
+ 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; |
+ ASSERT(cur < current.limit); |
+ current.next = cur + 1; |
T** result = reinterpret_cast<T**>(cur); |
*result = value; |
@@ -147,26 +152,29 @@ |
void* operator new(size_t size); |
void operator delete(void* size_t); |
- static v8::ImplementationUtilities::HandleScopeData current_; |
- const v8::ImplementationUtilities::HandleScopeData previous_; |
+ ImplementationUtilities::HandleScopeData previous_; |
// Pushes a fresh handle scope to be used when allocating new handles. |
static void Enter( |
v8::ImplementationUtilities::HandleScopeData* previous) { |
- *previous = current_; |
- current_.extensions = 0; |
+ ImplementationUtilities::HandleScopeData& current = |
+ v8_context()->handle_scope_data_; |
+ *previous = current; |
+ current.extensions = 0; |
} |
// Re-establishes the previous scope state. Should be called only |
// once, and only for the current scope. |
static void Leave( |
const v8::ImplementationUtilities::HandleScopeData* previous) { |
- if (current_.extensions > 0) { |
+ ImplementationUtilities::HandleScopeData& current = |
+ v8_context()->handle_scope_data_; |
+ if (current.extensions > 0) { |
DeleteExtensions(); |
} |
- current_ = *previous; |
+ current = *previous; |
#ifdef DEBUG |
- ZapRange(current_.next, current_.limit); |
+ ZapRange(current.next, current.limit); |
#endif |
} |