| 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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 " static ms6() {\n" | 936 " static ms6() {\n" |
| 937 " return '\\t \\n \\x00 \\xFF';\n" | 937 " return '\\t \\n \\x00 \\xFF';\n" |
| 938 " }\n" | 938 " }\n" |
| 939 "}\n"; | 939 "}\n"; |
| 940 | 940 |
| 941 String& url = String::Handle(String::New("dart-test:SerializeScript")); | 941 String& url = String::Handle(String::New("dart-test:SerializeScript")); |
| 942 String& source = String::Handle(String::New(kScriptChars)); | 942 String& source = String::Handle(String::New(kScriptChars)); |
| 943 Script& script = Script::Handle(Script::New(url, | 943 Script& script = Script::Handle(Script::New(url, |
| 944 source, | 944 source, |
| 945 RawScript::kScriptTag)); | 945 RawScript::kScriptTag)); |
| 946 const String& lib_url = String::Handle(Symbols::New("TestLib")); | 946 const String& lib_url = String::Handle(Symbols::New(thread, "TestLib")); |
| 947 Library& lib = Library::Handle(Library::New(lib_url)); | 947 Library& lib = Library::Handle(Library::New(lib_url)); |
| 948 lib.Register(); | 948 lib.Register(); |
| 949 EXPECT(CompilerTest::TestCompileScript(lib, script)); | 949 EXPECT(CompilerTest::TestCompileScript(lib, script)); |
| 950 | 950 |
| 951 // Write snapshot with script content. | 951 // Write snapshot with script content. |
| 952 uint8_t* buffer; | 952 uint8_t* buffer; |
| 953 TestSnapshotWriter writer(&buffer, &malloc_allocator); | 953 TestSnapshotWriter writer(&buffer, &malloc_allocator); |
| 954 writer.WriteScript(script); | 954 writer.WriteScript(script); |
| 955 | 955 |
| 956 // Read object back from the snapshot. | 956 // Read object back from the snapshot. |
| (...skipping 2052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3009 StackZone zone(Thread::Current()); | 3009 StackZone zone(Thread::Current()); |
| 3010 uint8_t* buffer; | 3010 uint8_t* buffer; |
| 3011 MessageWriter writer(&buffer, &zone_allocator, true); | 3011 MessageWriter writer(&buffer, &zone_allocator, true); |
| 3012 writer.WriteInlinedObjectHeader(kOmittedObjectId); | 3012 writer.WriteInlinedObjectHeader(kOmittedObjectId); |
| 3013 // 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. |
| 3014 // If this starts failing, consider renumbering the snapshot ids. | 3014 // If this starts failing, consider renumbering the snapshot ids. |
| 3015 EXPECT_EQ(1, writer.BytesWritten()); | 3015 EXPECT_EQ(1, writer.BytesWritten()); |
| 3016 } | 3016 } |
| 3017 | 3017 |
| 3018 } // namespace dart | 3018 } // namespace dart |
| OLD | NEW |