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

Side by Side Diff: runtime/vm/snapshot.h

Issue 313393003: Changes to improve the performance of reading a snapshot. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/pages.cc ('k') | no next file » | 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 #ifndef VM_SNAPSHOT_H_ 5 #ifndef VM_SNAPSHOT_H_
6 #define VM_SNAPSHOT_H_ 6 #define VM_SNAPSHOT_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/bitfield.h" 10 #include "vm/bitfield.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 BaseReader(const uint8_t* buffer, intptr_t size) : stream_(buffer, size) {} 169 BaseReader(const uint8_t* buffer, intptr_t size) : stream_(buffer, size) {}
170 // Reads raw data (for basic types). 170 // Reads raw data (for basic types).
171 // sizeof(T) must be in {1,2,4,8}. 171 // sizeof(T) must be in {1,2,4,8}.
172 template <typename T> 172 template <typename T>
173 T Read() { 173 T Read() {
174 return ReadStream::Raw<sizeof(T), T>::Read(&stream_); 174 return ReadStream::Raw<sizeof(T), T>::Read(&stream_);
175 } 175 }
176 176
177 // Reads an intptr_t type value. 177 // Reads an intptr_t type value.
178 intptr_t ReadIntptrValue() { 178 intptr_t ReadIntptrValue() {
179 #if defined(ARCH_IS_32_BIT)
Ivan Posva 2014/06/09 20:48:20 As discussed I don't think this is safe.
zra 2014/06/09 22:02:43 Removed change here.
180 int32_t value = Read<int32_t>();
181 #elif defined(ARCH_IS_64_BIT)
179 int64_t value = Read<int64_t>(); 182 int64_t value = Read<int64_t>();
183 #endif
180 ASSERT((value <= kIntptrMax) && (value >= kIntptrMin)); 184 ASSERT((value <= kIntptrMax) && (value >= kIntptrMin));
181 return static_cast<intptr_t>(value); 185 return static_cast<intptr_t>(value);
182 } 186 }
183 187
184 void ReadBytes(uint8_t* addr, intptr_t len) { 188 void ReadBytes(uint8_t* addr, intptr_t len) {
185 stream_.ReadBytes(addr, len); 189 stream_.ReadBytes(addr, len);
186 } 190 }
187 191
188 double ReadDouble() { 192 double ReadDouble() {
189 double result; 193 double result;
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 private: 643 private:
640 SnapshotWriter* writer_; 644 SnapshotWriter* writer_;
641 bool as_references_; 645 bool as_references_;
642 646
643 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); 647 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor);
644 }; 648 };
645 649
646 } // namespace dart 650 } // namespace dart
647 651
648 #endif // VM_SNAPSHOT_H_ 652 #endif // VM_SNAPSHOT_H_
OLDNEW
« no previous file with comments | « runtime/vm/pages.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698