| 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 // The IC may also just be a piece of code kept in the non_monomorphic_cache. | 180 UNREACHABLE(); |
| 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); | |
| 187 } | 181 } |
| 188 | 182 |
| 189 int CodeSerializer::AddCodeStubKey(uint32_t stub_key) { | 183 int CodeSerializer::AddCodeStubKey(uint32_t stub_key) { |
| 190 // TODO(yangguo) Maybe we need a hash table for a faster lookup than O(n^2). | 184 // TODO(yangguo) Maybe we need a hash table for a faster lookup than O(n^2). |
| 191 int index = 0; | 185 int index = 0; |
| 192 while (index < stub_keys_.length()) { | 186 while (index < stub_keys_.length()) { |
| 193 if (stub_keys_[index] == stub_key) return index; | 187 if (stub_keys_[index] == stub_key) return index; |
| 194 index++; | 188 index++; |
| 195 } | 189 } |
| 196 stub_keys_.Add(stub_key); | 190 stub_keys_.Add(stub_key); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 SanityCheckResult r = scd->SanityCheck(isolate, source); | 406 SanityCheckResult r = scd->SanityCheck(isolate, source); |
| 413 if (r == CHECK_SUCCESS) return scd; | 407 if (r == CHECK_SUCCESS) return scd; |
| 414 cached_data->Reject(); | 408 cached_data->Reject(); |
| 415 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 409 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
| 416 delete scd; | 410 delete scd; |
| 417 return NULL; | 411 return NULL; |
| 418 } | 412 } |
| 419 | 413 |
| 420 } // namespace internal | 414 } // namespace internal |
| 421 } // namespace v8 | 415 } // namespace v8 |
| OLD | NEW |