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

Side by Side Diff: src/serialize.cc

Issue 9372063: MIPS: Enable serialization for MIPS architecture. (Closed)
Patch Set: rebased on r10858. Created 8 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
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 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 #ifdef V8_TARGET_ARCH_MIPS
765 #define PATCH_SITE_ADJUST(addr) \
766 (addr - 3 * kPointerSize)
767 #else
768 #define PATCH_SITE_ADJUST(addr) \
769 (addr)
770 #endif
771
764 772
765 void Deserializer::ReadChunk(Object** current, 773 void Deserializer::ReadChunk(Object** current,
766 Object** limit, 774 Object** limit,
767 int source_space, 775 int source_space,
768 Address current_object_address) { 776 Address current_object_address) {
769 Isolate* const isolate = isolate_; 777 Isolate* const isolate = isolate_;
770 bool write_barrier_needed = (current_object_address != NULL && 778 bool write_barrier_needed = (current_object_address != NULL &&
771 source_space != NEW_SPACE && 779 source_space != NEW_SPACE &&
772 source_space != CELL_SPACE && 780 source_space != CELL_SPACE &&
773 source_space != CODE_SPACE && 781 source_space != CODE_SPACE &&
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 } \ 834 } \
827 } \ 835 } \
828 if (within == kFirstInstruction) { \ 836 if (within == kFirstInstruction) { \
829 Code* new_code_object = reinterpret_cast<Code*>(new_object); \ 837 Code* new_code_object = reinterpret_cast<Code*>(new_object); \
830 new_object = reinterpret_cast<Object*>( \ 838 new_object = reinterpret_cast<Object*>( \
831 new_code_object->instruction_start()); \ 839 new_code_object->instruction_start()); \
832 } \ 840 } \
833 if (how == kFromCode) { \ 841 if (how == kFromCode) { \
834 Address location_of_branch_data = \ 842 Address location_of_branch_data = \
835 reinterpret_cast<Address>(current); \ 843 reinterpret_cast<Address>(current); \
836 Assembler::set_target_at(location_of_branch_data, \ 844 Address patch_site = PATCH_SITE_ADJUST(location_of_branch_data); \
845 if (patch_site != location_of_branch_data) { \
846 current_was_incremented = true; \
847 } \
848 Assembler::set_target_at(patch_site, \
837 reinterpret_cast<Address>(new_object)); \ 849 reinterpret_cast<Address>(new_object)); \
838 if (within == kFirstInstruction) { \ 850 if (within == kFirstInstruction) { \
839 location_of_branch_data += Assembler::kCallTargetSize; \ 851 location_of_branch_data += Assembler::kCallTargetSize; \
840 current = reinterpret_cast<Object**>(location_of_branch_data); \ 852 current = reinterpret_cast<Object**>(location_of_branch_data); \
841 current_was_incremented = true; \ 853 current_was_incremented = true; \
842 } \ 854 } \
843 } else { \ 855 } else { \
844 *current = new_object; \ 856 *current = new_object; \
845 } \ 857 } \
846 } \ 858 } \
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 Object* object = current[-1]; 972 Object* object = current[-1];
961 ASSERT(!isolate->heap()->InNewSpace(object)); 973 ASSERT(!isolate->heap()->InNewSpace(object));
962 for (int i = 0; i < repeats; i++) current[i] = object; 974 for (int i = 0; i < repeats; i++) current[i] = object;
963 current += repeats; 975 current += repeats;
964 break; 976 break;
965 } 977 }
966 978
967 // Deserialize a new object and write a pointer to it to the current 979 // Deserialize a new object and write a pointer to it to the current
968 // object. 980 // object.
969 ONE_PER_SPACE(kNewObject, kPlain, kStartOfObject) 981 ONE_PER_SPACE(kNewObject, kPlain, kStartOfObject)
982 // Deserialize a new object from pointer found in code and write
983 // a pointer to it to the current object. Required only for MIPS.
984 #if V8_TARGET_ARCH_MIPS
985 ONE_PER_SPACE(kNewObject, kFromCode, kStartOfObject)
986 #endif
970 // Support for direct instruction pointers in functions 987 // Support for direct instruction pointers in functions
971 ONE_PER_CODE_SPACE(kNewObject, kPlain, kFirstInstruction) 988 ONE_PER_CODE_SPACE(kNewObject, kPlain, kFirstInstruction)
972 // Deserialize a new code object and write a pointer to its first 989 // Deserialize a new code object and write a pointer to its first
973 // instruction to the current code object. 990 // instruction to the current code object.
974 ONE_PER_SPACE(kNewObject, kFromCode, kFirstInstruction) 991 ONE_PER_SPACE(kNewObject, kFromCode, kFirstInstruction)
975 // Find a recently deserialized object using its offset from the current 992 // Find a recently deserialized object using its offset from the current
976 // allocation point and write a pointer to it to the current object. 993 // allocation point and write a pointer to it to the current object.
977 ALL_SPACES(kBackref, kPlain, kStartOfObject) 994 ALL_SPACES(kBackref, kPlain, kStartOfObject)
978 // Find a recently deserialized code object using its offset from the 995 // Find a recently deserialized code object using its offset from the
996 // current allocation point and write a pointer to it to the current
997 // object. Required only for MIPS.
998 ALL_SPACES(kBackref, kFromCode, kStartOfObject)
999 // Find a recently deserialized code object using its offset from the
979 // current allocation point and write a pointer to its first instruction 1000 // current allocation point and write a pointer to its first instruction
980 // to the current code object or the instruction pointer in a function 1001 // to the current code object or the instruction pointer in a function
981 // object. 1002 // object.
982 ALL_SPACES(kBackref, kFromCode, kFirstInstruction) 1003 ALL_SPACES(kBackref, kFromCode, kFirstInstruction)
983 ALL_SPACES(kBackref, kPlain, kFirstInstruction) 1004 ALL_SPACES(kBackref, kPlain, kFirstInstruction)
984 // Find an already deserialized object using its offset from the start 1005 // Find an already deserialized object using its offset from the start
985 // and write a pointer to it to the current object. 1006 // and write a pointer to it to the current object.
986 ALL_SPACES(kFromStart, kPlain, kStartOfObject) 1007 ALL_SPACES(kFromStart, kPlain, kStartOfObject)
987 ALL_SPACES(kFromStart, kPlain, kFirstInstruction) 1008 ALL_SPACES(kFromStart, kPlain, kFirstInstruction)
988 // Find an already deserialized code object using its offset from the 1009 // 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 1010 // start and write a pointer to its first instruction to the current code
990 // object. 1011 // object.
991 ALL_SPACES(kFromStart, kFromCode, kFirstInstruction) 1012 ALL_SPACES(kFromStart, kFromCode, kFirstInstruction)
1013 // Find an already deserialized code object using its offset from
1014 // the start and write a pointer to it to the current object.
1015 // Required only for MIPS.
1016 ALL_SPACES(kFromStart, kFromCode, kStartOfObject)
992 // Find an object in the roots array and write a pointer to it to the 1017 // Find an object in the roots array and write a pointer to it to the
993 // current object. 1018 // current object.
994 CASE_STATEMENT(kRootArray, kPlain, kStartOfObject, 0) 1019 CASE_STATEMENT(kRootArray, kPlain, kStartOfObject, 0)
995 CASE_BODY(kRootArray, kPlain, kStartOfObject, 0, kUnknownOffsetFromStart) 1020 CASE_BODY(kRootArray, kPlain, kStartOfObject, 0, kUnknownOffsetFromStart)
996 // Find an object in the partial snapshots cache and write a pointer to it 1021 // Find an object in the partial snapshots cache and write a pointer to it
997 // to the current object. 1022 // to the current object.
998 CASE_STATEMENT(kPartialSnapshotCache, kPlain, kStartOfObject, 0) 1023 CASE_STATEMENT(kPartialSnapshotCache, kPlain, kStartOfObject, 0)
999 CASE_BODY(kPartialSnapshotCache, 1024 CASE_BODY(kPartialSnapshotCache,
1000 kPlain, 1025 kPlain,
1001 kStartOfObject, 1026 kStartOfObject,
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 int Serializer::SpaceAreaSize(int space) { 1683 int Serializer::SpaceAreaSize(int space) {
1659 if (space == CODE_SPACE) { 1684 if (space == CODE_SPACE) {
1660 return isolate_->memory_allocator()->CodePageAreaSize(); 1685 return isolate_->memory_allocator()->CodePageAreaSize();
1661 } else { 1686 } else {
1662 return Page::kPageSize - Page::kObjectStartOffset; 1687 return Page::kPageSize - Page::kObjectStartOffset;
1663 } 1688 }
1664 } 1689 }
1665 1690
1666 1691
1667 } } // namespace v8::internal 1692 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698