| 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" | |
| 11 #include "src/snapshot/deserializer.h" | 10 #include "src/snapshot/deserializer.h" |
| 12 #include "src/version.h" | 11 #include "src/version.h" |
| 13 | 12 |
| 14 namespace v8 { | 13 namespace v8 { |
| 15 namespace internal { | 14 namespace internal { |
| 16 | 15 |
| 17 ScriptData* CodeSerializer::Serialize(Isolate* isolate, | 16 ScriptData* CodeSerializer::Serialize(Isolate* isolate, |
| 18 Handle<SharedFunctionInfo> info, | 17 Handle<SharedFunctionInfo> info, |
| 19 Handle<String> source) { | 18 Handle<String> source) { |
| 20 base::ElapsedTimer timer; | 19 base::ElapsedTimer timer; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 return MaybeHandle<SharedFunctionInfo>(); | 177 return MaybeHandle<SharedFunctionInfo>(); |
| 179 } | 178 } |
| 180 | 179 |
| 181 if (FLAG_profile_deserialization) { | 180 if (FLAG_profile_deserialization) { |
| 182 double ms = timer.Elapsed().InMillisecondsF(); | 181 double ms = timer.Elapsed().InMillisecondsF(); |
| 183 int length = cached_data->length(); | 182 int length = cached_data->length(); |
| 184 PrintF("[Deserializing from %d bytes took %0.3f ms]\n", length, ms); | 183 PrintF("[Deserializing from %d bytes took %0.3f ms]\n", length, ms); |
| 185 } | 184 } |
| 186 result->set_deserialized(true); | 185 result->set_deserialized(true); |
| 187 | 186 |
| 188 if (isolate->logger()->is_logging_code_events() || | 187 if (isolate->logger()->is_logging_code_events() || isolate->is_profiling()) { |
| 189 isolate->cpu_profiler()->is_profiling()) { | |
| 190 String* name = isolate->heap()->empty_string(); | 188 String* name = isolate->heap()->empty_string(); |
| 191 if (result->script()->IsScript()) { | 189 if (result->script()->IsScript()) { |
| 192 Script* script = Script::cast(result->script()); | 190 Script* script = Script::cast(result->script()); |
| 193 if (script->name()->IsString()) name = String::cast(script->name()); | 191 if (script->name()->IsString()) name = String::cast(script->name()); |
| 194 } | 192 } |
| 195 isolate->logger()->CodeCreateEvent(Logger::SCRIPT_TAG, | 193 isolate->logger()->CodeCreateEvent(Logger::SCRIPT_TAG, |
| 196 result->abstract_code(), *result, name); | 194 result->abstract_code(), *result, name); |
| 197 } | 195 } |
| 198 return scope.CloseAndEscape(result); | 196 return scope.CloseAndEscape(result); |
| 199 } | 197 } |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 SanityCheckResult r = scd->SanityCheck(isolate, source); | 355 SanityCheckResult r = scd->SanityCheck(isolate, source); |
| 358 if (r == CHECK_SUCCESS) return scd; | 356 if (r == CHECK_SUCCESS) return scd; |
| 359 cached_data->Reject(); | 357 cached_data->Reject(); |
| 360 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 358 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
| 361 delete scd; | 359 delete scd; |
| 362 return NULL; | 360 return NULL; |
| 363 } | 361 } |
| 364 | 362 |
| 365 } // namespace internal | 363 } // namespace internal |
| 366 } // namespace v8 | 364 } // namespace v8 |
| OLD | NEW |