OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 } else if (space_number == CELL_SPACE) { \ | 754 } else if (space_number == CELL_SPACE) { \ |
755 dest_space = isolate->heap()->cell_space(); \ | 755 dest_space = isolate->heap()->cell_space(); \ |
756 } else { \ | 756 } else { \ |
757 ASSERT(space_number >= LO_SPACE); \ | 757 ASSERT(space_number >= LO_SPACE); \ |
758 dest_space = isolate->heap()->lo_space(); \ | 758 dest_space = isolate->heap()->lo_space(); \ |
759 } | 759 } |
760 | 760 |
761 | 761 |
762 static const int kUnknownOffsetFromStart = -1; | 762 static const int kUnknownOffsetFromStart = -1; |
763 | 763 |
| 764 static const int kInstructionsForSplitImmediate = 3*kPointerSize; |
764 | 765 |
765 void Deserializer::ReadChunk(Object** current, | 766 void Deserializer::ReadChunk(Object** current, |
766 Object** limit, | 767 Object** limit, |
767 int source_space, | 768 int source_space, |
768 Address current_object_address) { | 769 Address current_object_address) { |
769 Isolate* const isolate = isolate_; | 770 Isolate* const isolate = isolate_; |
770 bool write_barrier_needed = (current_object_address != NULL && | 771 bool write_barrier_needed = (current_object_address != NULL && |
771 source_space != NEW_SPACE && | 772 source_space != NEW_SPACE && |
772 source_space != CELL_SPACE && | 773 source_space != CELL_SPACE && |
773 source_space != CODE_SPACE && | 774 source_space != CODE_SPACE && |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 } \ | 827 } \ |
827 } \ | 828 } \ |
828 if (within == kFirstInstruction) { \ | 829 if (within == kFirstInstruction) { \ |
829 Code* new_code_object = reinterpret_cast<Code*>(new_object); \ | 830 Code* new_code_object = reinterpret_cast<Code*>(new_object); \ |
830 new_object = reinterpret_cast<Object*>( \ | 831 new_object = reinterpret_cast<Object*>( \ |
831 new_code_object->instruction_start()); \ | 832 new_code_object->instruction_start()); \ |
832 } \ | 833 } \ |
833 if (how == kFromCode) { \ | 834 if (how == kFromCode) { \ |
834 Address location_of_branch_data = \ | 835 Address location_of_branch_data = \ |
835 reinterpret_cast<Address>(current); \ | 836 reinterpret_cast<Address>(current); \ |
836 Assembler::set_target_at(location_of_branch_data, \ | 837 Address patch_site = location_of_branch_data; \ |
| 838 if (Assembler::kCallTargetSize == 0) { \ |
| 839 current_was_incremented = true; \ |
| 840 patch_site -= kInstructionsForSplitImmediate; \ |
| 841 } \ |
| 842 Assembler::set_target_at(patch_site, \ |
837 reinterpret_cast<Address>(new_object)); \ | 843 reinterpret_cast<Address>(new_object)); \ |
838 if (within == kFirstInstruction) { \ | 844 if (within == kFirstInstruction) { \ |
839 location_of_branch_data += Assembler::kCallTargetSize; \ | 845 location_of_branch_data += Assembler::kCallTargetSize; \ |
840 current = reinterpret_cast<Object**>(location_of_branch_data); \ | 846 current = reinterpret_cast<Object**>(location_of_branch_data); \ |
841 current_was_incremented = true; \ | 847 current_was_incremented = true; \ |
842 } \ | 848 } \ |
843 } else { \ | 849 } else { \ |
844 *current = new_object; \ | 850 *current = new_object; \ |
845 } \ | 851 } \ |
846 } \ | 852 } \ |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 Object* object = current[-1]; | 966 Object* object = current[-1]; |
961 ASSERT(!isolate->heap()->InNewSpace(object)); | 967 ASSERT(!isolate->heap()->InNewSpace(object)); |
962 for (int i = 0; i < repeats; i++) current[i] = object; | 968 for (int i = 0; i < repeats; i++) current[i] = object; |
963 current += repeats; | 969 current += repeats; |
964 break; | 970 break; |
965 } | 971 } |
966 | 972 |
967 // Deserialize a new object and write a pointer to it to the current | 973 // Deserialize a new object and write a pointer to it to the current |
968 // object. | 974 // object. |
969 ONE_PER_SPACE(kNewObject, kPlain, kStartOfObject) | 975 ONE_PER_SPACE(kNewObject, kPlain, kStartOfObject) |
| 976 // Deserialize a new object from pointer found in code and write |
| 977 // a pointer to it to the current object. Required only for MIPS. |
| 978 #if V8_TARGET_ARCH_MIPS |
| 979 ONE_PER_SPACE(kNewObject, kFromCode, kStartOfObject) |
| 980 #endif |
970 // Support for direct instruction pointers in functions | 981 // Support for direct instruction pointers in functions |
971 ONE_PER_CODE_SPACE(kNewObject, kPlain, kFirstInstruction) | 982 ONE_PER_CODE_SPACE(kNewObject, kPlain, kFirstInstruction) |
972 // Deserialize a new code object and write a pointer to its first | 983 // Deserialize a new code object and write a pointer to its first |
973 // instruction to the current code object. | 984 // instruction to the current code object. |
974 ONE_PER_SPACE(kNewObject, kFromCode, kFirstInstruction) | 985 ONE_PER_SPACE(kNewObject, kFromCode, kFirstInstruction) |
975 // Find a recently deserialized object using its offset from the current | 986 // Find a recently deserialized object using its offset from the current |
976 // allocation point and write a pointer to it to the current object. | 987 // allocation point and write a pointer to it to the current object. |
977 ALL_SPACES(kBackref, kPlain, kStartOfObject) | 988 ALL_SPACES(kBackref, kPlain, kStartOfObject) |
978 // Find a recently deserialized code object using its offset from the | 989 // Find a recently deserialized code object using its offset from the |
| 990 // current allocation point and write a pointer to it to the current |
| 991 // object. Required only for MIPS. |
| 992 ALL_SPACES(kBackref, kFromCode, kStartOfObject) |
| 993 // Find a recently deserialized code object using its offset from the |
979 // current allocation point and write a pointer to its first instruction | 994 // current allocation point and write a pointer to its first instruction |
980 // to the current code object or the instruction pointer in a function | 995 // to the current code object or the instruction pointer in a function |
981 // object. | 996 // object. |
982 ALL_SPACES(kBackref, kFromCode, kFirstInstruction) | 997 ALL_SPACES(kBackref, kFromCode, kFirstInstruction) |
983 ALL_SPACES(kBackref, kPlain, kFirstInstruction) | 998 ALL_SPACES(kBackref, kPlain, kFirstInstruction) |
984 // Find an already deserialized object using its offset from the start | 999 // Find an already deserialized object using its offset from the start |
985 // and write a pointer to it to the current object. | 1000 // and write a pointer to it to the current object. |
986 ALL_SPACES(kFromStart, kPlain, kStartOfObject) | 1001 ALL_SPACES(kFromStart, kPlain, kStartOfObject) |
987 ALL_SPACES(kFromStart, kPlain, kFirstInstruction) | 1002 ALL_SPACES(kFromStart, kPlain, kFirstInstruction) |
988 // Find an already deserialized code object using its offset from the | 1003 // Find an already deserialized code object using its offset from the |
989 // start and write a pointer to its first instruction to the current code | 1004 // start and write a pointer to its first instruction to the current code |
990 // object. | 1005 // object. |
991 ALL_SPACES(kFromStart, kFromCode, kFirstInstruction) | 1006 ALL_SPACES(kFromStart, kFromCode, kFirstInstruction) |
| 1007 // Find an already deserialized code object using its offset from |
| 1008 // the start and write a pointer to it to the current object. |
| 1009 // Required only for MIPS. |
| 1010 ALL_SPACES(kFromStart, kFromCode, kStartOfObject) |
992 // Find an object in the roots array and write a pointer to it to the | 1011 // Find an object in the roots array and write a pointer to it to the |
993 // current object. | 1012 // current object. |
994 CASE_STATEMENT(kRootArray, kPlain, kStartOfObject, 0) | 1013 CASE_STATEMENT(kRootArray, kPlain, kStartOfObject, 0) |
995 CASE_BODY(kRootArray, kPlain, kStartOfObject, 0, kUnknownOffsetFromStart) | 1014 CASE_BODY(kRootArray, kPlain, kStartOfObject, 0, kUnknownOffsetFromStart) |
| 1015 // Required only for MIPS. |
| 1016 CASE_STATEMENT(kRootArray, kFromCode, kStartOfObject, 0) |
| 1017 CASE_BODY(kRootArray, |
| 1018 kFromCode, |
| 1019 kStartOfObject, |
| 1020 0, |
| 1021 kUnknownOffsetFromStart) |
996 // Find an object in the partial snapshots cache and write a pointer to it | 1022 // Find an object in the partial snapshots cache and write a pointer to it |
997 // to the current object. | 1023 // to the current object. |
998 CASE_STATEMENT(kPartialSnapshotCache, kPlain, kStartOfObject, 0) | 1024 CASE_STATEMENT(kPartialSnapshotCache, kPlain, kStartOfObject, 0) |
999 CASE_BODY(kPartialSnapshotCache, | 1025 CASE_BODY(kPartialSnapshotCache, |
1000 kPlain, | 1026 kPlain, |
1001 kStartOfObject, | 1027 kStartOfObject, |
1002 0, | 1028 0, |
1003 kUnknownOffsetFromStart) | 1029 kUnknownOffsetFromStart) |
1004 // Find an code entry in the partial snapshots cache and | 1030 // Find an code entry in the partial snapshots cache and |
1005 // write a pointer to it to the current object. | 1031 // write a pointer to it to the current object. |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1671 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); | 1697 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); |
1672 } | 1698 } |
1673 } | 1699 } |
1674 int allocation_address = fullness_[space]; | 1700 int allocation_address = fullness_[space]; |
1675 fullness_[space] = allocation_address + size; | 1701 fullness_[space] = allocation_address + size; |
1676 return allocation_address; | 1702 return allocation_address; |
1677 } | 1703 } |
1678 | 1704 |
1679 | 1705 |
1680 } } // namespace v8::internal | 1706 } } // namespace v8::internal |
OLD | NEW |