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

Side by Side Diff: runtime/vm/stub_code.cc

Issue 2032153003: Use clustered serialization for full snapshots. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: round2 Created 4 years, 5 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 | « runtime/vm/stub_code.h ('k') | runtime/vm/symbols.h » ('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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/stub_code.h" 5 #include "vm/stub_code.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "platform/globals.h" 8 #include "platform/globals.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/disassembler.h" 10 #include "vm/disassembler.h"
11 #include "vm/flags.h" 11 #include "vm/flags.h"
12 #include "vm/object_store.h" 12 #include "vm/object_store.h"
13 #include "vm/safepoint.h" 13 #include "vm/safepoint.h"
14 #include "vm/snapshot.h" 14 #include "vm/snapshot.h"
15 #include "vm/virtual_memory.h" 15 #include "vm/virtual_memory.h"
16 #include "vm/visitor.h" 16 #include "vm/visitor.h"
17 #include "vm/clustered_snapshot.h"
17 18
18 namespace dart { 19 namespace dart {
19 20
20 DEFINE_FLAG(bool, disassemble_stubs, false, "Disassemble generated stubs."); 21 DEFINE_FLAG(bool, disassemble_stubs, false, "Disassemble generated stubs.");
21 22
22 #define STUB_CODE_DECLARE(name) \ 23 #define STUB_CODE_DECLARE(name) \
23 StubEntry* StubCode::name##_entry_ = NULL; 24 StubEntry* StubCode::name##_entry_ = NULL;
24 VM_STUB_CODE_LIST(STUB_CODE_DECLARE); 25 VM_STUB_CODE_LIST(STUB_CODE_DECLARE);
25 #undef STUB_CODE_DECLARE 26 #undef STUB_CODE_DECLARE
26 27
(...skipping 25 matching lines...) Expand all
52 VM_STUB_CODE_LIST(STUB_CODE_GENERATE); 53 VM_STUB_CODE_LIST(STUB_CODE_GENERATE);
53 #else 54 #else
54 UNREACHABLE(); 55 UNREACHABLE();
55 #endif // DART_PRECOMPILED_RUNTIME 56 #endif // DART_PRECOMPILED_RUNTIME
56 } 57 }
57 58
58 59
59 #undef STUB_CODE_GENERATE 60 #undef STUB_CODE_GENERATE
60 61
61 62
62 void StubCode::ReadFrom(SnapshotReader* reader) { 63 void StubCode::Push(Serializer* serializer) {
63 #define READ_STUB(name) \
64 *(reader->CodeHandle()) ^= reader->ReadObject(); \
65 name##_entry_ = new StubEntry(*(reader->CodeHandle()));
66 VM_STUB_CODE_LIST(READ_STUB);
67 #undef READ_STUB
68 }
69
70 void StubCode::WriteTo(SnapshotWriter* writer) {
71 // TODO(rmacnak): Consider writing only the instructions to avoid
72 // vm_isolate_is_symbolic.
73 #define WRITE_STUB(name) \ 64 #define WRITE_STUB(name) \
74 writer->WriteObject(StubCode::name##_entry()->code()); 65 serializer->Push(StubCode::name##_entry()->code());
75 VM_STUB_CODE_LIST(WRITE_STUB); 66 VM_STUB_CODE_LIST(WRITE_STUB);
76 #undef WRITE_STUB 67 #undef WRITE_STUB
77 } 68 }
78 69
79 70
71 void StubCode::WriteRef(Serializer* serializer) {
72 #define WRITE_STUB(name) \
73 serializer->WriteRef(StubCode::name##_entry()->code());
74 VM_STUB_CODE_LIST(WRITE_STUB);
75 #undef WRITE_STUB
76 }
77
78
79 void StubCode::ReadRef(Deserializer* deserializer) {
80 Code& code = Code::Handle();
81 #define READ_STUB(name) \
82 code ^= deserializer->ReadRef(); \
83 name##_entry_ = new StubEntry(code);
84 VM_STUB_CODE_LIST(READ_STUB);
85 #undef READ_STUB
86 }
87
88
89
80 void StubCode::Init(Isolate* isolate) { } 90 void StubCode::Init(Isolate* isolate) { }
81 91
82 92
83 void StubCode::VisitObjectPointers(ObjectPointerVisitor* visitor) { 93 void StubCode::VisitObjectPointers(ObjectPointerVisitor* visitor) {
84 } 94 }
85 95
86 96
87 bool StubCode::HasBeenInitialized() { 97 bool StubCode::HasBeenInitialized() {
88 #if !defined(TARGET_ARCH_DBC) 98 #if !defined(TARGET_ARCH_DBC)
89 // Use JumpToExceptionHandler and InvokeDart as canaries. 99 // Use JumpToExceptionHandler and InvokeDart as canaries.
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 if ((name##_entry() != NULL) && \ 247 if ((name##_entry() != NULL) && \
238 (entry_point == name##_entry()->EntryPoint())) { \ 248 (entry_point == name##_entry()->EntryPoint())) { \
239 return ""#name; \ 249 return ""#name; \
240 } 250 }
241 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER); 251 VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER);
242 #undef VM_STUB_CODE_TESTER 252 #undef VM_STUB_CODE_TESTER
243 return NULL; 253 return NULL;
244 } 254 }
245 255
246 } // namespace dart 256 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/stub_code.h ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698