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

Unified Diff: src/api.cc

Issue 199021: Changed saved context stack to using direct pointers. Before we would... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 3 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/api.h ('k') | src/list.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
===================================================================
--- src/api.cc (revision 2819)
+++ src/api.cc (working copy)
@@ -427,7 +427,7 @@
i::Handle<i::Context> env = Utils::OpenHandle(this);
thread_local.EnterContext(env);
- thread_local.SaveContext(i::GlobalHandles::Create(i::Top::context()));
+ thread_local.SaveContext(i::Top::context());
i::Top::set_context(*env);
}
@@ -441,9 +441,8 @@
}
// Content of 'last_context' could be NULL.
- i::Handle<i::Object> last_context = thread_local.RestoreContext();
- i::Top::set_context(static_cast<i::Context*>(*last_context));
- i::GlobalHandles::Destroy(last_context.location());
+ i::Context* last_context = thread_local.RestoreContext();
+ i::Top::set_context(last_context);
}
@@ -3700,38 +3699,37 @@
}
-void HandleScopeImplementer::Iterate(
- ObjectVisitor* v,
- List<i::Object**>* blocks,
- v8::ImplementationUtilities::HandleScopeData* handle_data) {
+void HandleScopeImplementer::IterateThis(ObjectVisitor* v) {
// Iterate over all handles in the blocks except for the last.
- for (int i = blocks->length() - 2; i >= 0; --i) {
- Object** block = blocks->at(i);
+ for (int i = Blocks()->length() - 2; i >= 0; --i) {
+ Object** block = Blocks()->at(i);
v->VisitPointers(block, &block[kHandleBlockSize]);
}
// Iterate over live handles in the last block (if any).
- if (!blocks->is_empty()) {
- v->VisitPointers(blocks->last(), handle_data->next);
+ if (!Blocks()->is_empty()) {
+ v->VisitPointers(Blocks()->last(), handle_scope_data_.next);
}
+
+ if (!saved_contexts_.is_empty()) {
+ Object** start = reinterpret_cast<Object**>(&saved_contexts_.first());
+ v->VisitPointers(start, start + saved_contexts_.length());
+ }
}
void HandleScopeImplementer::Iterate(ObjectVisitor* v) {
v8::ImplementationUtilities::HandleScopeData* current =
v8::ImplementationUtilities::CurrentHandleScope();
- Iterate(v, thread_local.Blocks(), current);
+ thread_local.handle_scope_data_ = *current;
+ thread_local.IterateThis(v);
}
char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
HandleScopeImplementer* thread_local =
reinterpret_cast<HandleScopeImplementer*>(storage);
- List<internal::Object**>* blocks_of_archived_thread = thread_local->Blocks();
- v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread =
- &thread_local->handle_scope_data_;
- Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread);
-
+ thread_local->IterateThis(v);
return storage + ArchiveSpacePerThread();
}
« no previous file with comments | « src/api.h ('k') | src/list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698