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

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

Issue 12079117: Revert changes 17962-3 which break Dartium Debug build. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/snapshot.cc ('k') | runtime/vm/snapshot_test.dart » ('j') | 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 "include/dart_debugger_api.h" 5 #include "include/dart_debugger_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_api_message.h" 10 #include "vm/dart_api_message.h"
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 Dart_Handle result; 922 Dart_Handle result;
923 923
924 uint8_t* buffer; 924 uint8_t* buffer;
925 925
926 // Start an Isolate, load a script and create a full snapshot. 926 // Start an Isolate, load a script and create a full snapshot.
927 Timer timer1(true, "Snapshot_test"); 927 Timer timer1(true, "Snapshot_test");
928 timer1.Start(); 928 timer1.Start();
929 { 929 {
930 TestIsolateScope __test_isolate__; 930 TestIsolateScope __test_isolate__;
931 931
932 Isolate* isolate = Isolate::Current();
933 StackZone zone(isolate);
934 HandleScope scope(isolate);
935
936 // Create a test library and Load up a test script in it. 932 // Create a test library and Load up a test script in it.
937 TestCase::LoadTestScript(kScriptChars, NULL); 933 TestCase::LoadTestScript(kScriptChars, NULL);
938 EXPECT_STREQ("", CheckIsolateState(isolate));
939 timer1.Stop(); 934 timer1.Stop();
940 OS::PrintErr("Without Snapshot: %"Pd64"us\n", timer1.TotalElapsedTime()); 935 OS::PrintErr("Without Snapshot: %"Pd64"us\n", timer1.TotalElapsedTime());
941 936
942 // Write snapshot with object content. 937 // Write snapshot with object content.
938 Isolate* isolate = Isolate::Current();
939 StackZone zone(isolate);
940 HandleScope scope(isolate);
943 FullSnapshotWriter writer(&buffer, &malloc_allocator); 941 FullSnapshotWriter writer(&buffer, &malloc_allocator);
944 writer.WriteFullSnapshot(); 942 writer.WriteFullSnapshot();
945 } 943 }
946 944
947 // Now Create another isolate using the snapshot and execute a method 945 // Now Create another isolate using the snapshot and execute a method
948 // from the script. 946 // from the script.
949 Timer timer2(true, "Snapshot_test"); 947 Timer timer2(true, "Snapshot_test");
950 timer2.Start(); 948 timer2.Start();
951 TestCase::CreateTestIsolateFromSnapshot(buffer); 949 TestCase::CreateTestIsolateFromSnapshot(buffer);
952 { 950 {
(...skipping 29 matching lines...) Expand all
982 timer1.Start(); 980 timer1.Start();
983 { 981 {
984 TestIsolateScope __test_isolate__; 982 TestIsolateScope __test_isolate__;
985 983
986 Isolate* isolate = Isolate::Current(); 984 Isolate* isolate = Isolate::Current();
987 StackZone zone(isolate); 985 StackZone zone(isolate);
988 HandleScope scope(isolate); 986 HandleScope scope(isolate);
989 987
990 // Create a test library and Load up a test script in it. 988 // Create a test library and Load up a test script in it.
991 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 989 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
992 EXPECT_STREQ("", CheckIsolateState(isolate)); 990 ClassFinalizer::FinalizePendingClasses();
993 timer1.Stop(); 991 timer1.Stop();
994 OS::PrintErr("Without Snapshot: %"Pd64"us\n", timer1.TotalElapsedTime()); 992 OS::PrintErr("Without Snapshot: %"Pd64"us\n", timer1.TotalElapsedTime());
995 993
996 // Write snapshot with object content. 994 // Write snapshot with object content.
997 FullSnapshotWriter writer(&buffer, &malloc_allocator); 995 FullSnapshotWriter writer(&buffer, &malloc_allocator);
998 writer.WriteFullSnapshot(); 996 writer.WriteFullSnapshot();
999 997
1000 // Invoke a function which returns an object. 998 // Invoke a function which returns an object.
1001 Dart_Handle cls = Dart_GetClass(lib, NewString("FieldsTest")); 999 Dart_Handle cls = Dart_GetClass(lib, NewString("FieldsTest"));
1002 Dart_Handle result = Dart_Invoke(cls, NewString("testMain"), 0, NULL); 1000 Dart_Handle result = Dart_Invoke(cls, NewString("testMain"), 0, NULL);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 Dart_Handle import_lib = Dart_LoadLibrary(NewString("dart_import_lib"), 1097 Dart_Handle import_lib = Dart_LoadLibrary(NewString("dart_import_lib"),
1100 NewString(kLibScriptChars)); 1098 NewString(kLibScriptChars));
1101 EXPECT_VALID(import_lib); 1099 EXPECT_VALID(import_lib);
1102 1100
1103 // Create a test library and Load up a test script in it. 1101 // Create a test library and Load up a test script in it.
1104 TestCase::LoadTestScript(kScriptChars, NULL); 1102 TestCase::LoadTestScript(kScriptChars, NULL);
1105 1103
1106 EXPECT_VALID(Dart_LibraryImportLibrary(TestCase::lib(), 1104 EXPECT_VALID(Dart_LibraryImportLibrary(TestCase::lib(),
1107 import_lib, 1105 import_lib,
1108 Dart_Null())); 1106 Dart_Null()));
1109 EXPECT_STREQ("", CheckIsolateState(Isolate::Current()));
1110 1107
1111 // Get list of library URLs loaded and save the count. 1108 // Get list of library URLs loaded and save the count.
1112 Dart_Handle libs = Dart_GetLibraryURLs(); 1109 Dart_Handle libs = Dart_GetLibraryURLs();
1113 EXPECT(Dart_IsList(libs)); 1110 EXPECT(Dart_IsList(libs));
1114 Dart_ListLength(libs, &expected_num_libs); 1111 Dart_ListLength(libs, &expected_num_libs);
1115 1112
1116 // Write out the script snapshot. 1113 // Write out the script snapshot.
1117 result = Dart_CreateScriptSnapshot(&buffer, &size); 1114 result = Dart_CreateScriptSnapshot(&buffer, &size);
1118 EXPECT_VALID(result); 1115 EXPECT_VALID(result);
1119 script_snapshot = reinterpret_cast<uint8_t*>(malloc(size)); 1116 script_snapshot = reinterpret_cast<uint8_t*>(malloc(size));
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
2199 EXPECT(Dart_ErrorHasException(result)); 2196 EXPECT(Dart_ErrorHasException(result));
2200 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", 2197 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n",
2201 Dart_GetError(result)); 2198 Dart_GetError(result));
2202 2199
2203 Dart_ExitScope(); 2200 Dart_ExitScope();
2204 } 2201 }
2205 2202
2206 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 2203 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
2207 2204
2208 } // namespace dart 2205 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/snapshot.cc ('k') | runtime/vm/snapshot_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698