| 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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 | 491 |
| 492 | 492 |
| 493 TEST_CASE(SerializeSingletons) { | 493 TEST_CASE(SerializeSingletons) { |
| 494 // Write snapshot with object content. | 494 // Write snapshot with object content. |
| 495 uint8_t* buffer; | 495 uint8_t* buffer; |
| 496 SnapshotWriter writer(Snapshot::kMessage, &buffer, &malloc_allocator); | 496 SnapshotWriter writer(Snapshot::kMessage, &buffer, &malloc_allocator); |
| 497 writer.WriteObject(Object::class_class()); | 497 writer.WriteObject(Object::class_class()); |
| 498 writer.WriteObject(Object::null_class()); | 498 writer.WriteObject(Object::null_class()); |
| 499 writer.WriteObject(Object::type_class()); | 499 writer.WriteObject(Object::type_class()); |
| 500 writer.WriteObject(Object::type_parameter_class()); | 500 writer.WriteObject(Object::type_parameter_class()); |
| 501 writer.WriteObject(Object::instantiated_type_class()); | |
| 502 writer.WriteObject(Object::abstract_type_arguments_class()); | |
| 503 writer.WriteObject(Object::type_arguments_class()); | 501 writer.WriteObject(Object::type_arguments_class()); |
| 504 writer.WriteObject(Object::instantiated_type_arguments_class()); | 502 writer.WriteObject(Object::instantiated_type_arguments_class()); |
| 505 writer.WriteObject(Object::function_class()); | 503 writer.WriteObject(Object::function_class()); |
| 506 writer.WriteObject(Object::field_class()); | 504 writer.WriteObject(Object::field_class()); |
| 507 writer.WriteObject(Object::token_stream_class()); | 505 writer.WriteObject(Object::token_stream_class()); |
| 508 writer.WriteObject(Object::script_class()); | 506 writer.WriteObject(Object::script_class()); |
| 509 writer.WriteObject(Object::library_class()); | 507 writer.WriteObject(Object::library_class()); |
| 510 writer.WriteObject(Object::code_class()); | 508 writer.WriteObject(Object::code_class()); |
| 511 writer.WriteObject(Object::instructions_class()); | 509 writer.WriteObject(Object::instructions_class()); |
| 512 writer.WriteObject(Object::pc_descriptors_class()); | 510 writer.WriteObject(Object::pc_descriptors_class()); |
| 513 writer.WriteObject(Object::exception_handlers_class()); | 511 writer.WriteObject(Object::exception_handlers_class()); |
| 514 writer.WriteObject(Object::context_class()); | 512 writer.WriteObject(Object::context_class()); |
| 515 writer.WriteObject(Object::context_scope_class()); | 513 writer.WriteObject(Object::context_scope_class()); |
| 516 writer.FinalizeBuffer(); | 514 writer.FinalizeBuffer(); |
| 517 | 515 |
| 518 // Create a snapshot object using the buffer. | 516 // Create a snapshot object using the buffer. |
| 519 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); | 517 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); |
| 520 | 518 |
| 521 // Read object back from the snapshot. | 519 // Read object back from the snapshot. |
| 522 SnapshotReader reader(snapshot, Isolate::Current()); | 520 SnapshotReader reader(snapshot, Isolate::Current()); |
| 523 EXPECT(Object::class_class() == reader.ReadObject()); | 521 EXPECT(Object::class_class() == reader.ReadObject()); |
| 524 EXPECT(Object::null_class() == reader.ReadObject()); | 522 EXPECT(Object::null_class() == reader.ReadObject()); |
| 525 EXPECT(Object::type_class() == reader.ReadObject()); | 523 EXPECT(Object::type_class() == reader.ReadObject()); |
| 526 EXPECT(Object::type_parameter_class() == reader.ReadObject()); | 524 EXPECT(Object::type_parameter_class() == reader.ReadObject()); |
| 527 EXPECT(Object::instantiated_type_class() == reader.ReadObject()); | |
| 528 EXPECT(Object::abstract_type_arguments_class() == reader.ReadObject()); | |
| 529 EXPECT(Object::type_arguments_class() == reader.ReadObject()); | 525 EXPECT(Object::type_arguments_class() == reader.ReadObject()); |
| 530 EXPECT(Object::instantiated_type_arguments_class() == reader.ReadObject()); | 526 EXPECT(Object::instantiated_type_arguments_class() == reader.ReadObject()); |
| 531 EXPECT(Object::function_class() == reader.ReadObject()); | 527 EXPECT(Object::function_class() == reader.ReadObject()); |
| 532 EXPECT(Object::field_class() == reader.ReadObject()); | 528 EXPECT(Object::field_class() == reader.ReadObject()); |
| 533 EXPECT(Object::token_stream_class() == reader.ReadObject()); | 529 EXPECT(Object::token_stream_class() == reader.ReadObject()); |
| 534 EXPECT(Object::script_class() == reader.ReadObject()); | 530 EXPECT(Object::script_class() == reader.ReadObject()); |
| 535 EXPECT(Object::library_class() == reader.ReadObject()); | 531 EXPECT(Object::library_class() == reader.ReadObject()); |
| 536 EXPECT(Object::code_class() == reader.ReadObject()); | 532 EXPECT(Object::code_class() == reader.ReadObject()); |
| 537 EXPECT(Object::instructions_class() == reader.ReadObject()); | 533 EXPECT(Object::instructions_class() == reader.ReadObject()); |
| 538 EXPECT(Object::pc_descriptors_class() == reader.ReadObject()); | 534 EXPECT(Object::pc_descriptors_class() == reader.ReadObject()); |
| (...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1532 EXPECT(Dart_ErrorHasException(result)); | 1528 EXPECT(Dart_ErrorHasException(result)); |
| 1533 EXPECT_SUBSTRING("Exception: nulltruefalse1234563.14[]100123456789\n", | 1529 EXPECT_SUBSTRING("Exception: nulltruefalse1234563.14[]100123456789\n", |
| 1534 Dart_GetError(result)); | 1530 Dart_GetError(result)); |
| 1535 | 1531 |
| 1536 Dart_ExitScope(); | 1532 Dart_ExitScope(); |
| 1537 } | 1533 } |
| 1538 | 1534 |
| 1539 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 1535 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 1540 | 1536 |
| 1541 } // namespace dart | 1537 } // namespace dart |
| OLD | NEW |