| 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 1999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2010 // There should be no hash table embedded. They would require rehashing. | 2010 // There should be no hash table embedded. They would require rehashing. |
| 2011 CHECK(!heap_object->IsHashTable()); | 2011 CHECK(!heap_object->IsHashTable()); |
| 2012 | 2012 |
| 2013 SerializeHeapObject(heap_object, how_to_code, where_to_point); | 2013 SerializeHeapObject(heap_object, how_to_code, where_to_point); |
| 2014 } | 2014 } |
| 2015 | 2015 |
| 2016 | 2016 |
| 2017 void CodeSerializer::SerializeHeapObject(HeapObject* heap_object, | 2017 void CodeSerializer::SerializeHeapObject(HeapObject* heap_object, |
| 2018 HowToCode how_to_code, | 2018 HowToCode how_to_code, |
| 2019 WhereToPoint where_to_point) { | 2019 WhereToPoint where_to_point) { |
| 2020 if (heap_object->IsScript()) { | |
| 2021 // The wrapper cache uses a Foreign object to point to a global handle. | |
| 2022 // However, the object visitor expects foreign objects to point to external | |
| 2023 // references. Clear the cache to avoid this issue. | |
| 2024 Script::cast(heap_object)->ClearWrapperCache(); | |
| 2025 } | |
| 2026 | |
| 2027 if (FLAG_trace_code_serializer) { | 2020 if (FLAG_trace_code_serializer) { |
| 2028 PrintF("Encoding heap object: "); | 2021 PrintF("Encoding heap object: "); |
| 2029 heap_object->ShortPrint(); | 2022 heap_object->ShortPrint(); |
| 2030 PrintF("\n"); | 2023 PrintF("\n"); |
| 2031 } | 2024 } |
| 2032 | 2025 |
| 2033 // Object has not yet been serialized. Serialize it here. | 2026 // Object has not yet been serialized. Serialize it here. |
| 2034 ObjectSerializer serializer(this, heap_object, sink_, how_to_code, | 2027 ObjectSerializer serializer(this, heap_object, sink_, how_to_code, |
| 2035 where_to_point); | 2028 where_to_point); |
| 2036 serializer.Serialize(); | 2029 serializer.Serialize(); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2189 | 2182 |
| 2190 int SerializedCodeData::CheckSum(String* string) { | 2183 int SerializedCodeData::CheckSum(String* string) { |
| 2191 int checksum = Version::Hash(); | 2184 int checksum = Version::Hash(); |
| 2192 #ifdef DEBUG | 2185 #ifdef DEBUG |
| 2193 uint32_t seed = static_cast<uint32_t>(checksum); | 2186 uint32_t seed = static_cast<uint32_t>(checksum); |
| 2194 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed)); | 2187 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed)); |
| 2195 #endif // DEBUG | 2188 #endif // DEBUG |
| 2196 return checksum; | 2189 return checksum; |
| 2197 } | 2190 } |
| 2198 } } // namespace v8::internal | 2191 } } // namespace v8::internal |
| OLD | NEW |