OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 void ReadChunk( | 359 void ReadChunk( |
360 Object** start, Object** end, int space, Address object_address); | 360 Object** start, Object** end, int space, Address object_address); |
361 void ReadObject(int space_number, Object** write_back); | 361 void ReadObject(int space_number, Object** write_back); |
362 | 362 |
363 // This routine both allocates a new object, and also keeps | 363 // This routine both allocates a new object, and also keeps |
364 // track of where objects have been allocated so that we can | 364 // track of where objects have been allocated so that we can |
365 // fix back references when deserializing. | 365 // fix back references when deserializing. |
366 Address Allocate(int space_index, int size) { | 366 Address Allocate(int space_index, int size) { |
367 Address address = high_water_[space_index]; | 367 Address address = high_water_[space_index]; |
368 high_water_[space_index] = address + size; | 368 high_water_[space_index] = address + size; |
| 369 HeapProfiler* profiler = isolate_->heap_profiler(); |
| 370 if (profiler->is_tracking_allocations()) { |
| 371 profiler->NewObjectEvent(address, size); |
| 372 } |
369 return address; | 373 return address; |
370 } | 374 } |
371 | 375 |
372 // This returns the address of an object that has been described in the | 376 // This returns the address of an object that has been described in the |
373 // snapshot as being offset bytes back in a particular space. | 377 // snapshot as being offset bytes back in a particular space. |
374 HeapObject* GetAddressFromEnd(int space) { | 378 HeapObject* GetAddressFromEnd(int space) { |
375 int offset = source_->GetInt(); | 379 int offset = source_->GetInt(); |
376 offset <<= kObjectAlignmentBits; | 380 offset <<= kObjectAlignmentBits; |
377 return HeapObject::FromAddress(high_water_[space] - offset); | 381 return HeapObject::FromAddress(high_water_[space] - offset); |
378 } | 382 } |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 private: | 659 private: |
656 virtual bool ShouldBeInThePartialSnapshotCache(HeapObject* o) { | 660 virtual bool ShouldBeInThePartialSnapshotCache(HeapObject* o) { |
657 return false; | 661 return false; |
658 } | 662 } |
659 }; | 663 }; |
660 | 664 |
661 | 665 |
662 } } // namespace v8::internal | 666 } } // namespace v8::internal |
663 | 667 |
664 #endif // V8_SERIALIZE_H_ | 668 #endif // V8_SERIALIZE_H_ |
OLD | NEW |