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

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

Issue 1665473002: Remove workarounds for fixed issue 21620. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/bin/gen_snapshot.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 #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 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 uint8_t* buffer; 1024 uint8_t* buffer;
1025 intptr_t size; 1025 intptr_t size;
1026 intptr_t vm_isolate_snapshot_size; 1026 intptr_t vm_isolate_snapshot_size;
1027 uint8_t* isolate_snapshot = NULL; 1027 uint8_t* isolate_snapshot = NULL;
1028 intptr_t isolate_snapshot_size; 1028 intptr_t isolate_snapshot_size;
1029 uint8_t* full_snapshot = NULL; 1029 uint8_t* full_snapshot = NULL;
1030 uint8_t* script_snapshot = NULL; 1030 uint8_t* script_snapshot = NULL;
1031 1031
1032 bool saved_load_deferred_eagerly_mode = FLAG_load_deferred_eagerly; 1032 bool saved_load_deferred_eagerly_mode = FLAG_load_deferred_eagerly;
1033 FLAG_load_deferred_eagerly = true; 1033 FLAG_load_deferred_eagerly = true;
1034 // Workaround until issue 21620 is fixed.
1035 // (https://github.com/dart-lang/sdk/issues/21620)
1036 bool saved_concurrent_sweep_mode = FLAG_concurrent_sweep;
1037 FLAG_concurrent_sweep = false;
1038 { 1034 {
1039 // Start an Isolate, and create a full snapshot of it. 1035 // Start an Isolate, and create a full snapshot of it.
1040 TestIsolateScope __test_isolate__; 1036 TestIsolateScope __test_isolate__;
1041 Dart_EnterScope(); // Start a Dart API scope for invoking API functions. 1037 Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
1042 1038
1043 // Write out the script snapshot. 1039 // Write out the script snapshot.
1044 result = Dart_CreateSnapshot(NULL, 1040 result = Dart_CreateSnapshot(NULL,
1045 &vm_isolate_snapshot_size, 1041 &vm_isolate_snapshot_size,
1046 &isolate_snapshot, 1042 &isolate_snapshot,
1047 &isolate_snapshot_size); 1043 &isolate_snapshot_size);
1048 EXPECT_VALID(result); 1044 EXPECT_VALID(result);
1049 full_snapshot = reinterpret_cast<uint8_t*>(malloc(isolate_snapshot_size)); 1045 full_snapshot = reinterpret_cast<uint8_t*>(malloc(isolate_snapshot_size));
1050 memmove(full_snapshot, isolate_snapshot, isolate_snapshot_size); 1046 memmove(full_snapshot, isolate_snapshot, isolate_snapshot_size);
1051 Dart_ExitScope(); 1047 Dart_ExitScope();
1052 } 1048 }
1053 FLAG_load_deferred_eagerly = saved_load_deferred_eagerly_mode; 1049 FLAG_load_deferred_eagerly = saved_load_deferred_eagerly_mode;
1054 FLAG_concurrent_sweep = saved_concurrent_sweep_mode;
1055 1050
1056 { 1051 {
1057 // Now Create an Isolate using the full snapshot and load the 1052 // Now Create an Isolate using the full snapshot and load the
1058 // script and execute it. 1053 // script and execute it.
1059 TestCase::CreateTestIsolateFromSnapshot(full_snapshot); 1054 TestCase::CreateTestIsolateFromSnapshot(full_snapshot);
1060 Dart_EnterScope(); // Start a Dart API scope for invoking API functions. 1055 Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
1061 1056
1062 // Create a test library and Load up a test script in it. 1057 // Create a test library and Load up a test script in it.
1063 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 1058 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
1064 1059
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 intptr_t vm_isolate_snapshot_size; 1335 intptr_t vm_isolate_snapshot_size;
1341 uint8_t* isolate_snapshot = NULL; 1336 uint8_t* isolate_snapshot = NULL;
1342 intptr_t isolate_snapshot_size; 1337 intptr_t isolate_snapshot_size;
1343 uint8_t* full_snapshot = NULL; 1338 uint8_t* full_snapshot = NULL;
1344 uint8_t* script_snapshot = NULL; 1339 uint8_t* script_snapshot = NULL;
1345 intptr_t expected_num_libs; 1340 intptr_t expected_num_libs;
1346 intptr_t actual_num_libs; 1341 intptr_t actual_num_libs;
1347 1342
1348 bool saved_load_deferred_eagerly_mode = FLAG_load_deferred_eagerly; 1343 bool saved_load_deferred_eagerly_mode = FLAG_load_deferred_eagerly;
1349 FLAG_load_deferred_eagerly = true; 1344 FLAG_load_deferred_eagerly = true;
1350 // Workaround until issue 21620 is fixed.
1351 // (https://github.com/dart-lang/sdk/issues/21620)
1352 bool saved_concurrent_sweep_mode = FLAG_concurrent_sweep;
1353 FLAG_concurrent_sweep = false;
1354 { 1345 {
1355 // Start an Isolate, and create a full snapshot of it. 1346 // Start an Isolate, and create a full snapshot of it.
1356 TestIsolateScope __test_isolate__; 1347 TestIsolateScope __test_isolate__;
1357 Dart_EnterScope(); // Start a Dart API scope for invoking API functions. 1348 Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
1358 1349
1359 // Write out the script snapshot. 1350 // Write out the script snapshot.
1360 result = Dart_CreateSnapshot(NULL, 1351 result = Dart_CreateSnapshot(NULL,
1361 &vm_isolate_snapshot_size, 1352 &vm_isolate_snapshot_size,
1362 &isolate_snapshot, 1353 &isolate_snapshot,
1363 &isolate_snapshot_size); 1354 &isolate_snapshot_size);
1364 EXPECT_VALID(result); 1355 EXPECT_VALID(result);
1365 full_snapshot = reinterpret_cast<uint8_t*>(malloc(isolate_snapshot_size)); 1356 full_snapshot = reinterpret_cast<uint8_t*>(malloc(isolate_snapshot_size));
1366 memmove(full_snapshot, isolate_snapshot, isolate_snapshot_size); 1357 memmove(full_snapshot, isolate_snapshot, isolate_snapshot_size);
1367 Dart_ExitScope(); 1358 Dart_ExitScope();
1368 } 1359 }
1369 FLAG_load_deferred_eagerly = saved_load_deferred_eagerly_mode; 1360 FLAG_load_deferred_eagerly = saved_load_deferred_eagerly_mode;
1370 FLAG_concurrent_sweep = saved_concurrent_sweep_mode;
1371 1361
1372 // Test for Dart_CreateScriptSnapshot. 1362 // Test for Dart_CreateScriptSnapshot.
1373 { 1363 {
1374 // Create an Isolate using the full snapshot, load a script and create 1364 // Create an Isolate using the full snapshot, load a script and create
1375 // a script snapshot of the script. 1365 // a script snapshot of the script.
1376 TestCase::CreateTestIsolateFromSnapshot(full_snapshot); 1366 TestCase::CreateTestIsolateFromSnapshot(full_snapshot);
1377 Dart_EnterScope(); // Start a Dart API scope for invoking API functions. 1367 Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
1378 1368
1379 // Load the library. 1369 // Load the library.
1380 Dart_Handle import_lib = Dart_LoadLibrary(NewString("dart_import_lib"), 1370 Dart_Handle import_lib = Dart_LoadLibrary(NewString("dart_import_lib"),
(...skipping 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after
3011 StackZone zone(Thread::Current()); 3001 StackZone zone(Thread::Current());
3012 uint8_t* buffer; 3002 uint8_t* buffer;
3013 MessageWriter writer(&buffer, &zone_allocator, true); 3003 MessageWriter writer(&buffer, &zone_allocator, true);
3014 writer.WriteInlinedObjectHeader(kOmittedObjectId); 3004 writer.WriteInlinedObjectHeader(kOmittedObjectId);
3015 // For performance, we'd like single-byte headers when ids are omitted. 3005 // For performance, we'd like single-byte headers when ids are omitted.
3016 // If this starts failing, consider renumbering the snapshot ids. 3006 // If this starts failing, consider renumbering the snapshot ids.
3017 EXPECT_EQ(1, writer.BytesWritten()); 3007 EXPECT_EQ(1, writer.BytesWritten());
3018 } 3008 }
3019 3009
3020 } // namespace dart 3010 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/gen_snapshot.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698