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

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

Issue 1944213002: Support for taking full snapshots from 'dart', not just 'dart_bootstrap'. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
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 "platform/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "include/dart_tools_api.h" 7 #include "include/dart_tools_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart_api_impl.h" 10 #include "vm/dart_api_impl.h"
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 static const intptr_t kInitialSize = 64 * KB; 829 static const intptr_t kInitialSize = 64 * KB;
830 TestSnapshotWriter(uint8_t** buffer, ReAlloc alloc) 830 TestSnapshotWriter(uint8_t** buffer, ReAlloc alloc)
831 : SnapshotWriter(Thread::Current(), 831 : SnapshotWriter(Thread::Current(),
832 Snapshot::kScript, 832 Snapshot::kScript,
833 buffer, 833 buffer,
834 alloc, 834 alloc,
835 kInitialSize, 835 kInitialSize,
836 &forward_list_, 836 &forward_list_,
837 NULL, /* test_writer */ 837 NULL, /* test_writer */
838 true, /* can_send_any_object */ 838 true, /* can_send_any_object */
839 true /* vm_isolate_is_symbolic */), 839 false /* writing_vm_isolate */),
840 forward_list_(thread(), kMaxPredefinedObjectIds) { 840 forward_list_(thread(), kMaxPredefinedObjectIds) {
841 ASSERT(buffer != NULL); 841 ASSERT(buffer != NULL);
842 ASSERT(alloc != NULL); 842 ASSERT(alloc != NULL);
843 } 843 }
844 ~TestSnapshotWriter() { } 844 ~TestSnapshotWriter() { }
845 845
846 // Writes just a script object 846 // Writes just a script object
847 void WriteScript(const Script& script) { 847 void WriteScript(const Script& script) {
848 WriteObject(script.raw()); 848 WriteObject(script.raw());
849 } 849 }
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 EXPECT_VALID(Api::CheckAndFinalizePendingClasses(thread)); 1189 EXPECT_VALID(Api::CheckAndFinalizePendingClasses(thread));
1190 timer1.Stop(); 1190 timer1.Stop();
1191 OS::PrintErr("Without Snapshot: %" Pd64 "us\n", timer1.TotalElapsedTime()); 1191 OS::PrintErr("Without Snapshot: %" Pd64 "us\n", timer1.TotalElapsedTime());
1192 1192
1193 // Write snapshot with object content. 1193 // Write snapshot with object content.
1194 { 1194 {
1195 FullSnapshotWriter writer(Snapshot::kCore, 1195 FullSnapshotWriter writer(Snapshot::kCore,
1196 NULL, 1196 NULL,
1197 &isolate_snapshot_buffer, 1197 &isolate_snapshot_buffer,
1198 &malloc_allocator, 1198 &malloc_allocator,
1199 NULL, /* instructions_writer */ 1199 NULL /* instructions_writer */);
1200 true);
1201 writer.WriteFullSnapshot(); 1200 writer.WriteFullSnapshot();
1202 } 1201 }
1203 } 1202 }
1204 1203
1205 // Now Create another isolate using the snapshot and execute a method 1204 // Now Create another isolate using the snapshot and execute a method
1206 // from the script. 1205 // from the script.
1207 Timer timer2(true, "Snapshot_test"); 1206 Timer timer2(true, "Snapshot_test");
1208 timer2.Start(); 1207 timer2.Start();
1209 TestCase::CreateTestIsolateFromSnapshot(isolate_snapshot_buffer); 1208 TestCase::CreateTestIsolateFromSnapshot(isolate_snapshot_buffer);
1210 { 1209 {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 EXPECT_VALID(Api::CheckAndFinalizePendingClasses(thread)); 1249 EXPECT_VALID(Api::CheckAndFinalizePendingClasses(thread));
1251 timer1.Stop(); 1250 timer1.Stop();
1252 OS::PrintErr("Without Snapshot: %" Pd64 "us\n", timer1.TotalElapsedTime()); 1251 OS::PrintErr("Without Snapshot: %" Pd64 "us\n", timer1.TotalElapsedTime());
1253 1252
1254 // Write snapshot with object content. 1253 // Write snapshot with object content.
1255 { 1254 {
1256 FullSnapshotWriter writer(Snapshot::kCore, 1255 FullSnapshotWriter writer(Snapshot::kCore,
1257 NULL, 1256 NULL,
1258 &isolate_snapshot_buffer, 1257 &isolate_snapshot_buffer,
1259 &malloc_allocator, 1258 &malloc_allocator,
1260 NULL, /* instructions_writer */ 1259 NULL /* instructions_writer */);
1261 true /* vm_isolate_is_symbolic */);
1262 writer.WriteFullSnapshot(); 1260 writer.WriteFullSnapshot();
1263 } 1261 }
1264 1262
1265 // Invoke a function which returns an object. 1263 // Invoke a function which returns an object.
1266 Dart_Handle cls = Dart_GetClass(lib, NewString("FieldsTest")); 1264 Dart_Handle cls = Dart_GetClass(lib, NewString("FieldsTest"));
1267 Dart_Handle result = Dart_Invoke(cls, NewString("testMain"), 0, NULL); 1265 Dart_Handle result = Dart_Invoke(cls, NewString("testMain"), 0, NULL);
1268 EXPECT_VALID(result); 1266 EXPECT_VALID(result);
1269 } 1267 }
1270 1268
1271 // Now Create another isolate using the snapshot and execute a method 1269 // Now Create another isolate using the snapshot and execute a method
(...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after
3017 StackZone zone(Thread::Current()); 3015 StackZone zone(Thread::Current());
3018 uint8_t* buffer; 3016 uint8_t* buffer;
3019 MessageWriter writer(&buffer, &zone_allocator, true); 3017 MessageWriter writer(&buffer, &zone_allocator, true);
3020 writer.WriteInlinedObjectHeader(kOmittedObjectId); 3018 writer.WriteInlinedObjectHeader(kOmittedObjectId);
3021 // For performance, we'd like single-byte headers when ids are omitted. 3019 // For performance, we'd like single-byte headers when ids are omitted.
3022 // If this starts failing, consider renumbering the snapshot ids. 3020 // If this starts failing, consider renumbering the snapshot ids.
3023 EXPECT_EQ(1, writer.BytesWritten()); 3021 EXPECT_EQ(1, writer.BytesWritten());
3024 } 3022 }
3025 3023
3026 } // namespace dart 3024 } // namespace dart
OLDNEW
« runtime/vm/snapshot.cc ('K') | « runtime/vm/snapshot.cc ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698