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 422063005: Contribution of PowerPC port. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: re-upload - catch up to 8/19 level Created 6 years, 3 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/platform/platform.h" 9 #include "src/base/platform/platform.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 if (obj->IsAllocationSite()) RelinkAllocationSite(AllocationSite::cast(obj)); 793 if (obj->IsAllocationSite()) RelinkAllocationSite(AllocationSite::cast(obj));
794 794
795 // Fix up strings from serialized user code. 795 // Fix up strings from serialized user code.
796 if (deserializing_user_code()) obj = ProcessNewObjectFromSerializedCode(obj); 796 if (deserializing_user_code()) obj = ProcessNewObjectFromSerializedCode(obj);
797 797
798 *write_back = obj; 798 *write_back = obj;
799 #ifdef DEBUG 799 #ifdef DEBUG
800 bool is_codespace = (space_number == CODE_SPACE); 800 bool is_codespace = (space_number == CODE_SPACE);
801 DCHECK(obj->IsCode() == is_codespace); 801 DCHECK(obj->IsCode() == is_codespace);
802 #endif 802 #endif
803 #if V8_TARGET_ARCH_PPC && \
804 (ABI_USES_FUNCTION_DESCRIPTORS || V8_OOL_CONSTANT_POOL)
805 // If we're on a platform that uses function descriptors
806 // these jump tables make use of RelocInfo::INTERNAL_REFERENCE.
807 // As the V8 serialization code doesn't handle that relocation type
808 // we use this hack to fix up code that has function descriptors.
809 if (space_number == CODE_SPACE) {
810 Code* code = reinterpret_cast<Code*>(HeapObject::FromAddress(address));
811 for (RelocIterator it(code); !it.done(); it.next()) {
812 RelocInfo::Mode rmode = it.rinfo()->rmode();
813 if (rmode == RelocInfo::INTERNAL_REFERENCE) {
814 Assembler::RelocateInternalReference(it.rinfo()->pc(), 0,
815 code->instruction_start());
816 }
817 }
818 }
819 #endif
803 } 820 }
804 821
805 void Deserializer::ReadChunk(Object** current, 822 void Deserializer::ReadChunk(Object** current,
806 Object** limit, 823 Object** limit,
807 int source_space, 824 int source_space,
808 Address current_object_address) { 825 Address current_object_address) {
809 Isolate* const isolate = isolate_; 826 Isolate* const isolate = isolate_;
810 // Write barrier support costs around 1% in startup time. In fact there 827 // Write barrier support costs around 1% in startup time. In fact there
811 // are no new space objects in current boot snapshots, so it's not needed, 828 // are no new space objects in current boot snapshots, so it's not needed,
812 // but that may change. 829 // but that may change.
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 // code object. 1072 // code object.
1056 CASE_STATEMENT(kNewObject, kPlain, kInnerPointer, CODE_SPACE) 1073 CASE_STATEMENT(kNewObject, kPlain, kInnerPointer, CODE_SPACE)
1057 CASE_BODY(kNewObject, kPlain, kInnerPointer, CODE_SPACE) 1074 CASE_BODY(kNewObject, kPlain, kInnerPointer, CODE_SPACE)
1058 // Deserialize a new code object and write a pointer to its first 1075 // Deserialize a new code object and write a pointer to its first
1059 // instruction to the current code object. 1076 // instruction to the current code object.
1060 ALL_SPACES(kNewObject, kFromCode, kInnerPointer) 1077 ALL_SPACES(kNewObject, kFromCode, kInnerPointer)
1061 // Find a recently deserialized object using its offset from the current 1078 // Find a recently deserialized object using its offset from the current
1062 // allocation point and write a pointer to it to the current object. 1079 // allocation point and write a pointer to it to the current object.
1063 ALL_SPACES(kBackref, kPlain, kStartOfObject) 1080 ALL_SPACES(kBackref, kPlain, kStartOfObject)
1064 ALL_SPACES(kBackrefWithSkip, kPlain, kStartOfObject) 1081 ALL_SPACES(kBackrefWithSkip, kPlain, kStartOfObject)
1065 #if defined(V8_TARGET_ARCH_MIPS) || V8_OOL_CONSTANT_POOL || \ 1082 #if defined(V8_TARGET_ARCH_MIPS) || defined(V8_TARGET_ARCH_MIPS64) || \
1066 defined(V8_TARGET_ARCH_MIPS64) 1083 defined(V8_TARGET_ARCH_PPC) || V8_OOL_CONSTANT_POOL
1067 // Deserialize a new object from pointer found in code and write 1084 // Deserialize a new object from pointer found in code and write
1068 // a pointer to it to the current object. Required only for MIPS or ARM 1085 // a pointer to it to the current object. Required only for MIPS, PPC or
1069 // with ool constant pool, and omitted on the other architectures because 1086 // ARM with ool constant pool, and omitted on the other architectures
1070 // it is fully unrolled and would cause bloat. 1087 // because it is fully unrolled and would cause bloat.
1071 ALL_SPACES(kNewObject, kFromCode, kStartOfObject) 1088 ALL_SPACES(kNewObject, kFromCode, kStartOfObject)
1072 // Find a recently deserialized code object using its offset from the 1089 // Find a recently deserialized code object using its offset from the
1073 // current allocation point and write a pointer to it to the current 1090 // current allocation point and write a pointer to it to the current
1074 // object. Required only for MIPS or ARM with ool constant pool. 1091 // object. Required only for MIPS, PPC or ARM with ool constant pool.
1075 ALL_SPACES(kBackref, kFromCode, kStartOfObject) 1092 ALL_SPACES(kBackref, kFromCode, kStartOfObject)
1076 ALL_SPACES(kBackrefWithSkip, kFromCode, kStartOfObject) 1093 ALL_SPACES(kBackrefWithSkip, kFromCode, kStartOfObject)
1077 #endif 1094 #endif
1078 // Find a recently deserialized code object using its offset from the 1095 // Find a recently deserialized code object using its offset from the
1079 // current allocation point and write a pointer to its first instruction 1096 // current allocation point and write a pointer to its first instruction
1080 // to the current code object or the instruction pointer in a function 1097 // to the current code object or the instruction pointer in a function
1081 // object. 1098 // object.
1082 ALL_SPACES(kBackref, kFromCode, kInnerPointer) 1099 ALL_SPACES(kBackref, kFromCode, kInnerPointer)
1083 ALL_SPACES(kBackrefWithSkip, kFromCode, kInnerPointer) 1100 ALL_SPACES(kBackrefWithSkip, kFromCode, kInnerPointer)
1084 ALL_SPACES(kBackref, kPlain, kInnerPointer) 1101 ALL_SPACES(kBackref, kPlain, kInnerPointer)
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 return length; 1301 return length;
1285 } 1302 }
1286 1303
1287 1304
1288 int Serializer::RootIndex(HeapObject* heap_object, HowToCode from) { 1305 int Serializer::RootIndex(HeapObject* heap_object, HowToCode from) {
1289 Heap* heap = isolate()->heap(); 1306 Heap* heap = isolate()->heap();
1290 if (heap->InNewSpace(heap_object)) return kInvalidRootIndex; 1307 if (heap->InNewSpace(heap_object)) return kInvalidRootIndex;
1291 for (int i = 0; i < root_index_wave_front_; i++) { 1308 for (int i = 0; i < root_index_wave_front_; i++) {
1292 Object* root = heap->roots_array_start()[i]; 1309 Object* root = heap->roots_array_start()[i];
1293 if (!root->IsSmi() && root == heap_object) { 1310 if (!root->IsSmi() && root == heap_object) {
1294 #if defined(V8_TARGET_ARCH_MIPS) || V8_OOL_CONSTANT_POOL || \ 1311 #if defined(V8_TARGET_ARCH_MIPS) || defined(V8_TARGET_ARCH_MIPS64) || \
1295 defined(V8_TARGET_ARCH_MIPS64) 1312 defined(V8_TARGET_ARCH_PPC) || V8_OOL_CONSTANT_POOL
1296 if (from == kFromCode) { 1313 if (from == kFromCode) {
1297 // In order to avoid code bloat in the deserializer we don't have 1314 // In order to avoid code bloat in the deserializer we don't have
1298 // support for the encoding that specifies a particular root should 1315 // support for the encoding that specifies a particular root should
1299 // be written from within code. 1316 // be written from within code.
1300 return kInvalidRootIndex; 1317 return kInvalidRootIndex;
1301 } 1318 }
1302 #endif 1319 #endif
1303 return i; 1320 return i;
1304 } 1321 }
1305 } 1322 }
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
1945 1962
1946 int SerializedCodeData::CheckSum(String* string) { 1963 int SerializedCodeData::CheckSum(String* string) {
1947 int checksum = Version::Hash(); 1964 int checksum = Version::Hash();
1948 #ifdef DEBUG 1965 #ifdef DEBUG
1949 uint32_t seed = static_cast<uint32_t>(checksum); 1966 uint32_t seed = static_cast<uint32_t>(checksum);
1950 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed)); 1967 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed));
1951 #endif // DEBUG 1968 #endif // DEBUG
1952 return checksum; 1969 return checksum;
1953 } 1970 }
1954 } } // namespace v8::internal 1971 } } // namespace v8::internal
OLDNEW
« src/hydrogen-bch.cc ('K') | « src/sampler.cc ('k') | src/simulator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698