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

Unified Diff: src/serialize.cc

Issue 14147: Refactoring using TempAssign. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years 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 | « no previous file | src/utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/serialize.cc
===================================================================
--- src/serialize.cc (revision 977)
+++ src/serialize.cc (working copy)
@@ -933,19 +933,17 @@
// Serialize objects by writing them into the stream.
void Serializer::VisitPointers(Object** start, Object** end) {
- bool root = root_;
- root_ = false;
+ TempAssign<bool> temp_root(&root_, false);
for (Object** p = start; p < end; ++p) {
bool serialized;
Address a = Encode(*p, &serialized);
- if (root) {
+ if (temp_root.old_value()) {
roots_++;
// If the object was not just serialized,
// write its encoded address instead.
if (!serialized) PutEncodedAddress(a);
}
}
- root_ = root;
}
@@ -1236,10 +1234,9 @@
void Deserializer::VisitPointers(Object** start, Object** end) {
- bool root = root_;
- root_ = false;
+ TempAssign<bool> temp_root(&root_, false);
for (Object** p = start; p < end; ++p) {
- if (root) {
+ if (temp_root.old_value()) {
roots_++;
// Read the next object or pointer from the stream
// pointer in the stream.
@@ -1256,7 +1253,6 @@
*p = Resolve(reinterpret_cast<Address>(*p));
}
}
- root_ = root;
}
« no previous file with comments | « no previous file | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698