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

Unified Diff: src/handles.h

Issue 2476001: Current HandleScope moving to Isolate. (Closed)
Patch Set: removed unnesessary initializing constand, using existing Initialize() for handle scope data. Created 10 years, 7 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/apiutils.h ('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
diff --git a/src/handles.h b/src/handles.h
index 96b17a653cf29f8826d2e96bc1c7056d6d801f83..12d322da9f6607f74793f7523ec53ca2c6ca95ad 100644
--- a/src/handles.h
+++ b/src/handles.h
@@ -107,8 +107,8 @@ class Handle {
// for which the handle scope has been deleted is undefined.
class HandleScope {
public:
- HandleScope() : previous_(current_) {
- current_.extensions = 0;
+ HandleScope() : previous_(*Isolate::Current()->handle_scope_data()) {
+ Isolate::Current()->handle_scope_data()->extensions = 0;
}
~HandleScope() {
@@ -121,12 +121,15 @@ class HandleScope {
// 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();
+ v8::ImplementationUtilities::HandleScopeData* current =
+ Isolate::Current()->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 +150,29 @@ class HandleScope {
void* operator new(size_t size);
void operator delete(void* size_t);
- static v8::ImplementationUtilities::HandleScopeData current_;
const v8::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;
+ v8::ImplementationUtilities::HandleScopeData* current =
+ Isolate::Current()->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) {
+ v8::ImplementationUtilities::HandleScopeData* current =
+ Isolate::Current()->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/apiutils.h ('k') | src/handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698