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

Side by Side Diff: runtime/bin/gen_snapshot.cc

Issue 25648005: Speed up gen_snapshot by writing all bytes at once. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | « no previous file | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Generate a snapshot file after loading all the scripts specified on the 5 // Generate a snapshot file after loading all the scripts specified on the
6 // command line. 6 // command line.
7 7
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h> 9 #include <string.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 return -1; 136 return -1;
137 } 137 }
138 138
139 return 0; 139 return 0;
140 } 140 }
141 141
142 142
143 static void WriteSnapshotFile(const uint8_t* buffer, const intptr_t size) { 143 static void WriteSnapshotFile(const uint8_t* buffer, const intptr_t size) {
144 File* file = File::Open(snapshot_filename, File::kWriteTruncate); 144 File* file = File::Open(snapshot_filename, File::kWriteTruncate);
145 ASSERT(file != NULL); 145 ASSERT(file != NULL);
146 for (intptr_t i = 0; i < size; i++) { 146 if (!file->WriteFully(buffer, size)) {
147 file->WriteByte(buffer[i]); 147 Log::PrintErr("Error: Failed to write full snapshot.\n\n");
148 } 148 }
149 delete file; 149 delete file;
150 } 150 }
151 151
152 152
153 class UriResolverIsolateScope { 153 class UriResolverIsolateScope {
154 public: 154 public:
155 UriResolverIsolateScope() { 155 UriResolverIsolateScope() {
156 ASSERT(isolate != NULL); 156 ASSERT(isolate != NULL);
157 snapshotted_isolate_ = Dart_CurrentIsolate(); 157 snapshotted_isolate_ = Dart_CurrentIsolate();
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 } 565 }
566 return 0; 566 return 0;
567 } 567 }
568 568
569 } // namespace bin 569 } // namespace bin
570 } // namespace dart 570 } // namespace dart
571 571
572 int main(int argc, char** argv) { 572 int main(int argc, char** argv) {
573 return dart::bin::main(argc, argv); 573 return dart::bin::main(argc, argv);
574 } 574 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698