| 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 #ifndef V8_SNAPSHOT_CODE_SERIALIZER_H_ | 5 #ifndef V8_SNAPSHOT_CODE_SERIALIZER_H_ |
| 6 #define V8_SNAPSHOT_CODE_SERIALIZER_H_ | 6 #define V8_SNAPSHOT_CODE_SERIALIZER_H_ |
| 7 | 7 |
| 8 #include "src/parsing/preparse-data.h" | 8 #include "src/parsing/preparse-data.h" |
| 9 #include "src/snapshot/serializer.h" | 9 #include "src/snapshot/serializer.h" |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 DisallowHeapAllocation no_gc_; | 52 DisallowHeapAllocation no_gc_; |
| 53 uint32_t source_hash_; | 53 uint32_t source_hash_; |
| 54 List<uint32_t> stub_keys_; | 54 List<uint32_t> stub_keys_; |
| 55 DISALLOW_COPY_AND_ASSIGN(CodeSerializer); | 55 DISALLOW_COPY_AND_ASSIGN(CodeSerializer); |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 class WasmCompiledModuleSerializer : public CodeSerializer { | 58 class WasmCompiledModuleSerializer : public CodeSerializer { |
| 59 public: | 59 public: |
| 60 static std::unique_ptr<ScriptData> SerializeWasmModule( | 60 static std::unique_ptr<ScriptData> SerializeWasmModule( |
| 61 Isolate* isolate, Handle<FixedArray> compiled_module); | 61 Isolate* isolate, Handle<FixedArray> compiled_module); |
| 62 static MaybeHandle<FixedArray> DeserializeWasmModule(Isolate* isolate, | 62 static MaybeHandle<FixedArray> DeserializeWasmModule( |
| 63 ScriptData* data); | 63 Isolate* isolate, ScriptData* data, Vector<const byte> wire_bytes); |
| 64 | 64 |
| 65 protected: | 65 protected: |
| 66 void SerializeCodeObject(Code* code_object, HowToCode how_to_code, | 66 void SerializeCodeObject(Code* code_object, HowToCode how_to_code, |
| 67 WhereToPoint where_to_point) override { | 67 WhereToPoint where_to_point) override { |
| 68 Code::Kind kind = code_object->kind(); | 68 Code::Kind kind = code_object->kind(); |
| 69 if (kind == Code::WASM_FUNCTION || kind == Code::WASM_TO_JS_FUNCTION || | 69 if (kind == Code::WASM_FUNCTION || kind == Code::WASM_TO_JS_FUNCTION || |
| 70 kind == Code::JS_TO_WASM_FUNCTION) { | 70 kind == Code::JS_TO_WASM_FUNCTION) { |
| 71 SerializeGeneric(code_object, how_to_code, where_to_point); | 71 SerializeGeneric(code_object, how_to_code, where_to_point); |
| 72 } else { | 72 } else { |
| 73 UNREACHABLE(); | 73 UNREACHABLE(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 151 } |
| 152 | 152 |
| 153 SanityCheckResult SanityCheck(Isolate* isolate, | 153 SanityCheckResult SanityCheck(Isolate* isolate, |
| 154 uint32_t expected_source_hash) const; | 154 uint32_t expected_source_hash) const; |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 } // namespace internal | 157 } // namespace internal |
| 158 } // namespace v8 | 158 } // namespace v8 |
| 159 | 159 |
| 160 #endif // V8_SNAPSHOT_CODE_SERIALIZER_H_ | 160 #endif // V8_SNAPSHOT_CODE_SERIALIZER_H_ |
| OLD | NEW |