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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/list.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 writer_->PutC('|'); 1194 writer_->PutC('|');
1195 int gh_index = IndexOf(global_handles_, stack[i].location()); 1195 int gh_index = IndexOf(global_handles_, stack[i].location());
1196 CHECK_GE(gh_index, 0); 1196 CHECK_GE(gh_index, 0);
1197 writer_->PutInt(gh_index); 1197 writer_->PutInt(gh_index);
1198 } 1198 }
1199 writer_->PutC(']'); 1199 writer_->PutC(']');
1200 } 1200 }
1201 1201
1202 1202
1203 void Serializer::PutContextStack() { 1203 void Serializer::PutContextStack() {
1204 List<Handle<Object> > contexts(2); 1204 List<Context*> contexts(2);
1205 while (HandleScopeImplementer::instance()->HasSavedContexts()) { 1205 while (HandleScopeImplementer::instance()->HasSavedContexts()) {
1206 Handle<Object> context = 1206 Context* context =
1207 HandleScopeImplementer::instance()->RestoreContext(); 1207 HandleScopeImplementer::instance()->RestoreContext();
1208 contexts.Add(context); 1208 contexts.Add(context);
1209 } 1209 }
1210 for (int i = contexts.length() - 1; i >= 0; i--) { 1210 for (int i = contexts.length() - 1; i >= 0; i--) {
1211 HandleScopeImplementer::instance()->SaveContext(contexts[i]); 1211 HandleScopeImplementer::instance()->SaveContext(contexts[i]);
1212 } 1212 }
1213 PutGlobalHandleStack(contexts); 1213 writer_->PutC('[');
1214 writer_->PutInt(contexts.length());
1215 if (!contexts.is_empty()) {
1216 Object** start = reinterpret_cast<Object**>(&contexts.first());
1217 VisitPointers(start, start + contexts.length());
1218 }
1219 writer_->PutC(']');
1214 } 1220 }
1215 1221
1216
1217 void Serializer::PutEncodedAddress(Address addr) { 1222 void Serializer::PutEncodedAddress(Address addr) {
1218 writer_->PutC('P'); 1223 writer_->PutC('P');
1219 writer_->PutAddress(addr); 1224 writer_->PutAddress(addr);
1220 } 1225 }
1221 1226
1222 1227
1223 Address Serializer::Encode(Object* o, bool* serialized) { 1228 Address Serializer::Encode(Object* o, bool* serialized) {
1224 *serialized = false; 1229 *serialized = false;
1225 if (o->IsSmi()) { 1230 if (o->IsSmi()) {
1226 return reinterpret_cast<Address>(o); 1231 return reinterpret_cast<Address>(o);
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1534 for (int i = 0; i < length; i++) { 1539 for (int i = 0; i < length; i++) {
1535 reader_.ExpectC('|'); 1540 reader_.ExpectC('|');
1536 int gh_index = reader_.GetInt(); 1541 int gh_index = reader_.GetInt();
1537 stack->Add(global_handles_[gh_index]); 1542 stack->Add(global_handles_[gh_index]);
1538 } 1543 }
1539 reader_.ExpectC(']'); 1544 reader_.ExpectC(']');
1540 } 1545 }
1541 1546
1542 1547
1543 void Deserializer::GetContextStack() { 1548 void Deserializer::GetContextStack() {
1544 List<Handle<Object> > entered_contexts(2); 1549 reader_.ExpectC('[');
1545 GetGlobalHandleStack(&entered_contexts); 1550 int count = reader_.GetInt();
1546 for (int i = 0; i < entered_contexts.length(); i++) { 1551 List<Context*> entered_contexts(count);
1552 if (count > 0) {
1553 Object** start = reinterpret_cast<Object**>(&entered_contexts.first());
1554 VisitPointers(start, start + count);
1555 }
1556 reader_.ExpectC(']');
1557 for (int i = 0; i < count; i++) {
1547 HandleScopeImplementer::instance()->SaveContext(entered_contexts[i]); 1558 HandleScopeImplementer::instance()->SaveContext(entered_contexts[i]);
1548 } 1559 }
1549 } 1560 }
1550 1561
1551 1562
1552 Address Deserializer::GetEncodedAddress() { 1563 Address Deserializer::GetEncodedAddress() {
1553 reader_.ExpectC('P'); 1564 reader_.ExpectC('P');
1554 return reader_.GetAddress(); 1565 return reader_.GetAddress();
1555 } 1566 }
1556 1567
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 ASSERT(index < large_objects_.length()); 1692 ASSERT(index < large_objects_.length());
1682 } 1693 }
1683 return large_objects_[index]; // s.page_offset() is ignored. 1694 return large_objects_[index]; // s.page_offset() is ignored.
1684 } 1695 }
1685 UNREACHABLE(); 1696 UNREACHABLE();
1686 return NULL; 1697 return NULL;
1687 } 1698 }
1688 1699
1689 1700
1690 } } // namespace v8::internal 1701 } } // namespace v8::internal
OLDNEW
« 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