Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: runtime/vm/snapshot_test.cc

Issue 10375007: Revert "Implement {Int,Uint}{8,16,32,64} and Float{32,64} typed arrays." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 } 648 }
649 649
650 650
651 TEST_CASE(SerializeByteArray) { 651 TEST_CASE(SerializeByteArray) {
652 Zone zone(Isolate::Current()); 652 Zone zone(Isolate::Current());
653 653
654 // Write snapshot with object content. 654 // Write snapshot with object content.
655 uint8_t* buffer; 655 uint8_t* buffer;
656 SnapshotWriter writer(Snapshot::kMessage, &buffer, &zone_allocator); 656 SnapshotWriter writer(Snapshot::kMessage, &buffer, &zone_allocator);
657 const int kByteArrayLength = 256; 657 const int kByteArrayLength = 256;
658 Uint8Array& byte_array = 658 InternalByteArray& byte_array =
659 Uint8Array::Handle(Uint8Array::New(kByteArrayLength)); 659 InternalByteArray::Handle(InternalByteArray::New(kByteArrayLength));
660 for (int i = 0; i < kByteArrayLength; i++) { 660 for (int i = 0; i < kByteArrayLength; i++) {
661 byte_array.SetAt(i, i); 661 byte_array.SetAt<uint8_t>(i, i);
662 } 662 }
663 writer.WriteObject(byte_array.raw()); 663 writer.WriteObject(byte_array.raw());
664 writer.FinalizeBuffer(); 664 writer.FinalizeBuffer();
665 665
666 // Create a snapshot object using the buffer. 666 // Create a snapshot object using the buffer.
667 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); 667 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer);
668 668
669 // Read object back from the snapshot. 669 // Read object back from the snapshot.
670 SnapshotReader reader(snapshot, Isolate::Current()); 670 SnapshotReader reader(snapshot, Isolate::Current());
671 ByteArray& serialized_byte_array = ByteArray::Handle(); 671 ByteArray& serialized_byte_array = ByteArray::Handle();
(...skipping 14 matching lines...) Expand all
686 } 686 }
687 687
688 688
689 TEST_CASE(SerializeEmptyByteArray) { 689 TEST_CASE(SerializeEmptyByteArray) {
690 Zone zone(Isolate::Current()); 690 Zone zone(Isolate::Current());
691 691
692 // Write snapshot with object content. 692 // Write snapshot with object content.
693 uint8_t* buffer; 693 uint8_t* buffer;
694 SnapshotWriter writer(Snapshot::kMessage, &buffer, &zone_allocator); 694 SnapshotWriter writer(Snapshot::kMessage, &buffer, &zone_allocator);
695 const int kByteArrayLength = 0; 695 const int kByteArrayLength = 0;
696 Uint8Array& byte_array = 696 InternalByteArray& byte_array =
697 Uint8Array::Handle(Uint8Array::New(kByteArrayLength)); 697 InternalByteArray::Handle(InternalByteArray::New(kByteArrayLength));
698 writer.WriteObject(byte_array.raw()); 698 writer.WriteObject(byte_array.raw());
699 writer.FinalizeBuffer(); 699 writer.FinalizeBuffer();
700 700
701 // Create a snapshot object using the buffer. 701 // Create a snapshot object using the buffer.
702 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); 702 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer);
703 703
704 // Read object back from the snapshot. 704 // Read object back from the snapshot.
705 SnapshotReader reader(snapshot, Isolate::Current()); 705 SnapshotReader reader(snapshot, Isolate::Current());
706 ByteArray& serialized_byte_array = ByteArray::Handle(); 706 ByteArray& serialized_byte_array = ByteArray::Handle();
707 serialized_byte_array ^= reader.ReadObject(); 707 serialized_byte_array ^= reader.ReadObject();
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 EXPECT(Dart_ErrorHasException(result)); 1532 EXPECT(Dart_ErrorHasException(result));
1533 EXPECT_SUBSTRING("Exception: nulltruefalse1234563.14[]100123456789\n", 1533 EXPECT_SUBSTRING("Exception: nulltruefalse1234563.14[]100123456789\n",
1534 Dart_GetError(result)); 1534 Dart_GetError(result));
1535 1535
1536 Dart_ExitScope(); 1536 Dart_ExitScope();
1537 } 1537 }
1538 1538
1539 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 1539 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
1540 1540
1541 } // namespace dart 1541 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698