Index: src/api.cc |
=================================================================== |
--- src/api.cc (revision 5685) |
+++ src/api.cc (working copy) |
@@ -457,19 +457,37 @@ |
// --- H a n d l e s --- |
-HandleScope::HandleScope() : is_closed_(false) { |
+HandleScope::HandleScope() |
+ : prev_next_(i::HandleScope::current_.next), |
+ prev_limit_(i::HandleScope::current_.limit), |
+ is_closed_(false) { |
API_ENTRY_CHECK("HandleScope::HandleScope"); |
- i::HandleScope::Enter(&previous_); |
+ i::HandleScope::current_.level++; |
} |
HandleScope::~HandleScope() { |
if (!is_closed_) { |
- i::HandleScope::Leave(&previous_); |
+ Leave(); |
} |
} |
+void HandleScope::Leave() { |
+ i::HandleScope::current_.level--; |
+ ASSERT(i::HandleScope::current_.level >= 0); |
+ i::HandleScope::current_.next = prev_next_; |
+ if (i::HandleScope::current_.limit != prev_limit_) { |
+ i::HandleScope::current_.limit = prev_limit_; |
+ i::HandleScope::DeleteExtensions(); |
+ } |
+ |
+#ifdef DEBUG |
+ i::HandleScope::ZapRange(prev_next_, prev_limit_); |
+#endif |
+} |
+ |
+ |
int HandleScope::NumberOfHandles() { |
return i::HandleScope::NumberOfHandles(); |
} |
@@ -553,7 +571,7 @@ |
result = *value; |
} |
is_closed_ = true; |
- i::HandleScope::Leave(&previous_); |
+ Leave(); |
if (value == NULL) { |
return NULL; |