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

Side by Side Diff: src/serialize.cc

Issue 406253004: Do not reverse lookup code stubs dictionary to find stub key. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 Handle<String> source) { 2016 Handle<String> source) {
2010 base::ElapsedTimer timer; 2017 base::ElapsedTimer timer;
2011 if (FLAG_profile_deserialization) timer.Start(); 2018 if (FLAG_profile_deserialization) timer.Start();
2012 SerializedCodeData scd(data, *source); 2019 SerializedCodeData scd(data, *source);
2013 SnapshotByteSource payload(scd.Payload(), scd.PayloadLength()); 2020 SnapshotByteSource payload(scd.Payload(), scd.PayloadLength());
2014 Deserializer deserializer(&payload); 2021 Deserializer deserializer(&payload);
2015 STATIC_ASSERT(NEW_SPACE == 0); 2022 STATIC_ASSERT(NEW_SPACE == 0);
2016 for (int i = NEW_SPACE; i <= PROPERTY_CELL_SPACE; i++) { 2023 for (int i = NEW_SPACE; i <= PROPERTY_CELL_SPACE; i++) {
2017 deserializer.set_reservation(i, scd.GetReservation(i)); 2024 deserializer.set_reservation(i, scd.GetReservation(i));
2018 } 2025 }
2019 DisallowHeapAllocation no_gc;
2020 2026
2021 // Prepare and register list of attached objects. 2027 // Prepare and register list of attached objects.
2022 Vector<Object*> attached_objects = Vector<Object*>::New(1); 2028 Vector<Object*> attached_objects = Vector<Object*>::New(1);
2023 attached_objects[kSourceObjectIndex] = *source; 2029 attached_objects[kSourceObjectIndex] = *source;
2024 deserializer.SetAttachedObjects(&attached_objects); 2030 deserializer.SetAttachedObjects(&attached_objects);
2025 2031
2026 Object* root; 2032 Object* root;
2027 deserializer.DeserializePartial(isolate, &root); 2033 deserializer.DeserializePartial(isolate, &root);
2028 deserializer.FlushICacheForNewCodeObjects(); 2034 deserializer.FlushICacheForNewCodeObjects();
2029 if (FLAG_profile_deserialization) { 2035 if (FLAG_profile_deserialization) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2061 2067
2062 int SerializedCodeData::CheckSum(String* string) { 2068 int SerializedCodeData::CheckSum(String* string) {
2063 int checksum = Version::Hash(); 2069 int checksum = Version::Hash();
2064 #ifdef DEBUG 2070 #ifdef DEBUG
2065 uint32_t seed = static_cast<uint32_t>(checksum); 2071 uint32_t seed = static_cast<uint32_t>(checksum);
2066 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed)); 2072 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed));
2067 #endif // DEBUG 2073 #endif // DEBUG
2068 return checksum; 2074 return checksum;
2069 } 2075 }
2070 } } // namespace v8::internal 2076 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698