OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 // making it into a byte array). | 722 // making it into a byte array). |
723 void Deserializer::ReadObject(int space_number, | 723 void Deserializer::ReadObject(int space_number, |
724 Space* space, | 724 Space* space, |
725 Object** write_back) { | 725 Object** write_back) { |
726 int size = source_->GetInt() << kObjectAlignmentBits; | 726 int size = source_->GetInt() << kObjectAlignmentBits; |
727 Address address = Allocate(space_number, space, size); | 727 Address address = Allocate(space_number, space, size); |
728 *write_back = HeapObject::FromAddress(address); | 728 *write_back = HeapObject::FromAddress(address); |
729 Object** current = reinterpret_cast<Object**>(address); | 729 Object** current = reinterpret_cast<Object**>(address); |
730 Object** limit = current + (size >> kPointerSizeLog2); | 730 Object** limit = current + (size >> kPointerSizeLog2); |
731 if (FLAG_log_snapshot_positions) { | 731 if (FLAG_log_snapshot_positions) { |
732 LOG(SnapshotPositionEvent(address, source_->position())); | 732 LOG(isolate_, SnapshotPositionEvent(address, source_->position())); |
733 } | 733 } |
734 ReadChunk(current, limit, space_number, address); | 734 ReadChunk(current, limit, space_number, address); |
735 } | 735 } |
736 | 736 |
737 | 737 |
738 // This macro is always used with a constant argument so it should all fold | 738 // This macro is always used with a constant argument so it should all fold |
739 // away to almost nothing in the generated code. It might be nicer to do this | 739 // away to almost nothing in the generated code. It might be nicer to do this |
740 // with the ternary operator but there are type issues with that. | 740 // with the ternary operator but there are type issues with that. |
741 #define ASSIGN_DEST_SPACE(space_number) \ | 741 #define ASSIGN_DEST_SPACE(space_number) \ |
742 Space* dest_space; \ | 742 Space* dest_space; \ |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1333 | 1333 |
1334 | 1334 |
1335 void Serializer::ObjectSerializer::Serialize() { | 1335 void Serializer::ObjectSerializer::Serialize() { |
1336 int space = Serializer::SpaceOfObject(object_); | 1336 int space = Serializer::SpaceOfObject(object_); |
1337 int size = object_->Size(); | 1337 int size = object_->Size(); |
1338 | 1338 |
1339 sink_->Put(kNewObject + reference_representation_ + space, | 1339 sink_->Put(kNewObject + reference_representation_ + space, |
1340 "ObjectSerialization"); | 1340 "ObjectSerialization"); |
1341 sink_->PutInt(size >> kObjectAlignmentBits, "Size in words"); | 1341 sink_->PutInt(size >> kObjectAlignmentBits, "Size in words"); |
1342 | 1342 |
1343 LOG(SnapshotPositionEvent(object_->address(), sink_->Position())); | 1343 LOG(i::Isolate::Current(), |
| 1344 SnapshotPositionEvent(object_->address(), sink_->Position())); |
1344 | 1345 |
1345 // Mark this object as already serialized. | 1346 // Mark this object as already serialized. |
1346 bool start_new_page; | 1347 bool start_new_page; |
1347 int offset = serializer_->Allocate(space, size, &start_new_page); | 1348 int offset = serializer_->Allocate(space, size, &start_new_page); |
1348 serializer_->address_mapper()->AddMapping(object_, offset); | 1349 serializer_->address_mapper()->AddMapping(object_, offset); |
1349 if (start_new_page) { | 1350 if (start_new_page) { |
1350 sink_->Put(kNewPage, "NewPage"); | 1351 sink_->Put(kNewPage, "NewPage"); |
1351 sink_->PutSection(space, "NewPageSpace"); | 1352 sink_->PutSection(space, "NewPageSpace"); |
1352 } | 1353 } |
1353 | 1354 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1549 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); | 1550 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); |
1550 } | 1551 } |
1551 } | 1552 } |
1552 int allocation_address = fullness_[space]; | 1553 int allocation_address = fullness_[space]; |
1553 fullness_[space] = allocation_address + size; | 1554 fullness_[space] = allocation_address + size; |
1554 return allocation_address; | 1555 return allocation_address; |
1555 } | 1556 } |
1556 | 1557 |
1557 | 1558 |
1558 } } // namespace v8::internal | 1559 } } // namespace v8::internal |
OLD | NEW |