OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_SERIALIZE_H_ | 5 #ifndef V8_SERIALIZE_H_ |
6 #define V8_SERIALIZE_H_ | 6 #define V8_SERIALIZE_H_ |
7 | 7 |
8 #include "src/hashmap.h" | 8 #include "src/hashmap.h" |
9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
10 #include "src/snapshot-source-sink.h" | 10 #include "src/snapshot-source-sink.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 void ReadChunk( | 267 void ReadChunk( |
268 Object** start, Object** end, int space, Address object_address); | 268 Object** start, Object** end, int space, Address object_address); |
269 void ReadObject(int space_number, Object** write_back); | 269 void ReadObject(int space_number, Object** write_back); |
270 | 270 |
271 // This routine both allocates a new object, and also keeps | 271 // This routine both allocates a new object, and also keeps |
272 // track of where objects have been allocated so that we can | 272 // track of where objects have been allocated so that we can |
273 // fix back references when deserializing. | 273 // fix back references when deserializing. |
274 Address Allocate(int space_index, int size) { | 274 Address Allocate(int space_index, int size) { |
275 Address address = high_water_[space_index]; | 275 Address address = high_water_[space_index]; |
276 high_water_[space_index] = address + size; | 276 high_water_[space_index] = address + size; |
277 HeapProfiler* profiler = isolate_->heap_profiler(); | |
278 if (profiler->is_tracking_allocations()) { | |
279 profiler->AllocationEvent(address, size); | |
280 } | |
281 return address; | 277 return address; |
282 } | 278 } |
283 | 279 |
284 // This returns the address of an object that has been described in the | 280 // This returns the address of an object that has been described in the |
285 // snapshot as being offset bytes back in a particular space. | 281 // snapshot as being offset bytes back in a particular space. |
286 HeapObject* GetAddressFromEnd(int space) { | 282 HeapObject* GetAddressFromEnd(int space) { |
287 int offset = source_->GetInt(); | 283 int offset = source_->GetInt(); |
288 offset <<= kObjectAlignmentBits; | 284 offset <<= kObjectAlignmentBits; |
289 return HeapObject::FromAddress(high_water_[space] - offset); | 285 return HeapObject::FromAddress(high_water_[space] - offset); |
290 } | 286 } |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 private: | 553 private: |
558 virtual bool ShouldBeInThePartialSnapshotCache(HeapObject* o) { | 554 virtual bool ShouldBeInThePartialSnapshotCache(HeapObject* o) { |
559 return false; | 555 return false; |
560 } | 556 } |
561 }; | 557 }; |
562 | 558 |
563 | 559 |
564 } } // namespace v8::internal | 560 } } // namespace v8::internal |
565 | 561 |
566 #endif // V8_SERIALIZE_H_ | 562 #endif // V8_SERIALIZE_H_ |
OLD | NEW |