| 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 "HandleScope::DeleteExtensions"); | 303 "HandleScope::DeleteExtensions"); |
| 304 Add(ExternalReference:: | 304 Add(ExternalReference:: |
| 305 incremental_marking_record_write_function(isolate).address(), | 305 incremental_marking_record_write_function(isolate).address(), |
| 306 RUNTIME_ENTRY, | 306 RUNTIME_ENTRY, |
| 307 5, | 307 5, |
| 308 "IncrementalMarking::RecordWrite"); | 308 "IncrementalMarking::RecordWrite"); |
| 309 Add(ExternalReference::store_buffer_overflow_function(isolate).address(), | 309 Add(ExternalReference::store_buffer_overflow_function(isolate).address(), |
| 310 RUNTIME_ENTRY, | 310 RUNTIME_ENTRY, |
| 311 6, | 311 6, |
| 312 "StoreBuffer::StoreBufferOverflow"); | 312 "StoreBuffer::StoreBufferOverflow"); |
| 313 Add(ExternalReference:: | |
| 314 incremental_evacuation_record_write_function(isolate).address(), | |
| 315 RUNTIME_ENTRY, | |
| 316 7, | |
| 317 "IncrementalMarking::RecordWrite"); | |
| 318 | 313 |
| 319 // Miscellaneous | 314 // Miscellaneous |
| 320 Add(ExternalReference::roots_array_start(isolate).address(), | 315 Add(ExternalReference::roots_array_start(isolate).address(), |
| 321 UNCLASSIFIED, | 316 UNCLASSIFIED, |
| 322 3, | 317 3, |
| 323 "Heap::roots_array_start()"); | 318 "Heap::roots_array_start()"); |
| 324 Add(ExternalReference::address_of_stack_limit(isolate).address(), | 319 Add(ExternalReference::address_of_stack_limit(isolate).address(), |
| 325 UNCLASSIFIED, | 320 UNCLASSIFIED, |
| 326 4, | 321 4, |
| 327 "StackGuard::address_of_jslimit()"); | 322 "StackGuard::address_of_jslimit()"); |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 Cell* cell = Cell::cast(new_object); \ | 976 Cell* cell = Cell::cast(new_object); \ |
| 982 new_object = reinterpret_cast<Object*>( \ | 977 new_object = reinterpret_cast<Object*>( \ |
| 983 cell->ValueAddress()); \ | 978 cell->ValueAddress()); \ |
| 984 } \ | 979 } \ |
| 985 } \ | 980 } \ |
| 986 if (how == kFromCode) { \ | 981 if (how == kFromCode) { \ |
| 987 Address location_of_branch_data = \ | 982 Address location_of_branch_data = \ |
| 988 reinterpret_cast<Address>(current); \ | 983 reinterpret_cast<Address>(current); \ |
| 989 Assembler::deserialization_set_special_target_at( \ | 984 Assembler::deserialization_set_special_target_at( \ |
| 990 location_of_branch_data, \ | 985 location_of_branch_data, \ |
| 986 Code::cast(HeapObject::FromAddress(current_object_address)), \ |
| 991 reinterpret_cast<Address>(new_object)); \ | 987 reinterpret_cast<Address>(new_object)); \ |
| 992 location_of_branch_data += Assembler::kSpecialTargetSize; \ | 988 location_of_branch_data += Assembler::kSpecialTargetSize; \ |
| 993 current = reinterpret_cast<Object**>(location_of_branch_data); \ | 989 current = reinterpret_cast<Object**>(location_of_branch_data); \ |
| 994 current_was_incremented = true; \ | 990 current_was_incremented = true; \ |
| 995 } else { \ | 991 } else { \ |
| 996 *current = new_object; \ | 992 *current = new_object; \ |
| 997 } \ | 993 } \ |
| 998 } \ | 994 } \ |
| 999 if (emit_write_barrier && write_barrier_needed) { \ | 995 if (emit_write_barrier && write_barrier_needed) { \ |
| 1000 Address current_address = reinterpret_cast<Address>(current); \ | 996 Address current_address = reinterpret_cast<Address>(current); \ |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 // code object. | 1138 // code object. |
| 1143 CASE_STATEMENT(kNewObject, kPlain, kInnerPointer, CODE_SPACE) | 1139 CASE_STATEMENT(kNewObject, kPlain, kInnerPointer, CODE_SPACE) |
| 1144 CASE_BODY(kNewObject, kPlain, kInnerPointer, CODE_SPACE) | 1140 CASE_BODY(kNewObject, kPlain, kInnerPointer, CODE_SPACE) |
| 1145 // Deserialize a new code object and write a pointer to its first | 1141 // Deserialize a new code object and write a pointer to its first |
| 1146 // instruction to the current code object. | 1142 // instruction to the current code object. |
| 1147 ALL_SPACES(kNewObject, kFromCode, kInnerPointer) | 1143 ALL_SPACES(kNewObject, kFromCode, kInnerPointer) |
| 1148 // Find a recently deserialized object using its offset from the current | 1144 // Find a recently deserialized object using its offset from the current |
| 1149 // allocation point and write a pointer to it to the current object. | 1145 // allocation point and write a pointer to it to the current object. |
| 1150 ALL_SPACES(kBackref, kPlain, kStartOfObject) | 1146 ALL_SPACES(kBackref, kPlain, kStartOfObject) |
| 1151 ALL_SPACES(kBackrefWithSkip, kPlain, kStartOfObject) | 1147 ALL_SPACES(kBackrefWithSkip, kPlain, kStartOfObject) |
| 1152 #if V8_TARGET_ARCH_MIPS | 1148 #if defined(V8_TARGET_ARCH_MIPS) || V8_OOL_CONSTANT_POOL |
| 1153 // Deserialize a new object from pointer found in code and write | 1149 // Deserialize a new object from pointer found in code and write |
| 1154 // a pointer to it to the current object. Required only for MIPS, and | 1150 // a pointer to it to the current object. Required only for MIPS or ARM |
| 1155 // omitted on the other architectures because it is fully unrolled and | 1151 // with ool constant pool, and omitted on the other architectures because |
| 1156 // would cause bloat. | 1152 // it is fully unrolled and would cause bloat. |
| 1157 ALL_SPACES(kNewObject, kFromCode, kStartOfObject) | 1153 ALL_SPACES(kNewObject, kFromCode, kStartOfObject) |
| 1158 // Find a recently deserialized code object using its offset from the | 1154 // Find a recently deserialized code object using its offset from the |
| 1159 // current allocation point and write a pointer to it to the current | 1155 // current allocation point and write a pointer to it to the current |
| 1160 // object. Required only for MIPS. | 1156 // object. Required only for MIPS or ARM with ool constant pool. |
| 1161 ALL_SPACES(kBackref, kFromCode, kStartOfObject) | 1157 ALL_SPACES(kBackref, kFromCode, kStartOfObject) |
| 1162 ALL_SPACES(kBackrefWithSkip, kFromCode, kStartOfObject) | 1158 ALL_SPACES(kBackrefWithSkip, kFromCode, kStartOfObject) |
| 1163 #endif | 1159 #endif |
| 1164 // Find a recently deserialized code object using its offset from the | 1160 // Find a recently deserialized code object using its offset from the |
| 1165 // current allocation point and write a pointer to its first instruction | 1161 // current allocation point and write a pointer to its first instruction |
| 1166 // to the current code object or the instruction pointer in a function | 1162 // to the current code object or the instruction pointer in a function |
| 1167 // object. | 1163 // object. |
| 1168 ALL_SPACES(kBackref, kFromCode, kInnerPointer) | 1164 ALL_SPACES(kBackref, kFromCode, kInnerPointer) |
| 1169 ALL_SPACES(kBackrefWithSkip, kFromCode, kInnerPointer) | 1165 ALL_SPACES(kBackrefWithSkip, kFromCode, kInnerPointer) |
| 1170 ALL_SPACES(kBackref, kPlain, kInnerPointer) | 1166 ALL_SPACES(kBackref, kPlain, kInnerPointer) |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1371 return length; | 1367 return length; |
| 1372 } | 1368 } |
| 1373 | 1369 |
| 1374 | 1370 |
| 1375 int Serializer::RootIndex(HeapObject* heap_object, HowToCode from) { | 1371 int Serializer::RootIndex(HeapObject* heap_object, HowToCode from) { |
| 1376 Heap* heap = isolate()->heap(); | 1372 Heap* heap = isolate()->heap(); |
| 1377 if (heap->InNewSpace(heap_object)) return kInvalidRootIndex; | 1373 if (heap->InNewSpace(heap_object)) return kInvalidRootIndex; |
| 1378 for (int i = 0; i < root_index_wave_front_; i++) { | 1374 for (int i = 0; i < root_index_wave_front_; i++) { |
| 1379 Object* root = heap->roots_array_start()[i]; | 1375 Object* root = heap->roots_array_start()[i]; |
| 1380 if (!root->IsSmi() && root == heap_object) { | 1376 if (!root->IsSmi() && root == heap_object) { |
| 1381 #if V8_TARGET_ARCH_MIPS | 1377 #if defined(V8_TARGET_ARCH_MIPS) || V8_OOL_CONSTANT_POOL |
| 1382 if (from == kFromCode) { | 1378 if (from == kFromCode) { |
| 1383 // In order to avoid code bloat in the deserializer we don't have | 1379 // In order to avoid code bloat in the deserializer we don't have |
| 1384 // support for the encoding that specifies a particular root should | 1380 // support for the encoding that specifies a particular root should |
| 1385 // be written into the lui/ori instructions on MIPS. Therefore we | 1381 // be written from within code. |
| 1386 // should not generate such serialization data for MIPS. | |
| 1387 return kInvalidRootIndex; | 1382 return kInvalidRootIndex; |
| 1388 } | 1383 } |
| 1389 #endif | 1384 #endif |
| 1390 return i; | 1385 return i; |
| 1391 } | 1386 } |
| 1392 } | 1387 } |
| 1393 return kInvalidRootIndex; | 1388 return kInvalidRootIndex; |
| 1394 } | 1389 } |
| 1395 | 1390 |
| 1396 | 1391 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1629 current_contents, kPlain, kStartOfObject, 0); | 1624 current_contents, kPlain, kStartOfObject, 0); |
| 1630 bytes_processed_so_far_ += kPointerSize; | 1625 bytes_processed_so_far_ += kPointerSize; |
| 1631 current++; | 1626 current++; |
| 1632 } | 1627 } |
| 1633 } | 1628 } |
| 1634 } | 1629 } |
| 1635 } | 1630 } |
| 1636 | 1631 |
| 1637 | 1632 |
| 1638 void Serializer::ObjectSerializer::VisitEmbeddedPointer(RelocInfo* rinfo) { | 1633 void Serializer::ObjectSerializer::VisitEmbeddedPointer(RelocInfo* rinfo) { |
| 1634 // Out-of-line constant pool entries will be visited by the ConstantPoolArray. |
| 1635 if (FLAG_enable_ool_constant_pool && rinfo->IsInConstantPool()) return; |
| 1636 |
| 1639 int skip = OutputRawData(rinfo->target_address_address(), | 1637 int skip = OutputRawData(rinfo->target_address_address(), |
| 1640 kCanReturnSkipInsteadOfSkipping); | 1638 kCanReturnSkipInsteadOfSkipping); |
| 1641 HowToCode how_to_code = rinfo->IsCodedSpecially() ? kFromCode : kPlain; | 1639 HowToCode how_to_code = rinfo->IsCodedSpecially() ? kFromCode : kPlain; |
| 1642 Object* object = rinfo->target_object(); | 1640 Object* object = rinfo->target_object(); |
| 1643 serializer_->SerializeObject(object, how_to_code, kStartOfObject, skip); | 1641 serializer_->SerializeObject(object, how_to_code, kStartOfObject, skip); |
| 1644 bytes_processed_so_far_ += rinfo->target_address_size(); | 1642 bytes_processed_so_far_ += rinfo->target_address_size(); |
| 1645 } | 1643 } |
| 1646 | 1644 |
| 1647 | 1645 |
| 1648 void Serializer::ObjectSerializer::VisitExternalReference(Address* p) { | 1646 void Serializer::ObjectSerializer::VisitExternalReference(Address* p) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1674 HowToCode how_to_code = rinfo->IsCodedSpecially() ? kFromCode : kPlain; | 1672 HowToCode how_to_code = rinfo->IsCodedSpecially() ? kFromCode : kPlain; |
| 1675 sink_->Put(kExternalReference + how_to_code + kStartOfObject, "ExternalRef"); | 1673 sink_->Put(kExternalReference + how_to_code + kStartOfObject, "ExternalRef"); |
| 1676 sink_->PutInt(skip, "SkipB4ExternalRef"); | 1674 sink_->PutInt(skip, "SkipB4ExternalRef"); |
| 1677 Address target = rinfo->target_address(); | 1675 Address target = rinfo->target_address(); |
| 1678 sink_->PutInt(serializer_->EncodeExternalReference(target), "reference id"); | 1676 sink_->PutInt(serializer_->EncodeExternalReference(target), "reference id"); |
| 1679 bytes_processed_so_far_ += rinfo->target_address_size(); | 1677 bytes_processed_so_far_ += rinfo->target_address_size(); |
| 1680 } | 1678 } |
| 1681 | 1679 |
| 1682 | 1680 |
| 1683 void Serializer::ObjectSerializer::VisitCodeTarget(RelocInfo* rinfo) { | 1681 void Serializer::ObjectSerializer::VisitCodeTarget(RelocInfo* rinfo) { |
| 1682 // Out-of-line constant pool entries will be visited by the ConstantPoolArray. |
| 1683 if (FLAG_enable_ool_constant_pool && rinfo->IsInConstantPool()) return; |
| 1684 |
| 1684 int skip = OutputRawData(rinfo->target_address_address(), | 1685 int skip = OutputRawData(rinfo->target_address_address(), |
| 1685 kCanReturnSkipInsteadOfSkipping); | 1686 kCanReturnSkipInsteadOfSkipping); |
| 1686 Code* object = Code::GetCodeFromTargetAddress(rinfo->target_address()); | 1687 Code* object = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
| 1687 serializer_->SerializeObject(object, kFromCode, kInnerPointer, skip); | 1688 serializer_->SerializeObject(object, kFromCode, kInnerPointer, skip); |
| 1688 bytes_processed_so_far_ += rinfo->target_address_size(); | 1689 bytes_processed_so_far_ += rinfo->target_address_size(); |
| 1689 } | 1690 } |
| 1690 | 1691 |
| 1691 | 1692 |
| 1692 void Serializer::ObjectSerializer::VisitCodeEntry(Address entry_address) { | 1693 void Serializer::ObjectSerializer::VisitCodeEntry(Address entry_address) { |
| 1693 int skip = OutputRawData(entry_address, kCanReturnSkipInsteadOfSkipping); | 1694 int skip = OutputRawData(entry_address, kCanReturnSkipInsteadOfSkipping); |
| 1694 Code* object = Code::cast(Code::GetObjectFromEntryAddress(entry_address)); | 1695 Code* object = Code::cast(Code::GetObjectFromEntryAddress(entry_address)); |
| 1695 serializer_->SerializeObject(object, kPlain, kInnerPointer, skip); | 1696 serializer_->SerializeObject(object, kPlain, kInnerPointer, skip); |
| 1696 bytes_processed_so_far_ += kPointerSize; | 1697 bytes_processed_so_far_ += kPointerSize; |
| 1697 } | 1698 } |
| 1698 | 1699 |
| 1699 | 1700 |
| 1700 void Serializer::ObjectSerializer::VisitCell(RelocInfo* rinfo) { | 1701 void Serializer::ObjectSerializer::VisitCell(RelocInfo* rinfo) { |
| 1702 // Out-of-line constant pool entries will be visited by the ConstantPoolArray. |
| 1703 if (FLAG_enable_ool_constant_pool && rinfo->IsInConstantPool()) return; |
| 1704 |
| 1701 int skip = OutputRawData(rinfo->pc(), kCanReturnSkipInsteadOfSkipping); | 1705 int skip = OutputRawData(rinfo->pc(), kCanReturnSkipInsteadOfSkipping); |
| 1702 Cell* object = Cell::cast(rinfo->target_cell()); | 1706 Cell* object = Cell::cast(rinfo->target_cell()); |
| 1703 serializer_->SerializeObject(object, kPlain, kInnerPointer, skip); | 1707 serializer_->SerializeObject(object, kPlain, kInnerPointer, skip); |
| 1704 } | 1708 } |
| 1705 | 1709 |
| 1706 | 1710 |
| 1707 void Serializer::ObjectSerializer::VisitExternalAsciiString( | 1711 void Serializer::ObjectSerializer::VisitExternalAsciiString( |
| 1708 v8::String::ExternalAsciiStringResource** resource_pointer) { | 1712 v8::String::ExternalAsciiStringResource** resource_pointer) { |
| 1709 Address references_start = reinterpret_cast<Address>(resource_pointer); | 1713 Address references_start = reinterpret_cast<Address>(resource_pointer); |
| 1710 OutputRawData(references_start); | 1714 OutputRawData(references_start); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1736 } | 1740 } |
| 1737 | 1741 |
| 1738 | 1742 |
| 1739 static void WipeOutRelocations(Code* code) { | 1743 static void WipeOutRelocations(Code* code) { |
| 1740 int mode_mask = | 1744 int mode_mask = |
| 1741 RelocInfo::kCodeTargetMask | | 1745 RelocInfo::kCodeTargetMask | |
| 1742 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 1746 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 1743 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | | 1747 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | |
| 1744 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); | 1748 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); |
| 1745 for (RelocIterator it(code, mode_mask); !it.done(); it.next()) { | 1749 for (RelocIterator it(code, mode_mask); !it.done(); it.next()) { |
| 1746 it.rinfo()->WipeOut(); | 1750 if (!(FLAG_enable_ool_constant_pool && it.rinfo()->IsInConstantPool())) { |
| 1751 it.rinfo()->WipeOut(); |
| 1752 } |
| 1747 } | 1753 } |
| 1748 } | 1754 } |
| 1749 | 1755 |
| 1750 | 1756 |
| 1751 int Serializer::ObjectSerializer::OutputRawData( | 1757 int Serializer::ObjectSerializer::OutputRawData( |
| 1752 Address up_to, Serializer::ObjectSerializer::ReturnSkip return_skip) { | 1758 Address up_to, Serializer::ObjectSerializer::ReturnSkip return_skip) { |
| 1753 Address object_start = object_->address(); | 1759 Address object_start = object_->address(); |
| 1754 int base = bytes_processed_so_far_; | 1760 int base = bytes_processed_so_far_; |
| 1755 int up_to_offset = static_cast<int>(up_to - object_start); | 1761 int up_to_offset = static_cast<int>(up_to - object_start); |
| 1756 int to_skip = up_to_offset - bytes_processed_so_far_; | 1762 int to_skip = up_to_offset - bytes_processed_so_far_; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1848 | 1854 |
| 1849 bool SnapshotByteSource::AtEOF() { | 1855 bool SnapshotByteSource::AtEOF() { |
| 1850 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; | 1856 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; |
| 1851 for (int x = position_; x < length_; x++) { | 1857 for (int x = position_; x < length_; x++) { |
| 1852 if (data_[x] != SerializerDeserializer::nop()) return false; | 1858 if (data_[x] != SerializerDeserializer::nop()) return false; |
| 1853 } | 1859 } |
| 1854 return true; | 1860 return true; |
| 1855 } | 1861 } |
| 1856 | 1862 |
| 1857 } } // namespace v8::internal | 1863 } } // namespace v8::internal |
| OLD | NEW |