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

Unified Diff: src/handles.h

Issue 435003: Patch for allowing several V8 instances in process:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years 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 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
}
« 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