| 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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 50, | 525 50, |
| 526 "pending_message_script"); | 526 "pending_message_script"); |
| 527 Add(ExternalReference::get_make_code_young_function(isolate).address(), | 527 Add(ExternalReference::get_make_code_young_function(isolate).address(), |
| 528 UNCLASSIFIED, | 528 UNCLASSIFIED, |
| 529 51, | 529 51, |
| 530 "Code::MakeCodeYoung"); | 530 "Code::MakeCodeYoung"); |
| 531 Add(ExternalReference::cpu_features().address(), | 531 Add(ExternalReference::cpu_features().address(), |
| 532 UNCLASSIFIED, | 532 UNCLASSIFIED, |
| 533 52, | 533 52, |
| 534 "cpu_features"); | 534 "cpu_features"); |
| 535 Add(ExternalReference::new_space_allocation_top_address(isolate).address(), | 535 Add(ExternalReference(Runtime::kAllocateInNewSpace, isolate).address(), |
| 536 UNCLASSIFIED, | 536 UNCLASSIFIED, |
| 537 53, | 537 53, |
| 538 "Heap::NewSpaceAllocationTopAddress"); | |
| 539 Add(ExternalReference::new_space_allocation_limit_address(isolate).address(), | |
| 540 UNCLASSIFIED, | |
| 541 54, | |
| 542 "Heap::NewSpaceAllocationLimitAddress"); | |
| 543 Add(ExternalReference(Runtime::kAllocateInNewSpace, isolate).address(), | |
| 544 UNCLASSIFIED, | |
| 545 55, | |
| 546 "Runtime::AllocateInNewSpace"); | 538 "Runtime::AllocateInNewSpace"); |
| 547 Add(ExternalReference::old_pointer_space_allocation_top_address( | 539 Add(ExternalReference::old_pointer_space_allocation_top_address( |
| 548 isolate).address(), | 540 isolate).address(), |
| 549 UNCLASSIFIED, | 541 UNCLASSIFIED, |
| 550 56, | 542 54, |
| 551 "Heap::OldPointerSpaceAllocationTopAddress"); | 543 "Heap::OldPointerSpaceAllocationTopAddress"); |
| 552 Add(ExternalReference::old_pointer_space_allocation_limit_address( | 544 Add(ExternalReference::old_pointer_space_allocation_limit_address( |
| 553 isolate).address(), | 545 isolate).address(), |
| 554 UNCLASSIFIED, | 546 UNCLASSIFIED, |
| 555 57, | 547 55, |
| 556 "Heap::OldPointerSpaceAllocationLimitAddress"); | 548 "Heap::OldPointerSpaceAllocationLimitAddress"); |
| 557 Add(ExternalReference(Runtime::kAllocateInOldPointerSpace, isolate).address(), | 549 Add(ExternalReference(Runtime::kAllocateInOldPointerSpace, isolate).address(), |
| 558 UNCLASSIFIED, | 550 UNCLASSIFIED, |
| 559 58, | 551 56, |
| 560 "Runtime::AllocateInOldPointerSpace"); | 552 "Runtime::AllocateInOldPointerSpace"); |
| 561 Add(ExternalReference::old_data_space_allocation_top_address( | 553 Add(ExternalReference::old_data_space_allocation_top_address( |
| 562 isolate).address(), | 554 isolate).address(), |
| 563 UNCLASSIFIED, | 555 UNCLASSIFIED, |
| 564 59, | 556 57, |
| 565 "Heap::OldDataSpaceAllocationTopAddress"); | 557 "Heap::OldDataSpaceAllocationTopAddress"); |
| 566 Add(ExternalReference::old_data_space_allocation_limit_address( | 558 Add(ExternalReference::old_data_space_allocation_limit_address( |
| 567 isolate).address(), | 559 isolate).address(), |
| 568 UNCLASSIFIED, | 560 UNCLASSIFIED, |
| 569 60, | 561 58, |
| 570 "Heap::OldDataSpaceAllocationLimitAddress"); | 562 "Heap::OldDataSpaceAllocationLimitAddress"); |
| 571 Add(ExternalReference(Runtime::kAllocateInOldDataSpace, isolate).address(), | 563 Add(ExternalReference(Runtime::kAllocateInOldDataSpace, isolate).address(), |
| 572 UNCLASSIFIED, | 564 UNCLASSIFIED, |
| 573 61, | 565 59, |
| 574 "Runtime::AllocateInOldDataSpace"); | 566 "Runtime::AllocateInOldDataSpace"); |
| 575 Add(ExternalReference::new_space_high_promotion_mode_active_address(isolate). | 567 Add(ExternalReference::new_space_high_promotion_mode_active_address(isolate). |
| 576 address(), | 568 address(), |
| 577 UNCLASSIFIED, | 569 UNCLASSIFIED, |
| 578 62, | 570 60, |
| 579 "Heap::NewSpaceAllocationLimitAddress"); | 571 "Heap::NewSpaceAllocationLimitAddress"); |
| 580 Add(ExternalReference::allocation_sites_list_address(isolate).address(), | 572 Add(ExternalReference::allocation_sites_list_address(isolate).address(), |
| 581 UNCLASSIFIED, | 573 UNCLASSIFIED, |
| 574 61, |
| 575 "Heap::allocation_sites_list_address()"); |
| 576 Add(ExternalReference::record_object_allocation_function(isolate).address(), |
| 577 UNCLASSIFIED, |
| 578 62, |
| 579 "HeapProfiler::RecordObjectAllocationFromMasm"); |
| 580 Add(ExternalReference::address_of_uint32_bias().address(), |
| 581 UNCLASSIFIED, |
| 582 63, | 582 63, |
| 583 "Heap::allocation_sites_list_address()"); | 583 "uint32_bias"); |
| 584 Add(ExternalReference::get_mark_code_as_executed_function(isolate).address(), |
| 585 UNCLASSIFIED, |
| 586 64, |
| 587 "Code::MarkCodeAsExecuted"); |
| 584 | 588 |
| 585 // Add a small set of deopt entry addresses to encoder without generating the | 589 // Add a small set of deopt entry addresses to encoder without generating the |
| 586 // deopt table code, which isn't possible at deserialization time. | 590 // deopt table code, which isn't possible at deserialization time. |
| 587 HandleScope scope(isolate); | 591 HandleScope scope(isolate); |
| 588 for (int entry = 0; entry < kDeoptTableSerializeEntryCount; ++entry) { | 592 for (int entry = 0; entry < kDeoptTableSerializeEntryCount; ++entry) { |
| 589 Address address = Deoptimizer::GetDeoptimizationEntry( | 593 Address address = Deoptimizer::GetDeoptimizationEntry( |
| 590 isolate, | 594 isolate, |
| 591 entry, | 595 entry, |
| 592 Deoptimizer::LAZY, | 596 Deoptimizer::LAZY, |
| 593 Deoptimizer::CALCULATE_ENTRY_ADDRESS); | 597 Deoptimizer::CALCULATE_ENTRY_ADDRESS); |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1311 isolate->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG); | 1315 isolate->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG); |
| 1312 } | 1316 } |
| 1313 | 1317 |
| 1314 | 1318 |
| 1315 void PartialSerializer::Serialize(Object** object) { | 1319 void PartialSerializer::Serialize(Object** object) { |
| 1316 this->VisitPointer(object); | 1320 this->VisitPointer(object); |
| 1317 Pad(); | 1321 Pad(); |
| 1318 } | 1322 } |
| 1319 | 1323 |
| 1320 | 1324 |
| 1325 bool Serializer::ShouldBeSkipped(Object** current) { |
| 1326 Object** roots = isolate()->heap()->roots_array_start(); |
| 1327 return current == &roots[Heap::kStoreBufferTopRootIndex] |
| 1328 || current == &roots[Heap::kStackLimitRootIndex] |
| 1329 || current == &roots[Heap::kRealStackLimitRootIndex]; |
| 1330 } |
| 1331 |
| 1332 |
| 1321 void Serializer::VisitPointers(Object** start, Object** end) { | 1333 void Serializer::VisitPointers(Object** start, Object** end) { |
| 1322 Isolate* isolate = this->isolate();; | 1334 Isolate* isolate = this->isolate();; |
| 1323 | 1335 |
| 1324 for (Object** current = start; current < end; current++) { | 1336 for (Object** current = start; current < end; current++) { |
| 1325 if (start == isolate->heap()->roots_array_start()) { | 1337 if (start == isolate->heap()->roots_array_start()) { |
| 1326 root_index_wave_front_ = | 1338 root_index_wave_front_ = |
| 1327 Max(root_index_wave_front_, static_cast<intptr_t>(current - start)); | 1339 Max(root_index_wave_front_, static_cast<intptr_t>(current - start)); |
| 1328 } | 1340 } |
| 1329 if (reinterpret_cast<Address>(current) == | 1341 if (ShouldBeSkipped(current)) { |
| 1330 isolate->heap()->store_buffer()->TopAddress()) { | |
| 1331 sink_->Put(kSkip, "Skip"); | 1342 sink_->Put(kSkip, "Skip"); |
| 1332 sink_->PutInt(kPointerSize, "SkipOneWord"); | 1343 sink_->PutInt(kPointerSize, "SkipOneWord"); |
| 1333 } else if ((*current)->IsSmi()) { | 1344 } else if ((*current)->IsSmi()) { |
| 1334 sink_->Put(kRawData + 1, "Smi"); | 1345 sink_->Put(kRawData + 1, "Smi"); |
| 1335 for (int i = 0; i < kPointerSize; i++) { | 1346 for (int i = 0; i < kPointerSize; i++) { |
| 1336 sink_->Put(reinterpret_cast<byte*>(current)[i], "Byte"); | 1347 sink_->Put(reinterpret_cast<byte*>(current)[i], "Byte"); |
| 1337 } | 1348 } |
| 1338 } else { | 1349 } else { |
| 1339 SerializeObject(*current, kPlain, kStartOfObject, 0); | 1350 SerializeObject(*current, kPlain, kStartOfObject, 0); |
| 1340 } | 1351 } |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1660 Object** current = rinfo->target_object_address(); | 1671 Object** current = rinfo->target_object_address(); |
| 1661 | 1672 |
| 1662 int skip = OutputRawData(rinfo->target_address_address(), | 1673 int skip = OutputRawData(rinfo->target_address_address(), |
| 1663 kCanReturnSkipInsteadOfSkipping); | 1674 kCanReturnSkipInsteadOfSkipping); |
| 1664 HowToCode representation = rinfo->IsCodedSpecially() ? kFromCode : kPlain; | 1675 HowToCode representation = rinfo->IsCodedSpecially() ? kFromCode : kPlain; |
| 1665 serializer_->SerializeObject(*current, representation, kStartOfObject, skip); | 1676 serializer_->SerializeObject(*current, representation, kStartOfObject, skip); |
| 1666 bytes_processed_so_far_ += rinfo->target_address_size(); | 1677 bytes_processed_so_far_ += rinfo->target_address_size(); |
| 1667 } | 1678 } |
| 1668 | 1679 |
| 1669 | 1680 |
| 1670 void Serializer::ObjectSerializer::VisitExternalReferences(Address* start, | 1681 void Serializer::ObjectSerializer::VisitExternalReference(Address* p) { |
| 1671 Address* end) { | 1682 Address references_start = reinterpret_cast<Address>(p); |
| 1672 Address references_start = reinterpret_cast<Address>(start); | |
| 1673 int skip = OutputRawData(references_start, kCanReturnSkipInsteadOfSkipping); | 1683 int skip = OutputRawData(references_start, kCanReturnSkipInsteadOfSkipping); |
| 1674 | 1684 |
| 1675 for (Address* current = start; current < end; current++) { | 1685 sink_->Put(kExternalReference + kPlain + kStartOfObject, "ExternalRef"); |
| 1676 sink_->Put(kExternalReference + kPlain + kStartOfObject, "ExternalRef"); | 1686 sink_->PutInt(skip, "SkipB4ExternalRef"); |
| 1677 sink_->PutInt(skip, "SkipB4ExternalRef"); | 1687 int reference_id = serializer_->EncodeExternalReference(*p); |
| 1678 skip = 0; | 1688 sink_->PutInt(reference_id, "reference id"); |
| 1679 int reference_id = serializer_->EncodeExternalReference(*current); | 1689 bytes_processed_so_far_ += kPointerSize; |
| 1680 sink_->PutInt(reference_id, "reference id"); | |
| 1681 } | |
| 1682 bytes_processed_so_far_ += static_cast<int>((end - start) * kPointerSize); | |
| 1683 } | 1690 } |
| 1684 | 1691 |
| 1685 | 1692 |
| 1686 void Serializer::ObjectSerializer::VisitExternalReference(RelocInfo* rinfo) { | 1693 void Serializer::ObjectSerializer::VisitExternalReference(RelocInfo* rinfo) { |
| 1687 Address references_start = rinfo->target_address_address(); | 1694 Address references_start = rinfo->target_address_address(); |
| 1688 int skip = OutputRawData(references_start, kCanReturnSkipInsteadOfSkipping); | 1695 int skip = OutputRawData(references_start, kCanReturnSkipInsteadOfSkipping); |
| 1689 | 1696 |
| 1690 Address* current = rinfo->target_reference_address(); | 1697 Address* current = rinfo->target_reference_address(); |
| 1691 int representation = rinfo->IsCodedSpecially() ? | 1698 int representation = rinfo->IsCodedSpecially() ? |
| 1692 kFromCode + kStartOfObject : kPlain + kStartOfObject; | 1699 kFromCode + kStartOfObject : kPlain + kStartOfObject; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1857 | 1864 |
| 1858 bool SnapshotByteSource::AtEOF() { | 1865 bool SnapshotByteSource::AtEOF() { |
| 1859 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; | 1866 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; |
| 1860 for (int x = position_; x < length_; x++) { | 1867 for (int x = position_; x < length_; x++) { |
| 1861 if (data_[x] != SerializerDeserializer::nop()) return false; | 1868 if (data_[x] != SerializerDeserializer::nop()) return false; |
| 1862 } | 1869 } |
| 1863 return true; | 1870 return true; |
| 1864 } | 1871 } |
| 1865 | 1872 |
| 1866 } } // namespace v8::internal | 1873 } } // namespace v8::internal |
| OLD | NEW |