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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 writer.WriteObject(bigint.raw()); | 436 writer.WriteObject(bigint.raw()); |
437 writer.FinalizeBuffer(); | 437 writer.FinalizeBuffer(); |
438 | 438 |
439 // Create a snapshot object using the buffer. | 439 // Create a snapshot object using the buffer. |
440 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); | 440 const Snapshot* snapshot = Snapshot::SetupFromBuffer(buffer); |
441 | 441 |
442 // Read object back from the snapshot. | 442 // Read object back from the snapshot. |
443 SnapshotReader reader(snapshot, Isolate::Current()); | 443 SnapshotReader reader(snapshot, Isolate::Current()); |
444 Bigint& serialized_bigint = Bigint::Handle(); | 444 Bigint& serialized_bigint = Bigint::Handle(); |
445 serialized_bigint ^= reader.ReadObject(); | 445 serialized_bigint ^= reader.ReadObject(); |
446 const char *str1 = BigintOperations::ToDecCString(bigint, allocator); | 446 const char *str1 = BigintOperations::ToHexCString(bigint, allocator); |
447 const char *str2 = | 447 const char *str2 = |
448 BigintOperations::ToDecCString(serialized_bigint, allocator); | 448 BigintOperations::ToHexCString(serialized_bigint, allocator); |
449 EXPECT_STREQ(str1, str2); | 449 EXPECT_STREQ(str1, str2); |
450 free(const_cast<char*>(str1)); | 450 free(const_cast<char*>(str1)); |
451 free(const_cast<char*>(str2)); | 451 free(const_cast<char*>(str2)); |
452 | 452 |
453 // Read object back from the snapshot into a C structure. | 453 // Read object back from the snapshot into a C structure. |
454 ApiNativeScope scope; | 454 ApiNativeScope scope; |
455 Dart_CObject* root = DecodeMessage(buffer + Snapshot::kHeaderSize, | 455 Dart_CObject* root = DecodeMessage(buffer + Snapshot::kHeaderSize, |
456 writer.BytesWritten(), | 456 writer.BytesWritten(), |
457 &zone_allocator); | 457 &zone_allocator); |
458 // Bigint not supported. | 458 // Bigint not supported. |
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1558 EXPECT(Dart_ErrorHasException(result)); | 1558 EXPECT(Dart_ErrorHasException(result)); |
1559 EXPECT_SUBSTRING("Exception: nulltruefalse1234563.14[]100123456789\n", | 1559 EXPECT_SUBSTRING("Exception: nulltruefalse1234563.14[]100123456789\n", |
1560 Dart_GetError(result)); | 1560 Dart_GetError(result)); |
1561 | 1561 |
1562 Dart_ExitScope(); | 1562 Dart_ExitScope(); |
1563 } | 1563 } |
1564 | 1564 |
1565 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 1565 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
1566 | 1566 |
1567 } // namespace dart | 1567 } // namespace dart |
OLD | NEW |