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_debugger_api.h" | 7 #include "include/dart_debugger_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 array.SetAt(i, smi); | 565 array.SetAt(i, smi); |
566 } | 566 } |
567 writer.WriteMessage(array); | 567 writer.WriteMessage(array); |
568 intptr_t buffer_len = writer.BytesWritten(); | 568 intptr_t buffer_len = writer.BytesWritten(); |
569 | 569 |
570 // Read object back from the snapshot. | 570 // Read object back from the snapshot. |
571 SnapshotReader reader(buffer, buffer_len, | 571 SnapshotReader reader(buffer, buffer_len, |
572 Snapshot::kMessage, Isolate::Current()); | 572 Snapshot::kMessage, Isolate::Current()); |
573 Array& serialized_array = Array::Handle(); | 573 Array& serialized_array = Array::Handle(); |
574 serialized_array ^= reader.ReadObject(); | 574 serialized_array ^= reader.ReadObject(); |
575 EXPECT(array.Equals(serialized_array)); | 575 EXPECT(array.CanonicalizeEquals(serialized_array)); |
576 | 576 |
577 // Read object back from the snapshot into a C structure. | 577 // Read object back from the snapshot into a C structure. |
578 ApiNativeScope scope; | 578 ApiNativeScope scope; |
579 ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator); | 579 ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator); |
580 Dart_CObject* root = api_reader.ReadMessage(); | 580 Dart_CObject* root = api_reader.ReadMessage(); |
581 EXPECT_EQ(Dart_CObject_kArray, root->type); | 581 EXPECT_EQ(Dart_CObject_kArray, root->type); |
582 EXPECT_EQ(kArrayLength, root->value.as_array.length); | 582 EXPECT_EQ(kArrayLength, root->value.as_array.length); |
583 for (int i = 0; i < kArrayLength; i++) { | 583 for (int i = 0; i < kArrayLength; i++) { |
584 Dart_CObject* element = root->value.as_array.values[i]; | 584 Dart_CObject* element = root->value.as_array.values[i]; |
585 EXPECT_EQ(Dart_CObject_kInt32, element->type); | 585 EXPECT_EQ(Dart_CObject_kInt32, element->type); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 const int kArrayLength = 0; | 650 const int kArrayLength = 0; |
651 Array& array = Array::Handle(Array::New(kArrayLength)); | 651 Array& array = Array::Handle(Array::New(kArrayLength)); |
652 writer.WriteMessage(array); | 652 writer.WriteMessage(array); |
653 intptr_t buffer_len = writer.BytesWritten(); | 653 intptr_t buffer_len = writer.BytesWritten(); |
654 | 654 |
655 // Read object back from the snapshot. | 655 // Read object back from the snapshot. |
656 SnapshotReader reader(buffer, buffer_len, | 656 SnapshotReader reader(buffer, buffer_len, |
657 Snapshot::kMessage, Isolate::Current()); | 657 Snapshot::kMessage, Isolate::Current()); |
658 Array& serialized_array = Array::Handle(); | 658 Array& serialized_array = Array::Handle(); |
659 serialized_array ^= reader.ReadObject(); | 659 serialized_array ^= reader.ReadObject(); |
660 EXPECT(array.Equals(serialized_array)); | 660 EXPECT(array.CanonicalizeEquals(serialized_array)); |
661 | 661 |
662 // Read object back from the snapshot into a C structure. | 662 // Read object back from the snapshot into a C structure. |
663 ApiNativeScope scope; | 663 ApiNativeScope scope; |
664 ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator); | 664 ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator); |
665 Dart_CObject* root = api_reader.ReadMessage(); | 665 Dart_CObject* root = api_reader.ReadMessage(); |
666 EXPECT_EQ(Dart_CObject_kArray, root->type); | 666 EXPECT_EQ(Dart_CObject_kArray, root->type); |
667 EXPECT_EQ(kArrayLength, root->value.as_array.length); | 667 EXPECT_EQ(kArrayLength, root->value.as_array.length); |
668 EXPECT(root->value.as_array.values == NULL); | 668 EXPECT(root->value.as_array.values == NULL); |
669 CheckEncodeDecodeMessage(root); | 669 CheckEncodeDecodeMessage(root); |
670 } | 670 } |
(...skipping 2039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2710 result = Dart_RunLoop(); | 2710 result = Dart_RunLoop(); |
2711 EXPECT(Dart_IsError(result)); | 2711 EXPECT(Dart_IsError(result)); |
2712 EXPECT(Dart_ErrorHasException(result)); | 2712 EXPECT(Dart_ErrorHasException(result)); |
2713 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", | 2713 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", |
2714 Dart_GetError(result)); | 2714 Dart_GetError(result)); |
2715 | 2715 |
2716 Dart_ExitScope(); | 2716 Dart_ExitScope(); |
2717 } | 2717 } |
2718 | 2718 |
2719 } // namespace dart | 2719 } // namespace dart |
OLD | NEW |