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 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1177 // Find an external reference and write a pointer to it in the current | 1177 // Find an external reference and write a pointer to it in the current |
1178 // code object. | 1178 // code object. |
1179 CASE_STATEMENT(kExternalReference, kFromCode, kStartOfObject, 0) | 1179 CASE_STATEMENT(kExternalReference, kFromCode, kStartOfObject, 0) |
1180 CASE_BODY(kExternalReference, | 1180 CASE_BODY(kExternalReference, |
1181 kFromCode, | 1181 kFromCode, |
1182 kStartOfObject, | 1182 kStartOfObject, |
1183 0) | 1183 0) |
1184 // Find a builtin and write a pointer to it to the current object. | 1184 // Find a builtin and write a pointer to it to the current object. |
1185 CASE_STATEMENT(kBuiltin, kPlain, kStartOfObject, 0) | 1185 CASE_STATEMENT(kBuiltin, kPlain, kStartOfObject, 0) |
1186 CASE_BODY(kBuiltin, kPlain, kStartOfObject, 0) | 1186 CASE_BODY(kBuiltin, kPlain, kStartOfObject, 0) |
1187 #if V8_OOL_CONSTANT_POOL | |
1188 // Find a builtin code entry and write a pointer to it to the current | |
1189 // object. | |
1190 CASE_STATEMENT(kBuiltin, kPlain, kInnerPointer, 0) | 1187 CASE_STATEMENT(kBuiltin, kPlain, kInnerPointer, 0) |
1191 CASE_BODY(kBuiltin, kPlain, kInnerPointer, 0) | 1188 CASE_BODY(kBuiltin, kPlain, kInnerPointer, 0) |
1192 #endif | |
1193 // Find a builtin and write a pointer to it in the current code object. | |
1194 CASE_STATEMENT(kBuiltin, kFromCode, kInnerPointer, 0) | 1189 CASE_STATEMENT(kBuiltin, kFromCode, kInnerPointer, 0) |
1195 CASE_BODY(kBuiltin, kFromCode, kInnerPointer, 0) | 1190 CASE_BODY(kBuiltin, kFromCode, kInnerPointer, 0) |
1196 // Find an object in the attached references and write a pointer to it to | 1191 // Find an object in the attached references and write a pointer to it to |
1197 // the current object. | 1192 // the current object. |
1198 CASE_STATEMENT(kAttachedReference, kPlain, kStartOfObject, 0) | 1193 CASE_STATEMENT(kAttachedReference, kPlain, kStartOfObject, 0) |
1199 CASE_BODY(kAttachedReference, kPlain, kStartOfObject, 0) | 1194 CASE_BODY(kAttachedReference, kPlain, kStartOfObject, 0) |
1200 CASE_STATEMENT(kAttachedReference, kPlain, kInnerPointer, 0) | 1195 CASE_STATEMENT(kAttachedReference, kPlain, kInnerPointer, 0) |
1201 CASE_BODY(kAttachedReference, kPlain, kInnerPointer, 0) | 1196 CASE_BODY(kAttachedReference, kPlain, kInnerPointer, 0) |
1202 CASE_STATEMENT(kAttachedReference, kFromCode, kInnerPointer, 0) | 1197 CASE_STATEMENT(kAttachedReference, kFromCode, kInnerPointer, 0) |
1203 CASE_BODY(kAttachedReference, kFromCode, kInnerPointer, 0) | 1198 CASE_BODY(kAttachedReference, kFromCode, kInnerPointer, 0) |
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1956 isolate_->InitializeLoggingAndCounters(); | 1951 isolate_->InitializeLoggingAndCounters(); |
1957 code_address_map_ = new CodeAddressMap(isolate_); | 1952 code_address_map_ = new CodeAddressMap(isolate_); |
1958 } | 1953 } |
1959 | 1954 |
1960 | 1955 |
1961 ScriptData* CodeSerializer::Serialize(Isolate* isolate, | 1956 ScriptData* CodeSerializer::Serialize(Isolate* isolate, |
1962 Handle<SharedFunctionInfo> info, | 1957 Handle<SharedFunctionInfo> info, |
1963 Handle<String> source) { | 1958 Handle<String> source) { |
1964 base::ElapsedTimer timer; | 1959 base::ElapsedTimer timer; |
1965 if (FLAG_profile_deserialization) timer.Start(); | 1960 if (FLAG_profile_deserialization) timer.Start(); |
1961 if (FLAG_serializer_trace_level) { | |
1962 PrintF("[Serializing from"); | |
1963 Object* script = info->script(); | |
1964 if (script->IsScript()) Script::cast(script)->name()->ShortPrint(); | |
1965 PrintF("]\n"); | |
1966 } | |
1966 | 1967 |
1967 // Serialize code object. | 1968 // Serialize code object. |
1968 List<byte> payload; | 1969 List<byte> payload; |
1969 ListSnapshotSink list_sink(&payload); | 1970 ListSnapshotSink list_sink(&payload); |
1970 DebugSnapshotSink debug_sink(&list_sink); | 1971 DebugSnapshotSink debug_sink(&list_sink); |
1971 SnapshotByteSink* sink = FLAG_trace_code_serializer | 1972 SnapshotByteSink* sink = FLAG_serializer_trace_level > 1 |
1972 ? static_cast<SnapshotByteSink*>(&debug_sink) | 1973 ? static_cast<SnapshotByteSink*>(&debug_sink) |
1973 : static_cast<SnapshotByteSink*>(&list_sink); | 1974 : static_cast<SnapshotByteSink*>(&list_sink); |
1974 CodeSerializer cs(isolate, sink, *source, info->code()); | 1975 CodeSerializer cs(isolate, sink, *source, info->code()); |
1975 DisallowHeapAllocation no_gc; | 1976 DisallowHeapAllocation no_gc; |
1976 Object** location = Handle<Object>::cast(info).location(); | 1977 Object** location = Handle<Object>::cast(info).location(); |
1977 cs.VisitPointer(location); | 1978 cs.VisitPointer(location); |
1978 cs.Pad(); | 1979 cs.Pad(); |
1979 cs.FinalizeAllocation(); | 1980 cs.FinalizeAllocation(); |
1980 | 1981 |
1981 SerializedCodeData data(&payload, &cs); | 1982 SerializedCodeData data(&payload, &cs); |
1982 ScriptData* script_data = data.GetScriptData(); | 1983 ScriptData* script_data = data.GetScriptData(); |
1983 | 1984 |
1984 if (FLAG_profile_deserialization) { | 1985 if (FLAG_profile_deserialization) { |
1985 double ms = timer.Elapsed().InMillisecondsF(); | 1986 double ms = timer.Elapsed().InMillisecondsF(); |
1986 int length = script_data->length(); | 1987 int length = script_data->length(); |
1987 PrintF("[Serializing to %d bytes took %0.3f ms]\n", length, ms); | 1988 PrintF("[Serializing to %d bytes took %0.3f ms]\n", length, ms); |
1988 } | 1989 } |
1989 | 1990 |
1990 return script_data; | 1991 return script_data; |
1991 } | 1992 } |
1992 | 1993 |
1993 | 1994 |
1994 void CodeSerializer::SerializeObject(Object* o, HowToCode how_to_code, | 1995 void CodeSerializer::SerializeObject(Object* o, HowToCode how_to_code, |
1995 WhereToPoint where_to_point, int skip) { | 1996 WhereToPoint where_to_point, int skip) { |
1996 HeapObject* heap_object = HeapObject::cast(o); | 1997 HeapObject* heap_object = HeapObject::cast(o); |
1997 | 1998 |
1998 int root_index; | 1999 int root_index; |
1999 if ((root_index = RootIndex(heap_object, how_to_code)) != kInvalidRootIndex) { | 2000 if ((root_index = RootIndex(heap_object, how_to_code)) != kInvalidRootIndex) { |
2001 if (FLAG_serializer_trace_level) PrintF(" Encoding root: %d\n", root_index); | |
2000 PutRoot(root_index, heap_object, how_to_code, where_to_point, skip); | 2002 PutRoot(root_index, heap_object, how_to_code, where_to_point, skip); |
2001 return; | 2003 return; |
2002 } | 2004 } |
2003 | 2005 |
2004 if (address_mapper_.IsMapped(heap_object)) { | 2006 if (address_mapper_.IsMapped(heap_object)) { |
2005 if (FLAG_trace_code_serializer) { | 2007 if (FLAG_serializer_trace_level) { |
2006 PrintF("Encoding back reference to: "); | 2008 PrintF(" Encoding back reference to: "); |
2007 heap_object->ShortPrint(); | 2009 heap_object->ShortPrint(); |
2008 PrintF("\n"); | 2010 PrintF("\n"); |
2009 } | 2011 } |
2010 SerializeReferenceToPreviousObject(heap_object, how_to_code, where_to_point, | 2012 SerializeReferenceToPreviousObject(heap_object, how_to_code, where_to_point, |
2011 skip); | 2013 skip); |
2012 return; | 2014 return; |
2013 } | 2015 } |
2014 | 2016 |
2015 if (skip != 0) { | 2017 if (skip != 0) { |
2016 sink_->Put(kSkip, "SkipFromSerializeObject"); | 2018 sink_->Put(kSkip, "SkipFromSerializeObject"); |
2017 sink_->PutInt(skip, "SkipDistanceFromSerializeObject"); | 2019 sink_->PutInt(skip, "SkipDistanceFromSerializeObject"); |
2018 } | 2020 } |
2019 | 2021 |
2020 if (heap_object->IsCode()) { | 2022 if (heap_object->IsCode()) { |
2021 Code* code_object = Code::cast(heap_object); | 2023 Code* code_object = Code::cast(heap_object); |
2022 switch (code_object->kind()) { | 2024 switch (code_object->kind()) { |
2023 case Code::OPTIMIZED_FUNCTION: // No optimized code compiled yet. | 2025 case Code::OPTIMIZED_FUNCTION: // No optimized code compiled yet. |
2024 case Code::HANDLER: // No handlers patched in yet. | 2026 case Code::HANDLER: // No handlers patched in yet. |
2025 case Code::REGEXP: // No regexp literals initialized yet. | 2027 case Code::REGEXP: // No regexp literals initialized yet. |
2026 case Code::NUMBER_OF_KINDS: // Pseudo enum value. | 2028 case Code::NUMBER_OF_KINDS: // Pseudo enum value. |
2027 CHECK(false); | 2029 CHECK(false); |
2028 case Code::BUILTIN: | 2030 case Code::BUILTIN: |
2029 SerializeBuiltin(code_object, how_to_code, where_to_point); | 2031 SerializeBuiltin(code_object->builtin_index(), how_to_code, |
2032 where_to_point); | |
2030 return; | 2033 return; |
2031 case Code::STUB: | 2034 case Code::STUB: |
2032 SerializeCodeStub(code_object, how_to_code, where_to_point); | 2035 SerializeCodeStub(code_object->stub_key(), how_to_code, where_to_point); |
2033 return; | 2036 return; |
2034 #define IC_KIND_CASE(KIND) case Code::KIND: | 2037 #define IC_KIND_CASE(KIND) case Code::KIND: |
2035 IC_KIND_LIST(IC_KIND_CASE) | 2038 IC_KIND_LIST(IC_KIND_CASE) |
2036 #undef IC_KIND_CASE | 2039 #undef IC_KIND_CASE |
2037 SerializeHeapObject(code_object, how_to_code, where_to_point); | 2040 SerializeIC(code_object, how_to_code, where_to_point); |
2038 return; | 2041 return; |
2039 // TODO(yangguo): add special handling to canonicalize ICs. | |
2040 case Code::FUNCTION: | 2042 case Code::FUNCTION: |
2041 // Only serialize the code for the toplevel function. Replace code | 2043 // Only serialize the code for the toplevel function. Replace code |
2042 // of included function literals by the lazy compile builtin. | 2044 // of included function literals by the lazy compile builtin. |
2043 // This is safe, as checked in Compiler::BuildFunctionInfo. | 2045 // This is safe, as checked in Compiler::BuildFunctionInfo. |
2044 if (code_object != main_code_) { | 2046 if (code_object != main_code_) { |
2045 Code* lazy = *isolate()->builtins()->CompileLazy(); | 2047 SerializeBuiltin(Builtins::kCompileLazy, how_to_code, where_to_point); |
2046 SerializeBuiltin(lazy, how_to_code, where_to_point); | |
2047 } else { | 2048 } else { |
2048 code_object->MakeYoung(); | 2049 code_object->MakeYoung(); |
2049 SerializeHeapObject(code_object, how_to_code, where_to_point); | 2050 SerializeHeapObject(code_object, how_to_code, where_to_point); |
2050 } | 2051 } |
2051 return; | 2052 return; |
2052 } | 2053 } |
2054 UNREACHABLE(); | |
2053 } | 2055 } |
2054 | 2056 |
2055 if (heap_object == source_) { | 2057 if (heap_object == source_) { |
2056 SerializeSourceObject(how_to_code, where_to_point); | 2058 SerializeSourceObject(how_to_code, where_to_point); |
2057 return; | 2059 return; |
2058 } | 2060 } |
2059 | 2061 |
2060 // Past this point we should not see any (context-specific) maps anymore. | 2062 // Past this point we should not see any (context-specific) maps anymore. |
2061 CHECK(!heap_object->IsMap()); | 2063 CHECK(!heap_object->IsMap()); |
2062 // There should be no references to the global object embedded. | 2064 // There should be no references to the global object embedded. |
2063 CHECK(!heap_object->IsJSGlobalProxy() && !heap_object->IsGlobalObject()); | 2065 CHECK(!heap_object->IsJSGlobalProxy() && !heap_object->IsGlobalObject()); |
2064 // There should be no hash table embedded. They would require rehashing. | 2066 // There should be no hash table embedded. They would require rehashing. |
2065 CHECK(!heap_object->IsHashTable()); | 2067 CHECK(!heap_object->IsHashTable()); |
2066 | 2068 |
2067 SerializeHeapObject(heap_object, how_to_code, where_to_point); | 2069 SerializeHeapObject(heap_object, how_to_code, where_to_point); |
2068 } | 2070 } |
2069 | 2071 |
2070 | 2072 |
2071 void CodeSerializer::SerializeHeapObject(HeapObject* heap_object, | 2073 void CodeSerializer::SerializeHeapObject(HeapObject* heap_object, |
2072 HowToCode how_to_code, | 2074 HowToCode how_to_code, |
2073 WhereToPoint where_to_point) { | 2075 WhereToPoint where_to_point) { |
2074 if (FLAG_trace_code_serializer) { | 2076 if (FLAG_serializer_trace_level) { |
2075 PrintF("Encoding heap object: "); | 2077 PrintF(" Encoding heap object: "); |
2076 heap_object->ShortPrint(); | 2078 heap_object->ShortPrint(); |
2077 PrintF("\n"); | 2079 PrintF("\n"); |
2078 } | 2080 } |
2079 | 2081 |
2080 // Object has not yet been serialized. Serialize it here. | 2082 // Object has not yet been serialized. Serialize it here. |
2081 ObjectSerializer serializer(this, heap_object, sink_, how_to_code, | 2083 ObjectSerializer serializer(this, heap_object, sink_, how_to_code, |
2082 where_to_point); | 2084 where_to_point); |
2083 serializer.Serialize(); | 2085 serializer.Serialize(); |
2084 } | 2086 } |
2085 | 2087 |
2086 | 2088 |
2087 void CodeSerializer::SerializeBuiltin(Code* builtin, HowToCode how_to_code, | 2089 void CodeSerializer::SerializeBuiltin(int builtin_index, HowToCode how_to_code, |
2088 WhereToPoint where_to_point) { | 2090 WhereToPoint where_to_point) { |
2089 DCHECK((how_to_code == kPlain && where_to_point == kStartOfObject) || | 2091 DCHECK((how_to_code == kPlain && where_to_point == kStartOfObject) || |
2090 (how_to_code == kPlain && where_to_point == kInnerPointer) || | 2092 (how_to_code == kPlain && where_to_point == kInnerPointer) || |
2091 (how_to_code == kFromCode && where_to_point == kInnerPointer)); | 2093 (how_to_code == kFromCode && where_to_point == kInnerPointer)); |
2092 int builtin_index = builtin->builtin_index(); | |
2093 DCHECK_LT(builtin_index, Builtins::builtin_count); | 2094 DCHECK_LT(builtin_index, Builtins::builtin_count); |
2094 DCHECK_LE(0, builtin_index); | 2095 DCHECK_LE(0, builtin_index); |
2095 | 2096 |
2096 if (FLAG_trace_code_serializer) { | 2097 if (FLAG_serializer_trace_level) { |
mvstanton
2014/10/17 16:16:38
nit: I like
if (FLAG_serializer_trace_level > 0)
| |
2097 PrintF("Encoding builtin: %s\n", | 2098 PrintF(" Encoding builtin: %s\n", |
2098 isolate()->builtins()->name(builtin_index)); | 2099 isolate()->builtins()->name(builtin_index)); |
2099 } | 2100 } |
2100 | 2101 |
2101 sink_->Put(kBuiltin + how_to_code + where_to_point, "Builtin"); | 2102 sink_->Put(kBuiltin + how_to_code + where_to_point, "Builtin"); |
2102 sink_->PutInt(builtin_index, "builtin_index"); | 2103 sink_->PutInt(builtin_index, "builtin_index"); |
2103 } | 2104 } |
2104 | 2105 |
2105 | 2106 |
2106 void CodeSerializer::SerializeCodeStub(Code* stub, HowToCode how_to_code, | 2107 void CodeSerializer::SerializeCodeStub(uint32_t stub_key, HowToCode how_to_code, |
2107 WhereToPoint where_to_point) { | 2108 WhereToPoint where_to_point) { |
2108 DCHECK((how_to_code == kPlain && where_to_point == kStartOfObject) || | 2109 DCHECK((how_to_code == kPlain && where_to_point == kStartOfObject) || |
2109 (how_to_code == kPlain && where_to_point == kInnerPointer) || | 2110 (how_to_code == kPlain && where_to_point == kInnerPointer) || |
2110 (how_to_code == kFromCode && where_to_point == kInnerPointer)); | 2111 (how_to_code == kFromCode && where_to_point == kInnerPointer)); |
2111 uint32_t stub_key = stub->stub_key(); | |
2112 DCHECK(CodeStub::MajorKeyFromKey(stub_key) != CodeStub::NoCache); | 2112 DCHECK(CodeStub::MajorKeyFromKey(stub_key) != CodeStub::NoCache); |
2113 DCHECK(!CodeStub::GetCode(isolate(), stub_key).is_null()); | 2113 DCHECK(!CodeStub::GetCode(isolate(), stub_key).is_null()); |
2114 | 2114 |
2115 int index = AddCodeStubKey(stub_key) + kCodeStubsBaseIndex; | 2115 int index = AddCodeStubKey(stub_key) + kCodeStubsBaseIndex; |
2116 | 2116 |
2117 if (FLAG_trace_code_serializer) { | 2117 if (FLAG_serializer_trace_level) { |
2118 PrintF("Encoding code stub %s as %d\n", | 2118 PrintF(" Encoding code stub %s as %d\n", |
2119 CodeStub::MajorName(CodeStub::MajorKeyFromKey(stub_key), false), | 2119 CodeStub::MajorName(CodeStub::MajorKeyFromKey(stub_key), false), |
2120 index); | 2120 index); |
2121 } | 2121 } |
2122 | 2122 |
2123 sink_->Put(kAttachedReference + how_to_code + where_to_point, "CodeStub"); | 2123 sink_->Put(kAttachedReference + how_to_code + where_to_point, "CodeStub"); |
2124 sink_->PutInt(index, "CodeStub key"); | 2124 sink_->PutInt(index, "CodeStub key"); |
2125 } | 2125 } |
2126 | 2126 |
2127 | 2127 |
2128 void CodeSerializer::SerializeIC(Code* ic, HowToCode how_to_code, | |
2129 WhereToPoint where_to_point) { | |
2130 // The IC may be implemented as a stub. | |
2131 uint32_t stub_key = ic->stub_key(); | |
2132 if (stub_key != CodeStub::NoCacheKey()) { | |
2133 if (FLAG_serializer_trace_level) { | |
2134 PrintF(" %s is a code stub\n", Code::Kind2String(ic->kind())); | |
2135 } | |
2136 SerializeCodeStub(stub_key, how_to_code, where_to_point); | |
2137 return; | |
2138 } | |
2139 // The IC may be implemented as builtin. Only real builtins have an | |
2140 // actual builtin_index value attached (otherwise it's just garbage). | |
2141 // Compare to make sure we are really dealing with a builtin. | |
2142 int builtin_index = ic->builtin_index(); | |
2143 if (builtin_index < Builtins::builtin_count) { | |
2144 Builtins::Name name = static_cast<Builtins::Name>(builtin_index); | |
2145 Code* builtin = isolate()->builtins()->builtin(name); | |
2146 if (builtin == ic) { | |
2147 if (FLAG_serializer_trace_level) { | |
2148 PrintF(" %s is a builtin\n", Code::Kind2String(ic->kind())); | |
2149 } | |
2150 DCHECK(ic->kind() == Code::KEYED_LOAD_IC || | |
2151 ic->kind() == Code::KEYED_STORE_IC); | |
2152 SerializeBuiltin(builtin_index, how_to_code, where_to_point); | |
2153 return; | |
2154 } | |
2155 } | |
2156 // The IC may also just be a piece of code kept in the non_monomorphic_cache. | |
2157 // In that case, just serialize as a normal code object. | |
2158 if (FLAG_serializer_trace_level) { | |
2159 PrintF(" %s has no special handling\n", Code::Kind2String(ic->kind())); | |
2160 } | |
2161 DCHECK(ic->kind() == Code::LOAD_IC || ic->kind() == Code::STORE_IC); | |
2162 SerializeHeapObject(ic, how_to_code, where_to_point); | |
2163 } | |
2164 | |
2165 | |
2128 int CodeSerializer::AddCodeStubKey(uint32_t stub_key) { | 2166 int CodeSerializer::AddCodeStubKey(uint32_t stub_key) { |
2129 // TODO(yangguo) Maybe we need a hash table for a faster lookup than O(n^2). | 2167 // TODO(yangguo) Maybe we need a hash table for a faster lookup than O(n^2). |
2130 int index = 0; | 2168 int index = 0; |
2131 while (index < stub_keys_.length()) { | 2169 while (index < stub_keys_.length()) { |
2132 if (stub_keys_[index] == stub_key) return index; | 2170 if (stub_keys_[index] == stub_key) return index; |
2133 index++; | 2171 index++; |
2134 } | 2172 } |
2135 stub_keys_.Add(stub_key); | 2173 stub_keys_.Add(stub_key); |
2136 return index; | 2174 return index; |
2137 } | 2175 } |
2138 | 2176 |
2139 | 2177 |
2140 void CodeSerializer::SerializeSourceObject(HowToCode how_to_code, | 2178 void CodeSerializer::SerializeSourceObject(HowToCode how_to_code, |
2141 WhereToPoint where_to_point) { | 2179 WhereToPoint where_to_point) { |
2142 if (FLAG_trace_code_serializer) PrintF("Encoding source object\n"); | 2180 if (FLAG_serializer_trace_level) PrintF(" Encoding source object\n"); |
2143 | 2181 |
2144 DCHECK(how_to_code == kPlain && where_to_point == kStartOfObject); | 2182 DCHECK(how_to_code == kPlain && where_to_point == kStartOfObject); |
2145 sink_->Put(kAttachedReference + how_to_code + where_to_point, "Source"); | 2183 sink_->Put(kAttachedReference + how_to_code + where_to_point, "Source"); |
2146 sink_->PutInt(kSourceObjectIndex, "kSourceObjectIndex"); | 2184 sink_->PutInt(kSourceObjectIndex, "kSourceObjectIndex"); |
2147 } | 2185 } |
2148 | 2186 |
2149 | 2187 |
2150 MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize( | 2188 MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize( |
2151 Isolate* isolate, ScriptData* data, Handle<String> source) { | 2189 Isolate* isolate, ScriptData* data, Handle<String> source) { |
2152 base::ElapsedTimer timer; | 2190 base::ElapsedTimer timer; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2263 | 2301 |
2264 int SerializedCodeData::CheckSum(String* string) { | 2302 int SerializedCodeData::CheckSum(String* string) { |
2265 int checksum = Version::Hash(); | 2303 int checksum = Version::Hash(); |
2266 #ifdef DEBUG | 2304 #ifdef DEBUG |
2267 uint32_t seed = static_cast<uint32_t>(checksum); | 2305 uint32_t seed = static_cast<uint32_t>(checksum); |
2268 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed)); | 2306 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed)); |
2269 #endif // DEBUG | 2307 #endif // DEBUG |
2270 return checksum; | 2308 return checksum; |
2271 } | 2309 } |
2272 } } // namespace v8::internal | 2310 } } // namespace v8::internal |
OLD | NEW |