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 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1955 return; | 1955 return; |
1956 } | 1956 } |
1957 // TODO(yangguo) figure out whether other code kinds can be handled smarter. | 1957 // TODO(yangguo) figure out whether other code kinds can be handled smarter. |
1958 } | 1958 } |
1959 | 1959 |
1960 if (heap_object == source_) { | 1960 if (heap_object == source_) { |
1961 SerializeSourceObject(how_to_code, where_to_point, skip); | 1961 SerializeSourceObject(how_to_code, where_to_point, skip); |
1962 return; | 1962 return; |
1963 } | 1963 } |
1964 | 1964 |
| 1965 if (heap_object->IsScript()) { |
| 1966 // The wrapper cache uses a Foreign object to point to a global handle. |
| 1967 // However, the object visitor expects foreign objects to point to external |
| 1968 // references. Clear the cache to avoid this issue. |
| 1969 Script::cast(heap_object)->ClearWrapperCache(); |
| 1970 } |
| 1971 |
1965 if (skip != 0) { | 1972 if (skip != 0) { |
1966 sink_->Put(kSkip, "SkipFromSerializeObject"); | 1973 sink_->Put(kSkip, "SkipFromSerializeObject"); |
1967 sink_->PutInt(skip, "SkipDistanceFromSerializeObject"); | 1974 sink_->PutInt(skip, "SkipDistanceFromSerializeObject"); |
1968 } | 1975 } |
1969 // Object has not yet been serialized. Serialize it here. | 1976 // Object has not yet been serialized. Serialize it here. |
1970 ObjectSerializer serializer(this, heap_object, sink_, how_to_code, | 1977 ObjectSerializer serializer(this, heap_object, sink_, how_to_code, |
1971 where_to_point); | 1978 where_to_point); |
1972 serializer.Serialize(); | 1979 serializer.Serialize(); |
1973 } | 1980 } |
1974 | 1981 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2061 | 2068 |
2062 int SerializedCodeData::CheckSum(String* string) { | 2069 int SerializedCodeData::CheckSum(String* string) { |
2063 int checksum = Version::Hash(); | 2070 int checksum = Version::Hash(); |
2064 #ifdef DEBUG | 2071 #ifdef DEBUG |
2065 uint32_t seed = static_cast<uint32_t>(checksum); | 2072 uint32_t seed = static_cast<uint32_t>(checksum); |
2066 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed)); | 2073 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed)); |
2067 #endif // DEBUG | 2074 #endif // DEBUG |
2068 return checksum; | 2075 return checksum; |
2069 } | 2076 } |
2070 } } // namespace v8::internal | 2077 } } // namespace v8::internal |
OLD | NEW |