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

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

Issue 1739593002: Revert "Move precompilation-related flags to flags list." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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/vm/snapshot.cc ('k') | runtime/vm/stub_code_arm.cc » ('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 "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"
11 #include "vm/dart_api_message.h" 11 #include "vm/dart_api_message.h"
12 #include "vm/dart_api_state.h" 12 #include "vm/dart_api_state.h"
13 #include "vm/flags.h" 13 #include "vm/flags.h"
14 #include "vm/snapshot.h" 14 #include "vm/snapshot.h"
15 #include "vm/symbols.h" 15 #include "vm/symbols.h"
16 #include "vm/unicode.h" 16 #include "vm/unicode.h"
17 #include "vm/unit_test.h" 17 #include "vm/unit_test.h"
18 18
19 namespace dart { 19 namespace dart {
20 20
21 DECLARE_FLAG(bool, enable_type_checks); 21 DECLARE_FLAG(bool, enable_type_checks);
22 DECLARE_FLAG(bool, load_deferred_eagerly);
22 DECLARE_FLAG(bool, concurrent_sweep); 23 DECLARE_FLAG(bool, concurrent_sweep);
23 24
24 // Check if serialized and deserialized objects are equal. 25 // Check if serialized and deserialized objects are equal.
25 static bool Equals(const Object& expected, const Object& actual) { 26 static bool Equals(const Object& expected, const Object& actual) {
26 if (expected.IsNull()) { 27 if (expected.IsNull()) {
27 return actual.IsNull(); 28 return actual.IsNull();
28 } 29 }
29 if (expected.IsSmi()) { 30 if (expected.IsSmi()) {
30 if (actual.IsSmi()) { 31 if (actual.IsSmi()) {
31 return expected.raw() == actual.raw(); 32 return expected.raw() == actual.raw();
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 994
994 // Check if we are able to generate the source from the token stream. 995 // Check if we are able to generate the source from the token stream.
995 // Rescan this source and compare the token stream to see if they are 996 // Rescan this source and compare the token stream to see if they are
996 // the same. 997 // the same.
997 GenerateSourceAndCheck(serialized_script); 998 GenerateSourceAndCheck(serialized_script);
998 999
999 free(buffer); 1000 free(buffer);
1000 } 1001 }
1001 1002
1002 1003
1003 #if !defined(PRODUCT) // Uses deferred loading.
1004 UNIT_TEST_CASE(CanonicalizationInScriptSnapshots) { 1004 UNIT_TEST_CASE(CanonicalizationInScriptSnapshots) {
1005 const char* kScriptChars = 1005 const char* kScriptChars =
1006 "\n" 1006 "\n"
1007 "import 'dart:mirrors';" 1007 "import 'dart:mirrors';"
1008 "import 'dart:isolate';" 1008 "import 'dart:isolate';"
1009 "void main() {" 1009 "void main() {"
1010 " if (reflectClass(MyException).superclass.reflectedType != " 1010 " if (reflectClass(MyException).superclass.reflectedType != "
1011 " IsolateSpawnException) {" 1011 " IsolateSpawnException) {"
1012 " throw new Exception('Canonicalization failure');" 1012 " throw new Exception('Canonicalization failure');"
1013 " }" 1013 " }"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 1099
1100 // Invoke a function which returns an object. 1100 // Invoke a function which returns an object.
1101 result = Dart_Invoke(result, NewString("main"), 0, NULL); 1101 result = Dart_Invoke(result, NewString("main"), 0, NULL);
1102 EXPECT_VALID(result); 1102 EXPECT_VALID(result);
1103 Dart_ExitScope(); 1103 Dart_ExitScope();
1104 Dart_ShutdownIsolate(); 1104 Dart_ShutdownIsolate();
1105 } 1105 }
1106 free(script_snapshot); 1106 free(script_snapshot);
1107 free(full_snapshot); 1107 free(full_snapshot);
1108 } 1108 }
1109 #endif
1110 1109
1111 1110
1112 static void IterateScripts(const Library& lib) { 1111 static void IterateScripts(const Library& lib) {
1113 const Array& lib_scripts = Array::Handle(lib.LoadedScripts()); 1112 const Array& lib_scripts = Array::Handle(lib.LoadedScripts());
1114 Script& script = Script::Handle(); 1113 Script& script = Script::Handle();
1115 String& uri = String::Handle(); 1114 String& uri = String::Handle();
1116 for (intptr_t i = 0; i < lib_scripts.Length(); i++) { 1115 for (intptr_t i = 0; i < lib_scripts.Length(); i++) {
1117 script ^= lib_scripts.At(i); 1116 script ^= lib_scripts.At(i);
1118 EXPECT(!script.IsNull()); 1117 EXPECT(!script.IsNull());
1119 uri = script.url(); 1118 uri = script.url();
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 result = Dart_Invoke(cls, NewString("testMain"), 0, NULL); 1462 result = Dart_Invoke(cls, NewString("testMain"), 0, NULL);
1464 EXPECT_VALID(result); 1463 EXPECT_VALID(result);
1465 Dart_ExitScope(); 1464 Dart_ExitScope();
1466 Dart_ShutdownIsolate(); 1465 Dart_ShutdownIsolate();
1467 } 1466 }
1468 free(full_snapshot); 1467 free(full_snapshot);
1469 free(script_snapshot); 1468 free(script_snapshot);
1470 } 1469 }
1471 1470
1472 1471
1472 #endif // !PRODUCT
1473
1474
1473 UNIT_TEST_CASE(ScriptSnapshot1) { 1475 UNIT_TEST_CASE(ScriptSnapshot1) {
1474 const char* kScriptChars = 1476 const char* kScriptChars =
1475 "class _SimpleNumEnumerable<T extends num> {" 1477 "class _SimpleNumEnumerable<T extends num> {"
1476 "final Iterable<T> _source;" 1478 "final Iterable<T> _source;"
1477 "const _SimpleNumEnumerable(this._source) : super();" 1479 "const _SimpleNumEnumerable(this._source) : super();"
1478 "}"; 1480 "}";
1479 1481
1480 Dart_Handle result; 1482 Dart_Handle result;
1481 uint8_t* buffer; 1483 uint8_t* buffer;
1482 intptr_t size; 1484 intptr_t size;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 result = Dart_Invoke(lib, NewString("test_b"), 0, NULL); 1659 result = Dart_Invoke(lib, NewString("test_b"), 0, NULL);
1658 EXPECT(Dart_IsError(result) == saved_enable_type_checks_mode); 1660 EXPECT(Dart_IsError(result) == saved_enable_type_checks_mode);
1659 Dart_ExitScope(); 1661 Dart_ExitScope();
1660 } 1662 }
1661 Dart_ShutdownIsolate(); 1663 Dart_ShutdownIsolate();
1662 free(full_snapshot); 1664 free(full_snapshot);
1663 free(script_snapshot); 1665 free(script_snapshot);
1664 } 1666 }
1665 1667
1666 1668
1667 #endif // !PRODUCT
1668
1669
1670 TEST_CASE(IntArrayMessage) { 1669 TEST_CASE(IntArrayMessage) {
1671 StackZone zone(Thread::Current()); 1670 StackZone zone(Thread::Current());
1672 uint8_t* buffer = NULL; 1671 uint8_t* buffer = NULL;
1673 ApiMessageWriter writer(&buffer, &zone_allocator); 1672 ApiMessageWriter writer(&buffer, &zone_allocator);
1674 1673
1675 static const int kArrayLength = 2; 1674 static const int kArrayLength = 2;
1676 intptr_t data[kArrayLength] = {1, 2}; 1675 intptr_t data[kArrayLength] = {1, 2};
1677 int len = kArrayLength; 1676 int len = kArrayLength;
1678 writer.WriteMessage(len, data); 1677 writer.WriteMessage(len, data);
1679 1678
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after
3010 StackZone zone(Thread::Current()); 3009 StackZone zone(Thread::Current());
3011 uint8_t* buffer; 3010 uint8_t* buffer;
3012 MessageWriter writer(&buffer, &zone_allocator, true); 3011 MessageWriter writer(&buffer, &zone_allocator, true);
3013 writer.WriteInlinedObjectHeader(kOmittedObjectId); 3012 writer.WriteInlinedObjectHeader(kOmittedObjectId);
3014 // For performance, we'd like single-byte headers when ids are omitted. 3013 // For performance, we'd like single-byte headers when ids are omitted.
3015 // If this starts failing, consider renumbering the snapshot ids. 3014 // If this starts failing, consider renumbering the snapshot ids.
3016 EXPECT_EQ(1, writer.BytesWritten()); 3015 EXPECT_EQ(1, writer.BytesWritten());
3017 } 3016 }
3018 3017
3019 } // namespace dart 3018 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/snapshot.cc ('k') | runtime/vm/stub_code_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698