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

Side by Side Diff: src/snapshot/snapshot.h

Issue 2232653003: Reland of "[heap] Switch to 500k pages" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add cctests Created 4 years, 4 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/objects.h ('k') | src/snapshot/snapshot-common.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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_SNAPSHOT_H_ 5 #ifndef V8_SNAPSHOT_SNAPSHOT_H_
6 #define V8_SNAPSHOT_SNAPSHOT_H_ 6 #define V8_SNAPSHOT_SNAPSHOT_H_
7 7
8 #include "src/snapshot/partial-serializer.h" 8 #include "src/snapshot/partial-serializer.h"
9 #include "src/snapshot/startup-serializer.h" 9 #include "src/snapshot/startup-serializer.h"
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 static MaybeHandle<Context> NewContextFromSnapshot( 60 static MaybeHandle<Context> NewContextFromSnapshot(
61 Isolate* isolate, Handle<JSGlobalProxy> global_proxy, 61 Isolate* isolate, Handle<JSGlobalProxy> global_proxy,
62 size_t context_index); 62 size_t context_index);
63 63
64 static bool HaveASnapshotToStartFrom(Isolate* isolate); 64 static bool HaveASnapshotToStartFrom(Isolate* isolate);
65 65
66 static bool HasContextSnapshot(Isolate* isolate, size_t index); 66 static bool HasContextSnapshot(Isolate* isolate, size_t index);
67 67
68 static bool EmbedsScript(Isolate* isolate); 68 static bool EmbedsScript(Isolate* isolate);
69 69
70 static uint32_t SizeOfFirstPage(Isolate* isolate, AllocationSpace space);
71
72
73 // To be implemented by the snapshot source. 70 // To be implemented by the snapshot source.
74 static const v8::StartupData* DefaultSnapshotBlob(); 71 static const v8::StartupData* DefaultSnapshotBlob();
75 72
76 static v8::StartupData CreateSnapshotBlob( 73 static v8::StartupData CreateSnapshotBlob(
77 const SnapshotData* startup_snapshot, 74 const SnapshotData* startup_snapshot,
78 const List<SnapshotData*>* context_snapshots); 75 const List<SnapshotData*>* context_snapshots);
79 76
80 #ifdef DEBUG 77 #ifdef DEBUG
81 static bool SnapshotIsValid(v8::StartupData* snapshot_blob); 78 static bool SnapshotIsValid(v8::StartupData* snapshot_blob);
82 #endif // DEBUG 79 #endif // DEBUG
83 80
84 private: 81 private:
85 static int ExtractNumContexts(const v8::StartupData* data); 82 static int ExtractNumContexts(const v8::StartupData* data);
86 static Vector<const byte> ExtractStartupData(const v8::StartupData* data); 83 static Vector<const byte> ExtractStartupData(const v8::StartupData* data);
87 static Vector<const byte> ExtractContextData(const v8::StartupData* data, 84 static Vector<const byte> ExtractContextData(const v8::StartupData* data,
88 int index); 85 int index);
89 86
90 // Snapshot blob layout: 87 // Snapshot blob layout:
91 // [0 - 5] pre-calculated first page sizes for paged spaces 88 // [0] number of contexts N
92 // [6] number of contexts N 89 // [1] offset to context 0
93 // [7] offset to context 0 90 // [2] offset to context 1
94 // [8] offset to context 1
95 // ... 91 // ...
96 // ... offset to context N - 1 92 // ... offset to context N - 1
97 // ... startup snapshot data 93 // ... startup snapshot data
98 // ... context 0 snapshot data 94 // ... context 0 snapshot data
99 // ... context 1 snapshot data 95 // ... context 1 snapshot data
100 96
101 static const int kNumPagedSpaces = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1; 97 static const int kNumberOfContextsOffset = 0;
102
103 static const int kFirstPageSizesOffset = 0;
104 static const int kNumberOfContextsOffset =
105 kFirstPageSizesOffset + kNumPagedSpaces * kInt32Size;
106 static const int kFirstContextOffsetOffset = 98 static const int kFirstContextOffsetOffset =
107 kNumberOfContextsOffset + kInt32Size; 99 kNumberOfContextsOffset + kInt32Size;
108 100
109 static int StartupSnapshotOffset(int num_contexts) { 101 static int StartupSnapshotOffset(int num_contexts) {
110 return kFirstContextOffsetOffset + num_contexts * kInt32Size; 102 return kFirstContextOffsetOffset + num_contexts * kInt32Size;
111 } 103 }
112 104
113 static int ContextSnapshotOffsetOffset(int index) { 105 static int ContextSnapshotOffsetOffset(int index) {
114 return kFirstContextOffsetOffset + index * kInt32Size; 106 return kFirstContextOffsetOffset + index * kInt32Size;
115 } 107 }
116 108
117 DISALLOW_IMPLICIT_CONSTRUCTORS(Snapshot); 109 DISALLOW_IMPLICIT_CONSTRUCTORS(Snapshot);
118 }; 110 };
119 111
120 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 112 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
121 void SetSnapshotFromFile(StartupData* snapshot_blob); 113 void SetSnapshotFromFile(StartupData* snapshot_blob);
122 #endif 114 #endif
123 115
124 } // namespace internal 116 } // namespace internal
125 } // namespace v8 117 } // namespace v8
126 118
127 #endif // V8_SNAPSHOT_SNAPSHOT_H_ 119 #endif // V8_SNAPSHOT_SNAPSHOT_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/snapshot/snapshot-common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698