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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 uint8_t* buffer; | 401 uint8_t* buffer; |
402 MessageWriter writer(&buffer, &zone_allocator); | 402 MessageWriter writer(&buffer, &zone_allocator); |
403 writer.WriteMessage(bigint); | 403 writer.WriteMessage(bigint); |
404 intptr_t buffer_len = writer.BytesWritten(); | 404 intptr_t buffer_len = writer.BytesWritten(); |
405 | 405 |
406 // Read object back from the snapshot. | 406 // Read object back from the snapshot. |
407 SnapshotReader reader(buffer, buffer_len, | 407 SnapshotReader reader(buffer, buffer_len, |
408 Snapshot::kMessage, Isolate::Current()); | 408 Snapshot::kMessage, Isolate::Current()); |
409 Bigint& serialized_bigint = Bigint::Handle(); | 409 Bigint& serialized_bigint = Bigint::Handle(); |
410 serialized_bigint ^= reader.ReadObject(); | 410 serialized_bigint ^= reader.ReadObject(); |
411 const char *str1 = BigintOperations::ToHexCString(bigint, allocator); | 411 const char* str1 = BigintOperations::ToHexCString(bigint, allocator); |
412 const char *str2 = | 412 const char* str2 = |
413 BigintOperations::ToHexCString(serialized_bigint, allocator); | 413 BigintOperations::ToHexCString(serialized_bigint, allocator); |
414 EXPECT_STREQ(str1, str2); | 414 EXPECT_STREQ(str1, str2); |
415 free(const_cast<char*>(str1)); | 415 free(const_cast<char*>(str1)); |
416 free(const_cast<char*>(str2)); | 416 free(const_cast<char*>(str2)); |
417 | 417 |
418 // Read object back from the snapshot into a C structure. | 418 // Read object back from the snapshot into a C structure. |
419 ApiNativeScope scope; | 419 ApiNativeScope scope; |
420 ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator); | 420 ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator); |
421 Dart_CObject* root = api_reader.ReadMessage(); | 421 Dart_CObject* root = api_reader.ReadMessage(); |
422 // Bigint not supported. | 422 // Bigint not supported. |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1520 EXPECT(Dart_ErrorHasException(result)); | 1520 EXPECT(Dart_ErrorHasException(result)); |
1521 EXPECT_SUBSTRING("Exception: nulltruefalse1234563.14[]100123456789\n", | 1521 EXPECT_SUBSTRING("Exception: nulltruefalse1234563.14[]100123456789\n", |
1522 Dart_GetError(result)); | 1522 Dart_GetError(result)); |
1523 | 1523 |
1524 Dart_ExitScope(); | 1524 Dart_ExitScope(); |
1525 } | 1525 } |
1526 | 1526 |
1527 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 1527 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
1528 | 1528 |
1529 } // namespace dart | 1529 } // namespace dart |
OLD | NEW |