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

Unified Diff: src/serialize.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/list.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/serialize.cc
===================================================================
--- src/serialize.cc (revision 2819)
+++ src/serialize.cc (working copy)
@@ -1201,19 +1201,24 @@
void Serializer::PutContextStack() {
- List<Handle<Object> > contexts(2);
+ List<Context*> contexts(2);
while (HandleScopeImplementer::instance()->HasSavedContexts()) {
- Handle<Object> context =
+ Context* context =
HandleScopeImplementer::instance()->RestoreContext();
contexts.Add(context);
}
for (int i = contexts.length() - 1; i >= 0; i--) {
HandleScopeImplementer::instance()->SaveContext(contexts[i]);
}
- PutGlobalHandleStack(contexts);
+ writer_->PutC('[');
+ writer_->PutInt(contexts.length());
+ if (!contexts.is_empty()) {
+ Object** start = reinterpret_cast<Object**>(&contexts.first());
+ VisitPointers(start, start + contexts.length());
+ }
+ writer_->PutC(']');
}
-
void Serializer::PutEncodedAddress(Address addr) {
writer_->PutC('P');
writer_->PutAddress(addr);
@@ -1541,9 +1546,15 @@
void Deserializer::GetContextStack() {
- List<Handle<Object> > entered_contexts(2);
- GetGlobalHandleStack(&entered_contexts);
- for (int i = 0; i < entered_contexts.length(); i++) {
+ reader_.ExpectC('[');
+ int count = reader_.GetInt();
+ List<Context*> entered_contexts(count);
+ if (count > 0) {
+ Object** start = reinterpret_cast<Object**>(&entered_contexts.first());
+ VisitPointers(start, start + count);
+ }
+ reader_.ExpectC(']');
+ for (int i = 0; i < count; i++) {
HandleScopeImplementer::instance()->SaveContext(entered_contexts[i]);
}
}
« no previous file with comments | « src/list.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698