Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/serialize.cc

Issue 195373004: Revert "Pass a Code object to Assembler::(set_)target_address_at for use by ool constant pool." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects-visiting-inl.h ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 Cell* cell = Cell::cast(new_object); \ 976 Cell* cell = Cell::cast(new_object); \
977 new_object = reinterpret_cast<Object*>( \ 977 new_object = reinterpret_cast<Object*>( \
978 cell->ValueAddress()); \ 978 cell->ValueAddress()); \
979 } \ 979 } \
980 } \ 980 } \
981 if (how == kFromCode) { \ 981 if (how == kFromCode) { \
982 Address location_of_branch_data = \ 982 Address location_of_branch_data = \
983 reinterpret_cast<Address>(current); \ 983 reinterpret_cast<Address>(current); \
984 Assembler::deserialization_set_special_target_at( \ 984 Assembler::deserialization_set_special_target_at( \
985 location_of_branch_data, \ 985 location_of_branch_data, \
986 Code::cast(HeapObject::FromAddress(current_object_address)), \
987 reinterpret_cast<Address>(new_object)); \ 986 reinterpret_cast<Address>(new_object)); \
988 location_of_branch_data += Assembler::kSpecialTargetSize; \ 987 location_of_branch_data += Assembler::kSpecialTargetSize; \
989 current = reinterpret_cast<Object**>(location_of_branch_data); \ 988 current = reinterpret_cast<Object**>(location_of_branch_data); \
990 current_was_incremented = true; \ 989 current_was_incremented = true; \
991 } else { \ 990 } else { \
992 *current = new_object; \ 991 *current = new_object; \
993 } \ 992 } \
994 } \ 993 } \
995 if (emit_write_barrier && write_barrier_needed) { \ 994 if (emit_write_barrier && write_barrier_needed) { \
996 Address current_address = reinterpret_cast<Address>(current); \ 995 Address current_address = reinterpret_cast<Address>(current); \
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 // code object. 1137 // code object.
1139 CASE_STATEMENT(kNewObject, kPlain, kInnerPointer, CODE_SPACE) 1138 CASE_STATEMENT(kNewObject, kPlain, kInnerPointer, CODE_SPACE)
1140 CASE_BODY(kNewObject, kPlain, kInnerPointer, CODE_SPACE) 1139 CASE_BODY(kNewObject, kPlain, kInnerPointer, CODE_SPACE)
1141 // Deserialize a new code object and write a pointer to its first 1140 // Deserialize a new code object and write a pointer to its first
1142 // instruction to the current code object. 1141 // instruction to the current code object.
1143 ALL_SPACES(kNewObject, kFromCode, kInnerPointer) 1142 ALL_SPACES(kNewObject, kFromCode, kInnerPointer)
1144 // Find a recently deserialized object using its offset from the current 1143 // Find a recently deserialized object using its offset from the current
1145 // allocation point and write a pointer to it to the current object. 1144 // allocation point and write a pointer to it to the current object.
1146 ALL_SPACES(kBackref, kPlain, kStartOfObject) 1145 ALL_SPACES(kBackref, kPlain, kStartOfObject)
1147 ALL_SPACES(kBackrefWithSkip, kPlain, kStartOfObject) 1146 ALL_SPACES(kBackrefWithSkip, kPlain, kStartOfObject)
1148 #if V8_TARGET_ARCH_MIPS 1147 #if defined(V8_TARGET_ARCH_MIPS) || V8_OOL_CONSTANT_POOL
1149 // Deserialize a new object from pointer found in code and write 1148 // Deserialize a new object from pointer found in code and write
1150 // a pointer to it to the current object. Required only for MIPS, and 1149 // a pointer to it to the current object. Required only for MIPS or ARM
1151 // omitted on the other architectures because it is fully unrolled and 1150 // with ool constant pool, and omitted on the other architectures because
1152 // would cause bloat. 1151 // it is fully unrolled and would cause bloat.
1153 ALL_SPACES(kNewObject, kFromCode, kStartOfObject) 1152 ALL_SPACES(kNewObject, kFromCode, kStartOfObject)
1154 // Find a recently deserialized code object using its offset from the 1153 // Find a recently deserialized code object using its offset from the
1155 // current allocation point and write a pointer to it to the current 1154 // current allocation point and write a pointer to it to the current
1156 // object. Required only for MIPS. 1155 // object. Required only for MIPS or ARM with ool constant pool.
1157 ALL_SPACES(kBackref, kFromCode, kStartOfObject) 1156 ALL_SPACES(kBackref, kFromCode, kStartOfObject)
1158 ALL_SPACES(kBackrefWithSkip, kFromCode, kStartOfObject) 1157 ALL_SPACES(kBackrefWithSkip, kFromCode, kStartOfObject)
1159 #endif 1158 #endif
1160 // Find a recently deserialized code object using its offset from the 1159 // Find a recently deserialized code object using its offset from the
1161 // current allocation point and write a pointer to its first instruction 1160 // current allocation point and write a pointer to its first instruction
1162 // to the current code object or the instruction pointer in a function 1161 // to the current code object or the instruction pointer in a function
1163 // object. 1162 // object.
1164 ALL_SPACES(kBackref, kFromCode, kInnerPointer) 1163 ALL_SPACES(kBackref, kFromCode, kInnerPointer)
1165 ALL_SPACES(kBackrefWithSkip, kFromCode, kInnerPointer) 1164 ALL_SPACES(kBackrefWithSkip, kFromCode, kInnerPointer)
1166 ALL_SPACES(kBackref, kPlain, kInnerPointer) 1165 ALL_SPACES(kBackref, kPlain, kInnerPointer)
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 return length; 1366 return length;
1368 } 1367 }
1369 1368
1370 1369
1371 int Serializer::RootIndex(HeapObject* heap_object, HowToCode from) { 1370 int Serializer::RootIndex(HeapObject* heap_object, HowToCode from) {
1372 Heap* heap = isolate()->heap(); 1371 Heap* heap = isolate()->heap();
1373 if (heap->InNewSpace(heap_object)) return kInvalidRootIndex; 1372 if (heap->InNewSpace(heap_object)) return kInvalidRootIndex;
1374 for (int i = 0; i < root_index_wave_front_; i++) { 1373 for (int i = 0; i < root_index_wave_front_; i++) {
1375 Object* root = heap->roots_array_start()[i]; 1374 Object* root = heap->roots_array_start()[i];
1376 if (!root->IsSmi() && root == heap_object) { 1375 if (!root->IsSmi() && root == heap_object) {
1377 #if V8_TARGET_ARCH_MIPS 1376 #if defined(V8_TARGET_ARCH_MIPS) || V8_OOL_CONSTANT_POOL
1378 if (from == kFromCode) { 1377 if (from == kFromCode) {
1379 // In order to avoid code bloat in the deserializer we don't have 1378 // In order to avoid code bloat in the deserializer we don't have
1380 // support for the encoding that specifies a particular root should 1379 // support for the encoding that specifies a particular root should
1381 // be written into the lui/ori instructions on MIPS. Therefore we 1380 // be written from within code.
1382 // should not generate such serialization data for MIPS.
1383 return kInvalidRootIndex; 1381 return kInvalidRootIndex;
1384 } 1382 }
1385 #endif 1383 #endif
1386 return i; 1384 return i;
1387 } 1385 }
1388 } 1386 }
1389 return kInvalidRootIndex; 1387 return kInvalidRootIndex;
1390 } 1388 }
1391 1389
1392 1390
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 current_contents, kPlain, kStartOfObject, 0); 1623 current_contents, kPlain, kStartOfObject, 0);
1626 bytes_processed_so_far_ += kPointerSize; 1624 bytes_processed_so_far_ += kPointerSize;
1627 current++; 1625 current++;
1628 } 1626 }
1629 } 1627 }
1630 } 1628 }
1631 } 1629 }
1632 1630
1633 1631
1634 void Serializer::ObjectSerializer::VisitEmbeddedPointer(RelocInfo* rinfo) { 1632 void Serializer::ObjectSerializer::VisitEmbeddedPointer(RelocInfo* rinfo) {
1633 // Out-of-line constant pool entries will be visited by the ConstantPoolArray.
1634 if (FLAG_enable_ool_constant_pool && rinfo->IsInConstantPool()) return;
1635
1635 int skip = OutputRawData(rinfo->target_address_address(), 1636 int skip = OutputRawData(rinfo->target_address_address(),
1636 kCanReturnSkipInsteadOfSkipping); 1637 kCanReturnSkipInsteadOfSkipping);
1637 HowToCode how_to_code = rinfo->IsCodedSpecially() ? kFromCode : kPlain; 1638 HowToCode how_to_code = rinfo->IsCodedSpecially() ? kFromCode : kPlain;
1638 Object* object = rinfo->target_object(); 1639 Object* object = rinfo->target_object();
1639 serializer_->SerializeObject(object, how_to_code, kStartOfObject, skip); 1640 serializer_->SerializeObject(object, how_to_code, kStartOfObject, skip);
1640 bytes_processed_so_far_ += rinfo->target_address_size(); 1641 bytes_processed_so_far_ += rinfo->target_address_size();
1641 } 1642 }
1642 1643
1643 1644
1644 void Serializer::ObjectSerializer::VisitExternalReference(Address* p) { 1645 void Serializer::ObjectSerializer::VisitExternalReference(Address* p) {
(...skipping 25 matching lines...) Expand all
1670 HowToCode how_to_code = rinfo->IsCodedSpecially() ? kFromCode : kPlain; 1671 HowToCode how_to_code = rinfo->IsCodedSpecially() ? kFromCode : kPlain;
1671 sink_->Put(kExternalReference + how_to_code + kStartOfObject, "ExternalRef"); 1672 sink_->Put(kExternalReference + how_to_code + kStartOfObject, "ExternalRef");
1672 sink_->PutInt(skip, "SkipB4ExternalRef"); 1673 sink_->PutInt(skip, "SkipB4ExternalRef");
1673 Address target = rinfo->target_address(); 1674 Address target = rinfo->target_address();
1674 sink_->PutInt(serializer_->EncodeExternalReference(target), "reference id"); 1675 sink_->PutInt(serializer_->EncodeExternalReference(target), "reference id");
1675 bytes_processed_so_far_ += rinfo->target_address_size(); 1676 bytes_processed_so_far_ += rinfo->target_address_size();
1676 } 1677 }
1677 1678
1678 1679
1679 void Serializer::ObjectSerializer::VisitCodeTarget(RelocInfo* rinfo) { 1680 void Serializer::ObjectSerializer::VisitCodeTarget(RelocInfo* rinfo) {
1681 // Out-of-line constant pool entries will be visited by the ConstantPoolArray.
1682 if (FLAG_enable_ool_constant_pool && rinfo->IsInConstantPool()) return;
1683
1680 int skip = OutputRawData(rinfo->target_address_address(), 1684 int skip = OutputRawData(rinfo->target_address_address(),
1681 kCanReturnSkipInsteadOfSkipping); 1685 kCanReturnSkipInsteadOfSkipping);
1682 Code* object = Code::GetCodeFromTargetAddress(rinfo->target_address()); 1686 Code* object = Code::GetCodeFromTargetAddress(rinfo->target_address());
1683 serializer_->SerializeObject(object, kFromCode, kInnerPointer, skip); 1687 serializer_->SerializeObject(object, kFromCode, kInnerPointer, skip);
1684 bytes_processed_so_far_ += rinfo->target_address_size(); 1688 bytes_processed_so_far_ += rinfo->target_address_size();
1685 } 1689 }
1686 1690
1687 1691
1688 void Serializer::ObjectSerializer::VisitCodeEntry(Address entry_address) { 1692 void Serializer::ObjectSerializer::VisitCodeEntry(Address entry_address) {
1689 int skip = OutputRawData(entry_address, kCanReturnSkipInsteadOfSkipping); 1693 int skip = OutputRawData(entry_address, kCanReturnSkipInsteadOfSkipping);
1690 Code* object = Code::cast(Code::GetObjectFromEntryAddress(entry_address)); 1694 Code* object = Code::cast(Code::GetObjectFromEntryAddress(entry_address));
1691 serializer_->SerializeObject(object, kPlain, kInnerPointer, skip); 1695 serializer_->SerializeObject(object, kPlain, kInnerPointer, skip);
1692 bytes_processed_so_far_ += kPointerSize; 1696 bytes_processed_so_far_ += kPointerSize;
1693 } 1697 }
1694 1698
1695 1699
1696 void Serializer::ObjectSerializer::VisitCell(RelocInfo* rinfo) { 1700 void Serializer::ObjectSerializer::VisitCell(RelocInfo* rinfo) {
1701 // Out-of-line constant pool entries will be visited by the ConstantPoolArray.
1702 if (FLAG_enable_ool_constant_pool && rinfo->IsInConstantPool()) return;
1703
1697 int skip = OutputRawData(rinfo->pc(), kCanReturnSkipInsteadOfSkipping); 1704 int skip = OutputRawData(rinfo->pc(), kCanReturnSkipInsteadOfSkipping);
1698 Cell* object = Cell::cast(rinfo->target_cell()); 1705 Cell* object = Cell::cast(rinfo->target_cell());
1699 serializer_->SerializeObject(object, kPlain, kInnerPointer, skip); 1706 serializer_->SerializeObject(object, kPlain, kInnerPointer, skip);
1700 } 1707 }
1701 1708
1702 1709
1703 void Serializer::ObjectSerializer::VisitExternalAsciiString( 1710 void Serializer::ObjectSerializer::VisitExternalAsciiString(
1704 v8::String::ExternalAsciiStringResource** resource_pointer) { 1711 v8::String::ExternalAsciiStringResource** resource_pointer) {
1705 Address references_start = reinterpret_cast<Address>(resource_pointer); 1712 Address references_start = reinterpret_cast<Address>(resource_pointer);
1706 OutputRawData(references_start); 1713 OutputRawData(references_start);
(...skipping 25 matching lines...) Expand all
1732 } 1739 }
1733 1740
1734 1741
1735 static void WipeOutRelocations(Code* code) { 1742 static void WipeOutRelocations(Code* code) {
1736 int mode_mask = 1743 int mode_mask =
1737 RelocInfo::kCodeTargetMask | 1744 RelocInfo::kCodeTargetMask |
1738 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | 1745 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
1739 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | 1746 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) |
1740 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); 1747 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY);
1741 for (RelocIterator it(code, mode_mask); !it.done(); it.next()) { 1748 for (RelocIterator it(code, mode_mask); !it.done(); it.next()) {
1742 it.rinfo()->WipeOut(); 1749 if (!(FLAG_enable_ool_constant_pool && it.rinfo()->IsInConstantPool())) {
1750 it.rinfo()->WipeOut();
1751 }
1743 } 1752 }
1744 } 1753 }
1745 1754
1746 1755
1747 int Serializer::ObjectSerializer::OutputRawData( 1756 int Serializer::ObjectSerializer::OutputRawData(
1748 Address up_to, Serializer::ObjectSerializer::ReturnSkip return_skip) { 1757 Address up_to, Serializer::ObjectSerializer::ReturnSkip return_skip) {
1749 Address object_start = object_->address(); 1758 Address object_start = object_->address();
1750 int base = bytes_processed_so_far_; 1759 int base = bytes_processed_so_far_;
1751 int up_to_offset = static_cast<int>(up_to - object_start); 1760 int up_to_offset = static_cast<int>(up_to - object_start);
1752 int to_skip = up_to_offset - bytes_processed_so_far_; 1761 int to_skip = up_to_offset - bytes_processed_so_far_;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 1853
1845 bool SnapshotByteSource::AtEOF() { 1854 bool SnapshotByteSource::AtEOF() {
1846 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; 1855 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false;
1847 for (int x = position_; x < length_; x++) { 1856 for (int x = position_; x < length_; x++) {
1848 if (data_[x] != SerializerDeserializer::nop()) return false; 1857 if (data_[x] != SerializerDeserializer::nop()) return false;
1849 } 1858 }
1850 return true; 1859 return true;
1851 } 1860 }
1852 1861
1853 } } // namespace v8::internal 1862 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-visiting-inl.h ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698