| 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 | 368 |
| 369 | 369 |
| 370 TEST_CASE(SerializeBigint) { | 370 TEST_CASE(SerializeBigint) { |
| 371 StackZone zone(Isolate::Current()); | 371 StackZone zone(Isolate::Current()); |
| 372 | 372 |
| 373 // Write snapshot with object content. | 373 // Write snapshot with object content. |
| 374 uint8_t* buffer; | 374 uint8_t* buffer; |
| 375 MessageWriter writer(&buffer, &zone_allocator); | 375 MessageWriter writer(&buffer, &zone_allocator); |
| 376 const char* cstr = "0x270FFFFFFFFFFFFFD8F0"; | 376 const char* cstr = "0x270FFFFFFFFFFFFFD8F0"; |
| 377 const String& str = String::Handle(String::New(cstr)); | 377 const String& str = String::Handle(String::New(cstr)); |
| 378 const Bigint& bigint = Bigint::Handle(Bigint::New(str)); | 378 const Bigint& bigint = Bigint::Handle(Bigint::NewCanonical(str)); |
| 379 writer.WriteMessage(bigint); | 379 writer.WriteMessage(bigint); |
| 380 intptr_t buffer_len = writer.BytesWritten(); | 380 intptr_t buffer_len = writer.BytesWritten(); |
| 381 | 381 |
| 382 // Read object back from the snapshot. | 382 // Read object back from the snapshot. |
| 383 SnapshotReader reader(buffer, buffer_len, | 383 SnapshotReader reader(buffer, buffer_len, |
| 384 Snapshot::kMessage, Isolate::Current()); | 384 Snapshot::kMessage, Isolate::Current()); |
| 385 Bigint& obj = Bigint::Handle(); | 385 Bigint& obj = Bigint::Handle(); |
| 386 obj ^= reader.ReadObject(); | 386 obj ^= reader.ReadObject(); |
| 387 | 387 |
| 388 EXPECT_STREQ(BigintOperations::ToHexCString(bigint, &allocator), | 388 EXPECT_STREQ(BigintOperations::ToHexCString(bigint, &allocator), |
| (...skipping 1758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2147 EXPECT(Dart_ErrorHasException(result)); | 2147 EXPECT(Dart_ErrorHasException(result)); |
| 2148 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", | 2148 EXPECT_SUBSTRING("Exception: nulltruefalse123456æøå3.14[]100123456789\n", |
| 2149 Dart_GetError(result)); | 2149 Dart_GetError(result)); |
| 2150 | 2150 |
| 2151 Dart_ExitScope(); | 2151 Dart_ExitScope(); |
| 2152 } | 2152 } |
| 2153 | 2153 |
| 2154 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 2154 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 2155 | 2155 |
| 2156 } // namespace dart | 2156 } // namespace dart |
| OLD | NEW |