OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/snapshot/code-serializer.h" | 5 #include "src/snapshot/code-serializer.h" |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/log.h" | 8 #include "src/log.h" |
9 #include "src/macro-assembler.h" | 9 #include "src/macro-assembler.h" |
10 #include "src/profiler/cpu-profiler.h" | 10 #include "src/profiler/cpu-profiler.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 if (builtin == ic) { | 170 if (builtin == ic) { |
171 if (FLAG_trace_serializer) { | 171 if (FLAG_trace_serializer) { |
172 PrintF(" %s is a builtin\n", Code::Kind2String(ic->kind())); | 172 PrintF(" %s is a builtin\n", Code::Kind2String(ic->kind())); |
173 } | 173 } |
174 DCHECK(ic->kind() == Code::KEYED_LOAD_IC || | 174 DCHECK(ic->kind() == Code::KEYED_LOAD_IC || |
175 ic->kind() == Code::KEYED_STORE_IC); | 175 ic->kind() == Code::KEYED_STORE_IC); |
176 SerializeBuiltin(builtin_index, how_to_code, where_to_point); | 176 SerializeBuiltin(builtin_index, how_to_code, where_to_point); |
177 return; | 177 return; |
178 } | 178 } |
179 } | 179 } |
180 UNREACHABLE(); | 180 // The IC may also just be a piece of code kept in the non_monomorphic_cache. |
| 181 // In that case, just serialize as a normal code object. |
| 182 if (FLAG_trace_serializer) { |
| 183 PrintF(" %s has no special handling\n", Code::Kind2String(ic->kind())); |
| 184 } |
| 185 DCHECK(ic->kind() == Code::LOAD_IC || ic->kind() == Code::STORE_IC); |
| 186 SerializeGeneric(ic, how_to_code, where_to_point); |
181 } | 187 } |
182 | 188 |
183 int CodeSerializer::AddCodeStubKey(uint32_t stub_key) { | 189 int CodeSerializer::AddCodeStubKey(uint32_t stub_key) { |
184 // TODO(yangguo) Maybe we need a hash table for a faster lookup than O(n^2). | 190 // TODO(yangguo) Maybe we need a hash table for a faster lookup than O(n^2). |
185 int index = 0; | 191 int index = 0; |
186 while (index < stub_keys_.length()) { | 192 while (index < stub_keys_.length()) { |
187 if (stub_keys_[index] == stub_key) return index; | 193 if (stub_keys_[index] == stub_key) return index; |
188 index++; | 194 index++; |
189 } | 195 } |
190 stub_keys_.Add(stub_key); | 196 stub_keys_.Add(stub_key); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 SanityCheckResult r = scd->SanityCheck(isolate, source); | 412 SanityCheckResult r = scd->SanityCheck(isolate, source); |
407 if (r == CHECK_SUCCESS) return scd; | 413 if (r == CHECK_SUCCESS) return scd; |
408 cached_data->Reject(); | 414 cached_data->Reject(); |
409 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 415 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
410 delete scd; | 416 delete scd; |
411 return NULL; | 417 return NULL; |
412 } | 418 } |
413 | 419 |
414 } // namespace internal | 420 } // namespace internal |
415 } // namespace v8 | 421 } // namespace v8 |
OLD | NEW |