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

Side by Side Diff: src/snapshot/deserializer.cc

Issue 2738213002: [serializer] check that deserializer read the entire blob. (Closed)
Patch Set: add comment Created 3 years, 9 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
« no previous file with comments | « no previous file | 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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/snapshot/deserializer.h" 5 #include "src/snapshot/deserializer.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/assembler-inl.h" 8 #include "src/assembler-inl.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/external-reference-table.h" 10 #include "src/external-reference-table.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 FlushICacheForNewCodeObjectsAndRecordEmbeddedObjects(); 165 FlushICacheForNewCodeObjectsAndRecordEmbeddedObjects();
166 result = Handle<HeapObject>(HeapObject::cast(root)); 166 result = Handle<HeapObject>(HeapObject::cast(root));
167 isolate->heap()->RegisterReservationsForBlackAllocation(reservations_); 167 isolate->heap()->RegisterReservationsForBlackAllocation(reservations_);
168 } 168 }
169 CommitPostProcessedObjects(isolate); 169 CommitPostProcessedObjects(isolate);
170 return scope.CloseAndEscape(result); 170 return scope.CloseAndEscape(result);
171 } 171 }
172 } 172 }
173 173
174 Deserializer::~Deserializer() { 174 Deserializer::~Deserializer() {
175 // TODO(svenpanne) Re-enable this assertion when v8 initialization is fixed.
176 // DCHECK(source_.AtEOF());
177 #ifdef DEBUG 175 #ifdef DEBUG
176 // Do not perform checks if we aborted deserialization.
177 if (source_.position() == 0) return;
178 // Check that we only have padding bytes remaining.
179 while (source_.HasMore()) CHECK_EQ(kNop, source_.Get());
178 for (int space = 0; space < kNumberOfPreallocatedSpaces; space++) { 180 for (int space = 0; space < kNumberOfPreallocatedSpaces; space++) {
179 int chunk_index = current_chunk_[space]; 181 int chunk_index = current_chunk_[space];
180 CHECK_EQ(reservations_[space].length(), chunk_index + 1); 182 CHECK_EQ(reservations_[space].length(), chunk_index + 1);
181 CHECK_EQ(reservations_[space][chunk_index].end, high_water_[space]); 183 CHECK_EQ(reservations_[space][chunk_index].end, high_water_[space]);
182 } 184 }
183 CHECK_EQ(allocated_maps_.length(), next_map_index_); 185 CHECK_EQ(allocated_maps_.length(), next_map_index_);
184 #endif // DEBUG 186 #endif // DEBUG
185 } 187 }
186 188
187 // This is called on the roots. It is the driver of the deserialization 189 // This is called on the roots. It is the driver of the deserialization
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 867
866 default: 868 default:
867 CHECK(false); 869 CHECK(false);
868 } 870 }
869 } 871 }
870 CHECK_EQ(limit, current); 872 CHECK_EQ(limit, current);
871 return true; 873 return true;
872 } 874 }
873 } // namespace internal 875 } // namespace internal
874 } // namespace v8 876 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698