OLD | NEW |
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 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 // to the current code object or the instruction pointer in a function | 1080 // to the current code object or the instruction pointer in a function |
1081 // object. | 1081 // object. |
1082 ALL_SPACES(kBackref, kFromCode, kInnerPointer) | 1082 ALL_SPACES(kBackref, kFromCode, kInnerPointer) |
1083 ALL_SPACES(kBackrefWithSkip, kFromCode, kInnerPointer) | 1083 ALL_SPACES(kBackrefWithSkip, kFromCode, kInnerPointer) |
1084 ALL_SPACES(kBackref, kPlain, kInnerPointer) | 1084 ALL_SPACES(kBackref, kPlain, kInnerPointer) |
1085 ALL_SPACES(kBackrefWithSkip, kPlain, kInnerPointer) | 1085 ALL_SPACES(kBackrefWithSkip, kPlain, kInnerPointer) |
1086 // Find an object in the roots array and write a pointer to it to the | 1086 // Find an object in the roots array and write a pointer to it to the |
1087 // current object. | 1087 // current object. |
1088 CASE_STATEMENT(kRootArray, kPlain, kStartOfObject, 0) | 1088 CASE_STATEMENT(kRootArray, kPlain, kStartOfObject, 0) |
1089 CASE_BODY(kRootArray, kPlain, kStartOfObject, 0) | 1089 CASE_BODY(kRootArray, kPlain, kStartOfObject, 0) |
1090 #if V8_OOL_CONSTANT_POOL | 1090 #if defined(V8_TARGET_ARCH_MIPS) || V8_OOL_CONSTANT_POOL || \ |
| 1091 defined(V8_TARGET_ARCH_MIPS64) |
1091 // Find an object in the roots array and write a pointer to it to in code. | 1092 // Find an object in the roots array and write a pointer to it to in code. |
1092 CASE_STATEMENT(kRootArray, kFromCode, kStartOfObject, 0) | 1093 CASE_STATEMENT(kRootArray, kFromCode, kStartOfObject, 0) |
1093 CASE_BODY(kRootArray, kFromCode, kStartOfObject, 0) | 1094 CASE_BODY(kRootArray, kFromCode, kStartOfObject, 0) |
1094 #endif | 1095 #endif |
1095 // Find an object in the partial snapshots cache and write a pointer to it | 1096 // Find an object in the partial snapshots cache and write a pointer to it |
1096 // to the current object. | 1097 // to the current object. |
1097 CASE_STATEMENT(kPartialSnapshotCache, kPlain, kStartOfObject, 0) | 1098 CASE_STATEMENT(kPartialSnapshotCache, kPlain, kStartOfObject, 0) |
1098 CASE_BODY(kPartialSnapshotCache, | 1099 CASE_BODY(kPartialSnapshotCache, |
1099 kPlain, | 1100 kPlain, |
1100 kStartOfObject, | 1101 kStartOfObject, |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1295 return length; | 1296 return length; |
1296 } | 1297 } |
1297 | 1298 |
1298 | 1299 |
1299 int Serializer::RootIndex(HeapObject* heap_object, HowToCode from) { | 1300 int Serializer::RootIndex(HeapObject* heap_object, HowToCode from) { |
1300 Heap* heap = isolate()->heap(); | 1301 Heap* heap = isolate()->heap(); |
1301 if (heap->InNewSpace(heap_object)) return kInvalidRootIndex; | 1302 if (heap->InNewSpace(heap_object)) return kInvalidRootIndex; |
1302 for (int i = 0; i < root_index_wave_front_; i++) { | 1303 for (int i = 0; i < root_index_wave_front_; i++) { |
1303 Object* root = heap->roots_array_start()[i]; | 1304 Object* root = heap->roots_array_start()[i]; |
1304 if (!root->IsSmi() && root == heap_object) { | 1305 if (!root->IsSmi() && root == heap_object) { |
1305 #if defined(V8_TARGET_ARCH_MIPS) || defined(V8_TARGET_ARCH_MIPS64) | |
1306 if (from == kFromCode) { | |
1307 // In order to avoid code bloat in the deserializer we don't have | |
1308 // support for the encoding that specifies a particular root should | |
1309 // be written from within code. | |
1310 return kInvalidRootIndex; | |
1311 } | |
1312 #endif | |
1313 return i; | 1306 return i; |
1314 } | 1307 } |
1315 } | 1308 } |
1316 return kInvalidRootIndex; | 1309 return kInvalidRootIndex; |
1317 } | 1310 } |
1318 | 1311 |
1319 | 1312 |
1320 // Encode the location of an already deserialized object in order to write its | 1313 // Encode the location of an already deserialized object in order to write its |
1321 // location into a later object. We can encode the location as an offset from | 1314 // location into a later object. We can encode the location as an offset from |
1322 // the start of the deserialized objects or as an offset backwards from the | 1315 // the start of the deserialized objects or as an offset backwards from the |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1956 | 1949 |
1957 int SerializedCodeData::CheckSum(String* string) { | 1950 int SerializedCodeData::CheckSum(String* string) { |
1958 int checksum = Version::Hash(); | 1951 int checksum = Version::Hash(); |
1959 #ifdef DEBUG | 1952 #ifdef DEBUG |
1960 uint32_t seed = static_cast<uint32_t>(checksum); | 1953 uint32_t seed = static_cast<uint32_t>(checksum); |
1961 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed)); | 1954 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed)); |
1962 #endif // DEBUG | 1955 #endif // DEBUG |
1963 return checksum; | 1956 return checksum; |
1964 } | 1957 } |
1965 } } // namespace v8::internal | 1958 } } // namespace v8::internal |
OLD | NEW |