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

Unified Diff: runtime/vm/snapshot_test.cc

Issue 1155183003: Load deferred classes eagerly when generating script snapshots (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« runtime/bin/main.cc ('K') | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot_test.cc
diff --git a/runtime/vm/snapshot_test.cc b/runtime/vm/snapshot_test.cc
index abe0b8e3e17520ce03b8b8b733b35093c01a335d..6707566f534756675fd1bd4f27eabab5aa754b5a 100644
--- a/runtime/vm/snapshot_test.cc
+++ b/runtime/vm/snapshot_test.cc
@@ -19,6 +19,7 @@
namespace dart {
DECLARE_FLAG(bool, enable_type_checks);
+DECLARE_FLAG(bool, load_deferred_eagerly);
// Check if serialized and deserialized objects are equal.
static bool Equals(const Object& expected, const Object& actual) {
@@ -1232,6 +1233,9 @@ UNIT_TEST_CASE(ScriptSnapshot) {
intptr_t expected_num_libs;
intptr_t actual_num_libs;
+ bool saved_load_deferred_eagerly_mode = FLAG_load_deferred_eagerly;
+ FLAG_load_deferred_eagerly = true;
+
{
// Start an Isolate, and create a full snapshot of it.
TestIsolateScope __test_isolate__;
@@ -1248,6 +1252,7 @@ UNIT_TEST_CASE(ScriptSnapshot) {
Dart_ExitScope();
}
+ FLAG_load_deferred_eagerly = saved_load_deferred_eagerly_mode;
{
// Create an Isolate using the full snapshot, load a script and create
// a script snapshot of the script.
@@ -1328,6 +1333,8 @@ UNIT_TEST_CASE(ScriptSnapshot1) {
uint8_t* full_snapshot = NULL;
uint8_t* script_snapshot = NULL;
+ bool saved_load_deferred_eagerly_mode = FLAG_load_deferred_eagerly;
+ FLAG_load_deferred_eagerly = true;
{
// Start an Isolate, and create a full snapshot of it.
TestIsolateScope __test_isolate__;
@@ -1373,6 +1380,8 @@ UNIT_TEST_CASE(ScriptSnapshot1) {
result = Dart_LoadScriptFromSnapshot(script_snapshot, size);
EXPECT_VALID(result);
}
+
+ FLAG_load_deferred_eagerly = saved_load_deferred_eagerly_mode;
Dart_ShutdownIsolate();
free(full_snapshot);
free(script_snapshot);
@@ -1412,8 +1421,10 @@ UNIT_TEST_CASE(ScriptSnapshot2) {
uint8_t* script_snapshot = NULL;
// Force creation of snapshot in production mode.
- bool saved_mode = FLAG_enable_type_checks;
+ bool saved_enable_type_checks_mode = FLAG_enable_type_checks;
FLAG_enable_type_checks = false;
+ bool saved_load_deferred_eagerly_mode = FLAG_load_deferred_eagerly;
+ FLAG_load_deferred_eagerly = true;
{
// Start an Isolate, and create a full snapshot of it.
@@ -1461,7 +1472,8 @@ UNIT_TEST_CASE(ScriptSnapshot2) {
}
// Continue in originally saved mode.
- FLAG_enable_type_checks = saved_mode;
+ FLAG_enable_type_checks = saved_enable_type_checks_mode;
+ FLAG_load_deferred_eagerly = saved_load_deferred_eagerly_mode;
{
// Now Create an Isolate using the full snapshot and load the
@@ -1476,15 +1488,15 @@ UNIT_TEST_CASE(ScriptSnapshot2) {
// Invoke the test_s function.
result = Dart_Invoke(lib, NewString("test_s"), 0, NULL);
- EXPECT(Dart_IsError(result) == saved_mode);
+ EXPECT(Dart_IsError(result) == saved_enable_type_checks_mode);
// Invoke the test_i function.
result = Dart_Invoke(lib, NewString("test_i"), 0, NULL);
- EXPECT(Dart_IsError(result) == saved_mode);
+ EXPECT(Dart_IsError(result) == saved_enable_type_checks_mode);
// Invoke the test_b function.
result = Dart_Invoke(lib, NewString("test_b"), 0, NULL);
- EXPECT(Dart_IsError(result) == saved_mode);
+ EXPECT(Dart_IsError(result) == saved_enable_type_checks_mode);
}
Dart_ShutdownIsolate();
free(full_snapshot);
« runtime/bin/main.cc ('K') | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698