Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: src/snapshot/code-serializer.h

Issue 2305903002: [wasm] reuse the first compiled module (Closed)
Patch Set: GC before cloning Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/runtime/runtime-wasm.cc ('k') | src/snapshot/code-serializer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 18 matching lines...) Expand all
29 protected: 29 protected:
30 explicit CodeSerializer(Isolate* isolate, uint32_t source_hash) 30 explicit CodeSerializer(Isolate* isolate, uint32_t source_hash)
31 : Serializer(isolate), source_hash_(source_hash) {} 31 : Serializer(isolate), source_hash_(source_hash) {}
32 ~CodeSerializer() override { OutputStatistics("CodeSerializer"); } 32 ~CodeSerializer() override { OutputStatistics("CodeSerializer"); }
33 33
34 virtual void SerializeCodeObject(Code* code_object, HowToCode how_to_code, 34 virtual void SerializeCodeObject(Code* code_object, HowToCode how_to_code,
35 WhereToPoint where_to_point) { 35 WhereToPoint where_to_point) {
36 UNREACHABLE(); 36 UNREACHABLE();
37 } 37 }
38 38
39 virtual bool ElideObject(Object* obj) { return false; }
39 void SerializeGeneric(HeapObject* heap_object, HowToCode how_to_code, 40 void SerializeGeneric(HeapObject* heap_object, HowToCode how_to_code,
40 WhereToPoint where_to_point); 41 WhereToPoint where_to_point);
41 42
42 private: 43 private:
43 void SerializeObject(HeapObject* o, HowToCode how_to_code, 44 void SerializeObject(HeapObject* o, HowToCode how_to_code,
44 WhereToPoint where_to_point, int skip) override; 45 WhereToPoint where_to_point, int skip) override;
45 46
46 void SerializeBuiltin(int builtin_index, HowToCode how_to_code, 47 void SerializeBuiltin(int builtin_index, HowToCode how_to_code,
47 WhereToPoint where_to_point); 48 WhereToPoint where_to_point);
48 void SerializeCodeStub(Code* code_stub, HowToCode how_to_code, 49 void SerializeCodeStub(Code* code_stub, HowToCode how_to_code,
(...skipping 17 matching lines...) Expand all
66 WhereToPoint where_to_point) override { 67 WhereToPoint where_to_point) override {
67 Code::Kind kind = code_object->kind(); 68 Code::Kind kind = code_object->kind();
68 if (kind == Code::WASM_FUNCTION || kind == Code::WASM_TO_JS_FUNCTION || 69 if (kind == Code::WASM_FUNCTION || kind == Code::WASM_TO_JS_FUNCTION ||
69 kind == Code::JS_TO_WASM_FUNCTION) { 70 kind == Code::JS_TO_WASM_FUNCTION) {
70 SerializeGeneric(code_object, how_to_code, where_to_point); 71 SerializeGeneric(code_object, how_to_code, where_to_point);
71 } else { 72 } else {
72 UNREACHABLE(); 73 UNREACHABLE();
73 } 74 }
74 } 75 }
75 76
77 bool ElideObject(Object* obj) override { return obj->IsWeakCell(); };
78
76 private: 79 private:
77 WasmCompiledModuleSerializer(Isolate* isolate, uint32_t source_hash) 80 WasmCompiledModuleSerializer(Isolate* isolate, uint32_t source_hash)
78 : CodeSerializer(isolate, source_hash) {} 81 : CodeSerializer(isolate, source_hash) {}
79 DISALLOW_COPY_AND_ASSIGN(WasmCompiledModuleSerializer); 82 DISALLOW_COPY_AND_ASSIGN(WasmCompiledModuleSerializer);
80 }; 83 };
81 84
82 // Wrapper around ScriptData to provide code-serializer-specific functionality. 85 // Wrapper around ScriptData to provide code-serializer-specific functionality.
83 class SerializedCodeData : public SerializedData { 86 class SerializedCodeData : public SerializedData {
84 public: 87 public:
85 enum SanityCheckResult { 88 enum SanityCheckResult {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size; 147 static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size;
145 static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size; 148 static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size;
146 static const int kChecksum2Offset = kChecksum1Offset + kInt32Size; 149 static const int kChecksum2Offset = kChecksum1Offset + kInt32Size;
147 static const int kHeaderSize = kChecksum2Offset + kInt32Size; 150 static const int kHeaderSize = kChecksum2Offset + kInt32Size;
148 }; 151 };
149 152
150 } // namespace internal 153 } // namespace internal
151 } // namespace v8 154 } // namespace v8
152 155
153 #endif // V8_SNAPSHOT_CODE_SERIALIZER_H_ 156 #endif // V8_SNAPSHOT_CODE_SERIALIZER_H_
OLDNEW
« no previous file with comments | « src/runtime/runtime-wasm.cc ('k') | src/snapshot/code-serializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698