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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/counters.h" | 10 #include "src/counters.h" |
11 #include "src/log.h" | 11 #include "src/log.h" |
12 #include "src/macro-assembler.h" | 12 #include "src/macro-assembler.h" |
13 #include "src/objects-inl.h" | 13 #include "src/objects-inl.h" |
14 #include "src/snapshot/deserializer.h" | 14 #include "src/snapshot/deserializer.h" |
15 #include "src/snapshot/snapshot.h" | 15 #include "src/snapshot/snapshot.h" |
16 #include "src/version.h" | 16 #include "src/version.h" |
| 17 #include "src/visitors.h" |
17 #include "src/wasm/wasm-module.h" | 18 #include "src/wasm/wasm-module.h" |
18 #include "src/wasm/wasm-objects.h" | 19 #include "src/wasm/wasm-objects.h" |
19 | 20 |
20 namespace v8 { | 21 namespace v8 { |
21 namespace internal { | 22 namespace internal { |
22 | 23 |
23 ScriptData* CodeSerializer::Serialize(Isolate* isolate, | 24 ScriptData* CodeSerializer::Serialize(Isolate* isolate, |
24 Handle<SharedFunctionInfo> info, | 25 Handle<SharedFunctionInfo> info, |
25 Handle<String> source) { | 26 Handle<String> source) { |
26 base::ElapsedTimer timer; | 27 base::ElapsedTimer timer; |
(...skipping 16 matching lines...) Expand all Loading... |
43 int length = ret->length(); | 44 int length = ret->length(); |
44 PrintF("[Serializing to %d bytes took %0.3f ms]\n", length, ms); | 45 PrintF("[Serializing to %d bytes took %0.3f ms]\n", length, ms); |
45 } | 46 } |
46 | 47 |
47 return ret; | 48 return ret; |
48 } | 49 } |
49 | 50 |
50 ScriptData* CodeSerializer::Serialize(Handle<HeapObject> obj) { | 51 ScriptData* CodeSerializer::Serialize(Handle<HeapObject> obj) { |
51 DisallowHeapAllocation no_gc; | 52 DisallowHeapAllocation no_gc; |
52 | 53 |
53 VisitPointer(Handle<Object>::cast(obj).location()); | 54 VisitRootPointer(Root::kHandleScope, Handle<Object>::cast(obj).location()); |
54 SerializeDeferredObjects(); | 55 SerializeDeferredObjects(); |
55 Pad(); | 56 Pad(); |
56 | 57 |
57 SerializedCodeData data(sink()->data(), this); | 58 SerializedCodeData data(sink()->data(), this); |
58 | 59 |
59 return data.GetScriptData(); | 60 return data.GetScriptData(); |
60 } | 61 } |
61 | 62 |
62 void CodeSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code, | 63 void CodeSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code, |
63 WhereToPoint where_to_point, int skip) { | 64 WhereToPoint where_to_point, int skip) { |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 *rejection_result = scd.SanityCheck(isolate, expected_source_hash); | 494 *rejection_result = scd.SanityCheck(isolate, expected_source_hash); |
494 if (*rejection_result != CHECK_SUCCESS) { | 495 if (*rejection_result != CHECK_SUCCESS) { |
495 cached_data->Reject(); | 496 cached_data->Reject(); |
496 return SerializedCodeData(nullptr, 0); | 497 return SerializedCodeData(nullptr, 0); |
497 } | 498 } |
498 return scd; | 499 return scd; |
499 } | 500 } |
500 | 501 |
501 } // namespace internal | 502 } // namespace internal |
502 } // namespace v8 | 503 } // namespace v8 |
OLD | NEW |