| 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 "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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 CheckBigint("0x9876543210987654321098765432109876543210"); | 452 CheckBigint("0x9876543210987654321098765432109876543210"); |
| 453 CheckBigint("-0x9876543210987654321098765432109876543210"); | 453 CheckBigint("-0x9876543210987654321098765432109876543210"); |
| 454 } | 454 } |
| 455 | 455 |
| 456 TEST_CASE(SerializeSingletons) { | 456 TEST_CASE(SerializeSingletons) { |
| 457 // Write snapshot with object content. | 457 // Write snapshot with object content. |
| 458 uint8_t* buffer; | 458 uint8_t* buffer; |
| 459 MessageWriter writer(&buffer, &malloc_allocator); | 459 MessageWriter writer(&buffer, &malloc_allocator); |
| 460 writer.WriteObject(Object::class_class()); | 460 writer.WriteObject(Object::class_class()); |
| 461 writer.WriteObject(Object::null_class()); | 461 writer.WriteObject(Object::null_class()); |
| 462 writer.WriteObject(Object::type_class()); | |
| 463 writer.WriteObject(Object::type_parameter_class()); | |
| 464 writer.WriteObject(Object::type_arguments_class()); | 462 writer.WriteObject(Object::type_arguments_class()); |
| 465 writer.WriteObject(Object::instantiated_type_arguments_class()); | 463 writer.WriteObject(Object::instantiated_type_arguments_class()); |
| 466 writer.WriteObject(Object::function_class()); | 464 writer.WriteObject(Object::function_class()); |
| 467 writer.WriteObject(Object::field_class()); | 465 writer.WriteObject(Object::field_class()); |
| 468 writer.WriteObject(Object::token_stream_class()); | 466 writer.WriteObject(Object::token_stream_class()); |
| 469 writer.WriteObject(Object::script_class()); | 467 writer.WriteObject(Object::script_class()); |
| 470 writer.WriteObject(Object::library_class()); | 468 writer.WriteObject(Object::library_class()); |
| 471 writer.WriteObject(Object::code_class()); | 469 writer.WriteObject(Object::code_class()); |
| 472 writer.WriteObject(Object::instructions_class()); | 470 writer.WriteObject(Object::instructions_class()); |
| 473 writer.WriteObject(Object::pc_descriptors_class()); | 471 writer.WriteObject(Object::pc_descriptors_class()); |
| 474 writer.WriteObject(Object::exception_handlers_class()); | 472 writer.WriteObject(Object::exception_handlers_class()); |
| 475 writer.WriteObject(Object::context_class()); | 473 writer.WriteObject(Object::context_class()); |
| 476 writer.WriteObject(Object::context_scope_class()); | 474 writer.WriteObject(Object::context_scope_class()); |
| 477 intptr_t buffer_len = writer.BytesWritten(); | 475 intptr_t buffer_len = writer.BytesWritten(); |
| 478 | 476 |
| 479 // Read object back from the snapshot. | 477 // Read object back from the snapshot. |
| 480 SnapshotReader reader(buffer, buffer_len, Snapshot::kMessage, | 478 SnapshotReader reader(buffer, buffer_len, Snapshot::kMessage, |
| 481 Isolate::Current()); | 479 Isolate::Current()); |
| 482 EXPECT(Object::class_class() == reader.ReadObject()); | 480 EXPECT(Object::class_class() == reader.ReadObject()); |
| 483 EXPECT(Object::null_class() == reader.ReadObject()); | 481 EXPECT(Object::null_class() == reader.ReadObject()); |
| 484 EXPECT(Object::type_class() == reader.ReadObject()); | |
| 485 EXPECT(Object::type_parameter_class() == reader.ReadObject()); | |
| 486 EXPECT(Object::type_arguments_class() == reader.ReadObject()); | 482 EXPECT(Object::type_arguments_class() == reader.ReadObject()); |
| 487 EXPECT(Object::instantiated_type_arguments_class() == reader.ReadObject()); | 483 EXPECT(Object::instantiated_type_arguments_class() == reader.ReadObject()); |
| 488 EXPECT(Object::function_class() == reader.ReadObject()); | 484 EXPECT(Object::function_class() == reader.ReadObject()); |
| 489 EXPECT(Object::field_class() == reader.ReadObject()); | 485 EXPECT(Object::field_class() == reader.ReadObject()); |
| 490 EXPECT(Object::token_stream_class() == reader.ReadObject()); | 486 EXPECT(Object::token_stream_class() == reader.ReadObject()); |
| 491 EXPECT(Object::script_class() == reader.ReadObject()); | 487 EXPECT(Object::script_class() == reader.ReadObject()); |
| 492 EXPECT(Object::library_class() == reader.ReadObject()); | 488 EXPECT(Object::library_class() == reader.ReadObject()); |
| 493 EXPECT(Object::code_class() == reader.ReadObject()); | 489 EXPECT(Object::code_class() == reader.ReadObject()); |
| 494 EXPECT(Object::instructions_class() == reader.ReadObject()); | 490 EXPECT(Object::instructions_class() == reader.ReadObject()); |
| 495 EXPECT(Object::pc_descriptors_class() == reader.ReadObject()); | 491 EXPECT(Object::pc_descriptors_class() == reader.ReadObject()); |
| (...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1863 EXPECT(Dart_ErrorHasException(result)); | 1859 EXPECT(Dart_ErrorHasException(result)); |
| 1864 EXPECT_SUBSTRING("Exception: nulltruefalse1234563.14[]100123456789\n", | 1860 EXPECT_SUBSTRING("Exception: nulltruefalse1234563.14[]100123456789\n", |
| 1865 Dart_GetError(result)); | 1861 Dart_GetError(result)); |
| 1866 | 1862 |
| 1867 Dart_ExitScope(); | 1863 Dart_ExitScope(); |
| 1868 } | 1864 } |
| 1869 | 1865 |
| 1870 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 1866 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 1871 | 1867 |
| 1872 } // namespace dart | 1868 } // namespace dart |
| OLD | NEW |