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

Unified Diff: src/handles.cc

Issue 3792003: Optimizing HandleScope. Also fixed HandleScope destruction when API getter th... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 2 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.h ('k') | src/handles-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/handles.cc
===================================================================
--- src/handles.cc (revision 5685)
+++ src/handles.cc (working copy)
@@ -44,7 +44,7 @@
v8::ImplementationUtilities::HandleScopeData HandleScope::current_ =
- { -1, NULL, NULL };
+ { NULL, NULL, 0 };
int HandleScope::NumberOfHandles() {
@@ -61,7 +61,7 @@
ASSERT(result == current_.limit);
// Make sure there's at least one scope on the stack and that the
// top of the scope stack isn't a barrier.
- if (current_.extensions < 0) {
+ if (current_.level == 0) {
Utils::ReportApiFailure("v8::HandleScope::CreateHandle()",
"Cannot create a handle without a HandleScope");
return NULL;
@@ -73,6 +73,7 @@
Object** limit = &impl->blocks()->last()[kHandleBlockSize];
if (current_.limit != limit) {
current_.limit = limit;
+ ASSERT(limit - current_.next < kHandleBlockSize);
}
}
@@ -84,7 +85,6 @@
// Add the extension to the global list of blocks, but count the
// extension as part of the current scope.
impl->blocks()->Add(result);
- current_.extensions++;
current_.limit = &result[kHandleBlockSize];
}
@@ -93,21 +93,20 @@
void HandleScope::DeleteExtensions() {
- ASSERT(current_.extensions != 0);
- HandleScopeImplementer::instance()->DeleteExtensions(current_.extensions);
+ HandleScopeImplementer::instance()->DeleteExtensions(current_.limit);
}
void HandleScope::ZapRange(Object** start, Object** end) {
- if (start == NULL) return;
- for (Object** p = start; p < end; p++) {
+ ASSERT(end - start <= kHandleBlockSize);
+ for (Object** p = start; p != end; p++) {
*reinterpret_cast<Address*>(p) = v8::internal::kHandleZapValue;
}
}
-Address HandleScope::current_extensions_address() {
- return reinterpret_cast<Address>(&current_.extensions);
+Address HandleScope::current_level_address() {
+ return reinterpret_cast<Address>(&current_.level);
}
« no previous file with comments | « src/handles.h ('k') | src/handles-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698