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; | |
Erik Corry
2011/12/21 09:33:55
Inconsistency: This constant is premultiplied by k
kisg
2011/12/22 15:30:14
We will change the naming.
This constant is only u
| |
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) { \ | |
Erik Corry
2011/12/21 09:33:55
The size of a call target is only relevant if we a
kisg
2011/12/22 15:30:14
Actually, this is a subtle way of saying #ifdef MI
| |
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 ONE_PER_SPACE(kNewObject, kFromCode, kStartOfObject) | |
Erik Corry
2011/12/21 09:33:55
I'm a bit worried about the code size here. The d
kisg
2011/12/22 15:30:14
Done.
| |
970 // Support for direct instruction pointers in functions | 979 // Support for direct instruction pointers in functions |
971 ONE_PER_CODE_SPACE(kNewObject, kPlain, kFirstInstruction) | 980 ONE_PER_CODE_SPACE(kNewObject, kPlain, kFirstInstruction) |
972 // Deserialize a new code object and write a pointer to its first | 981 // Deserialize a new code object and write a pointer to its first |
973 // instruction to the current code object. | 982 // instruction to the current code object. |
974 ONE_PER_SPACE(kNewObject, kFromCode, kFirstInstruction) | 983 ONE_PER_SPACE(kNewObject, kFromCode, kFirstInstruction) |
975 // Find a recently deserialized object using its offset from the current | 984 // Find a recently deserialized object using its offset from the current |
976 // allocation point and write a pointer to it to the current object. | 985 // allocation point and write a pointer to it to the current object. |
977 ALL_SPACES(kBackref, kPlain, kStartOfObject) | 986 ALL_SPACES(kBackref, kPlain, kStartOfObject) |
978 // Find a recently deserialized code object using its offset from the | 987 // Find a recently deserialized code object using its offset from the |
988 // current allocation point and write a pointer to it to the current | |
989 // object. Required only for MIPS. | |
990 ALL_SPACES(kBackref, kFromCode, kStartOfObject) | |
991 // Find a recently deserialized code object using its offset from the | |
979 // current allocation point and write a pointer to its first instruction | 992 // current allocation point and write a pointer to its first instruction |
980 // to the current code object or the instruction pointer in a function | 993 // to the current code object or the instruction pointer in a function |
981 // object. | 994 // object. |
982 ALL_SPACES(kBackref, kFromCode, kFirstInstruction) | 995 ALL_SPACES(kBackref, kFromCode, kFirstInstruction) |
983 ALL_SPACES(kBackref, kPlain, kFirstInstruction) | 996 ALL_SPACES(kBackref, kPlain, kFirstInstruction) |
984 // Find an already deserialized object using its offset from the start | 997 // Find an already deserialized object using its offset from the start |
985 // and write a pointer to it to the current object. | 998 // and write a pointer to it to the current object. |
986 ALL_SPACES(kFromStart, kPlain, kStartOfObject) | 999 ALL_SPACES(kFromStart, kPlain, kStartOfObject) |
987 ALL_SPACES(kFromStart, kPlain, kFirstInstruction) | 1000 ALL_SPACES(kFromStart, kPlain, kFirstInstruction) |
988 // Find an already deserialized code object using its offset from the | 1001 // 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 | 1002 // start and write a pointer to its first instruction to the current code |
990 // object. | 1003 // object. |
991 ALL_SPACES(kFromStart, kFromCode, kFirstInstruction) | 1004 ALL_SPACES(kFromStart, kFromCode, kFirstInstruction) |
1005 // Find an already deserialized code object using its offset from | |
1006 // the start and write a pointer to it to the current object. | |
1007 // Required only for MIPS. | |
1008 ALL_SPACES(kFromStart, kFromCode, kStartOfObject) | |
992 // Find an object in the roots array and write a pointer to it to the | 1009 // Find an object in the roots array and write a pointer to it to the |
993 // current object. | 1010 // current object. |
994 CASE_STATEMENT(kRootArray, kPlain, kStartOfObject, 0) | 1011 CASE_STATEMENT(kRootArray, kPlain, kStartOfObject, 0) |
995 CASE_BODY(kRootArray, kPlain, kStartOfObject, 0, kUnknownOffsetFromStart) | 1012 CASE_BODY(kRootArray, kPlain, kStartOfObject, 0, kUnknownOffsetFromStart) |
1013 // Required only for MIPS. | |
1014 CASE_STATEMENT(kRootArray, kFromCode, kStartOfObject, 0) | |
Erik Corry
2011/12/21 09:33:55
Can we replace these with LoadRoot which does the
kisg
2011/12/22 15:30:14
Could you please elaborate this a bit in more deta
| |
1015 CASE_BODY(kRootArray, | |
1016 kFromCode, | |
1017 kStartOfObject, | |
1018 0, | |
1019 kUnknownOffsetFromStart) | |
996 // Find an object in the partial snapshots cache and write a pointer to it | 1020 // Find an object in the partial snapshots cache and write a pointer to it |
997 // to the current object. | 1021 // to the current object. |
998 CASE_STATEMENT(kPartialSnapshotCache, kPlain, kStartOfObject, 0) | 1022 CASE_STATEMENT(kPartialSnapshotCache, kPlain, kStartOfObject, 0) |
999 CASE_BODY(kPartialSnapshotCache, | 1023 CASE_BODY(kPartialSnapshotCache, |
1000 kPlain, | 1024 kPlain, |
1001 kStartOfObject, | 1025 kStartOfObject, |
1002 0, | 1026 0, |
1003 kUnknownOffsetFromStart) | 1027 kUnknownOffsetFromStart) |
1004 // Find an code entry in the partial snapshots cache and | 1028 // Find an code entry in the partial snapshots cache and |
1005 // write a pointer to it to the current object. | 1029 // 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); | 1695 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); |
1672 } | 1696 } |
1673 } | 1697 } |
1674 int allocation_address = fullness_[space]; | 1698 int allocation_address = fullness_[space]; |
1675 fullness_[space] = allocation_address + size; | 1699 fullness_[space] = allocation_address + size; |
1676 return allocation_address; | 1700 return allocation_address; |
1677 } | 1701 } |
1678 | 1702 |
1679 | 1703 |
1680 } } // namespace v8::internal | 1704 } } // namespace v8::internal |
OLD | NEW |