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

Unified Diff: src/snapshot/serialize.cc

Issue 1312763006: [heap] User safer root set accessor when possible. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-heap-root-set-1
Patch Set: Created 5 years, 4 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/objects-debug.cc ('k') | src/x87/macro-assembler-x87.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot/serialize.cc
diff --git a/src/snapshot/serialize.cc b/src/snapshot/serialize.cc
index 0e672760b6848136e03a1adccae32de0455aec38..d4cb8172b4e6726c7e422c5a41f14cb606e77b89 100644
--- a/src/snapshot/serialize.cc
+++ b/src/snapshot/serialize.cc
@@ -354,10 +354,9 @@ RootIndexMap::RootIndexMap(Isolate* isolate) {
map_ = isolate->root_index_map();
if (map_ != NULL) return;
map_ = new HashMap(HashMap::PointersMatch);
- Object** root_array = isolate->heap()->roots_array_start();
for (uint32_t i = 0; i < Heap::kStrongRootListLength; i++) {
Heap::RootListIndex root_index = static_cast<Heap::RootListIndex>(i);
- Object* root = root_array[root_index];
+ Object* root = isolate->heap()->root(root_index);
// Omit root entries that can be written after initialization. They must
// not be referenced through the root list in the snapshot.
if (root->IsHeapObject() &&
@@ -954,8 +953,9 @@ bool Deserializer::ReadData(Object** current, Object** limit, int source_space,
emit_write_barrier = (space_number == NEW_SPACE); \
new_object = GetBackReferencedObject(data & kSpaceMask); \
} else if (where == kRootArray) { \
- int root_id = source_.GetInt(); \
- new_object = isolate->heap()->roots_array_start()[root_id]; \
+ int id = source_.GetInt(); \
Michael Lippautz 2015/08/25 15:13:25 I would say use const here but since all the other
Michael Starzinger 2015/08/25 15:19:39 Acknowledged. I'll leave the decision up to Yang,
Yang 2015/08/26 10:21:48 I'm fine with either.
+ Heap::RootListIndex root_index = static_cast<Heap::RootListIndex>(id); \
+ new_object = isolate->heap()->root(root_index); \
emit_write_barrier = isolate->heap()->InNewSpace(new_object); \
} else if (where == kPartialSnapshotCache) { \
int cache_index = source_.GetInt(); \
@@ -1229,8 +1229,9 @@ bool Deserializer::ReadData(Object** current, Object** limit, int source_space,
SIXTEEN_CASES(kRootArrayConstants)
SIXTEEN_CASES(kRootArrayConstants + 16) {
- int root_id = data & kRootArrayConstantsMask;
- Object* object = isolate->heap()->roots_array_start()[root_id];
+ int id = data & kRootArrayConstantsMask;
+ Heap::RootListIndex root_index = static_cast<Heap::RootListIndex>(id);
+ Object* object = isolate->heap()->root(root_index);
DCHECK(!isolate->heap()->InNewSpace(object));
UnalignedCopy(current++, &object);
break;
« no previous file with comments | « src/objects-debug.cc ('k') | src/x87/macro-assembler-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698