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

Unified Diff: src/handles-inl.h

Issue 2866008: [Isolates] Move contents of Top into Isolate.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: ensure we're synced Created 10 years, 6 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/handles.cc ('k') | src/heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/handles-inl.h
===================================================================
--- src/handles-inl.h (revision 4906)
+++ src/handles-inl.h (working copy)
@@ -29,9 +29,10 @@
#ifndef V8_HANDLES_INL_H_
#define V8_HANDLES_INL_H_
+#include "api.h"
#include "apiutils.h"
#include "handles.h"
-#include "api.h"
+#include "isolate.h"
namespace v8 {
namespace internal {
@@ -51,7 +52,55 @@
}
+HandleScope::HandleScope()
+ : previous_(*Isolate::Current()->handle_scope_data()) {
+ Isolate::Current()->handle_scope_data()->extensions = 0;
+}
+
+
+template <typename T>
+T** HandleScope::CreateHandle(T* value) {
+ 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;
+
+ T** result = reinterpret_cast<T**>(cur);
+ *result = value;
+ return result;
+}
+
+
+void HandleScope::Enter(
+ v8::ImplementationUtilities::HandleScopeData* previous) {
+ v8::ImplementationUtilities::HandleScopeData* current =
+ Isolate::Current()->handle_scope_data();
+ *previous = *current;
+ current->extensions = 0;
+}
+
+
+void HandleScope::Leave(
+ const v8::ImplementationUtilities::HandleScopeData* previous) {
+ Isolate* isolate = Isolate::Current();
+ v8::ImplementationUtilities::HandleScopeData* current =
+ isolate->handle_scope_data();
+ if (current->extensions > 0) {
+ DeleteExtensions(isolate);
+ }
+ *current = *previous;
#ifdef DEBUG
+ ZapRange(current->next, current->limit);
+#endif
+}
+
+
+#ifdef DEBUG
inline NoHandleAllocation::NoHandleAllocation() {
v8::ImplementationUtilities::HandleScopeData* current =
Isolate::Current()->handle_scope_data();
« no previous file with comments | « src/handles.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698