OLD | NEW |
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 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 | 1048 |
1049 // Check if we are able to generate the source from the token stream. | 1049 // Check if we are able to generate the source from the token stream. |
1050 // Rescan this source and compare the token stream to see if they are | 1050 // Rescan this source and compare the token stream to see if they are |
1051 // the same. | 1051 // the same. |
1052 GenerateSourceAndCheck(serialized_script); | 1052 GenerateSourceAndCheck(serialized_script); |
1053 | 1053 |
1054 free(buffer); | 1054 free(buffer); |
1055 } | 1055 } |
1056 | 1056 |
1057 | 1057 |
1058 #if 0 | |
1059 UNIT_TEST_CASE(CanonicalizationInScriptSnapshots) { | 1058 UNIT_TEST_CASE(CanonicalizationInScriptSnapshots) { |
1060 const char* kScriptChars = | 1059 const char* kScriptChars = |
1061 "\n" | 1060 "\n" |
1062 "import 'dart:mirrors';" | 1061 "import 'dart:mirrors';" |
1063 "import 'dart:isolate';" | 1062 "import 'dart:isolate';" |
1064 "void main() {" | 1063 "void main() {" |
1065 " if (reflectClass(MyException).superclass.reflectedType != " | 1064 " if (reflectClass(MyException).superclass.reflectedType != " |
1066 " IsolateSpawnException) {" | 1065 " IsolateSpawnException) {" |
1067 " throw new Exception('Canonicalization failure');" | 1066 " throw new Exception('Canonicalization failure');" |
1068 " }" | 1067 " }" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 | 1158 |
1160 // Invoke a function which returns an object. | 1159 // Invoke a function which returns an object. |
1161 result = Dart_Invoke(result, NewString("main"), 0, NULL); | 1160 result = Dart_Invoke(result, NewString("main"), 0, NULL); |
1162 EXPECT_VALID(result); | 1161 EXPECT_VALID(result); |
1163 Dart_ExitScope(); | 1162 Dart_ExitScope(); |
1164 Dart_ShutdownIsolate(); | 1163 Dart_ShutdownIsolate(); |
1165 } | 1164 } |
1166 free(script_snapshot); | 1165 free(script_snapshot); |
1167 free(full_snapshot); | 1166 free(full_snapshot); |
1168 } | 1167 } |
1169 #endif | |
1170 | 1168 |
1171 | 1169 |
1172 static void IterateScripts(const Library& lib) { | 1170 static void IterateScripts(const Library& lib) { |
1173 const Array& lib_scripts = Array::Handle(lib.LoadedScripts()); | 1171 const Array& lib_scripts = Array::Handle(lib.LoadedScripts()); |
1174 Script& script = Script::Handle(); | 1172 Script& script = Script::Handle(); |
1175 String& uri = String::Handle(); | 1173 String& uri = String::Handle(); |
1176 for (intptr_t i = 0; i < lib_scripts.Length(); i++) { | 1174 for (intptr_t i = 0; i < lib_scripts.Length(); i++) { |
1177 script ^= lib_scripts.At(i); | 1175 script ^= lib_scripts.At(i); |
1178 EXPECT(!script.IsNull()); | 1176 EXPECT(!script.IsNull()); |
1179 uri = script.url(); | 1177 uri = script.url(); |
(...skipping 1875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3055 StackZone zone(Isolate::Current()); | 3053 StackZone zone(Isolate::Current()); |
3056 uint8_t* buffer; | 3054 uint8_t* buffer; |
3057 MessageWriter writer(&buffer, &zone_allocator, true); | 3055 MessageWriter writer(&buffer, &zone_allocator, true); |
3058 writer.WriteInlinedObjectHeader(kOmittedObjectId); | 3056 writer.WriteInlinedObjectHeader(kOmittedObjectId); |
3059 // For performance, we'd like single-byte headers when ids are omitted. | 3057 // For performance, we'd like single-byte headers when ids are omitted. |
3060 // If this starts failing, consider renumbering the snapshot ids. | 3058 // If this starts failing, consider renumbering the snapshot ids. |
3061 EXPECT_EQ(1, writer.BytesWritten()); | 3059 EXPECT_EQ(1, writer.BytesWritten()); |
3062 } | 3060 } |
3063 | 3061 |
3064 } // namespace dart | 3062 } // namespace dart |
OLD | NEW |