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 "vm/snapshot.h" | 5 #include "vm/snapshot.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/bootstrap.h" | 8 #include "vm/bootstrap.h" |
9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 return ApiError::New(msg, Heap::kOld); | 733 return ApiError::New(msg, Heap::kOld); |
734 } | 734 } |
735 Advance(version_len); | 735 Advance(version_len); |
736 | 736 |
737 const char* expected_features = Dart::FeaturesString(kind_); | 737 const char* expected_features = Dart::FeaturesString(kind_); |
738 ASSERT(expected_features != NULL); | 738 ASSERT(expected_features != NULL); |
739 const intptr_t expected_len = strlen(expected_features); | 739 const intptr_t expected_len = strlen(expected_features); |
740 | 740 |
741 const char* features = reinterpret_cast<const char*>(CurrentBufferAddress()); | 741 const char* features = reinterpret_cast<const char*>(CurrentBufferAddress()); |
742 ASSERT(features != NULL); | 742 ASSERT(features != NULL); |
743 intptr_t buffer_len = strnlen(features, PendingBytes()); | 743 intptr_t buffer_len = OS::StrNLen(features, PendingBytes()); |
744 if ((buffer_len != expected_len) || | 744 if ((buffer_len != expected_len) || |
745 strncmp(features, expected_features, expected_len)) { | 745 strncmp(features, expected_features, expected_len)) { |
746 const intptr_t kMessageBufferSize = 256; | 746 const intptr_t kMessageBufferSize = 256; |
747 char message_buffer[kMessageBufferSize]; | 747 char message_buffer[kMessageBufferSize]; |
748 char* actual_features = OS::StrNDup(features, buffer_len < 128 ? buffer_len | 748 char* actual_features = OS::StrNDup(features, buffer_len < 128 ? buffer_len |
749 : 128); | 749 : 128); |
750 OS::SNPrint(message_buffer, | 750 OS::SNPrint(message_buffer, |
751 kMessageBufferSize, | 751 kMessageBufferSize, |
752 "Wrong features in snapshot, expected '%s' found '%s'", | 752 "Wrong features in snapshot, expected '%s' found '%s'", |
753 expected_features, | 753 expected_features, |
(...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2830 if (setjmp(*jump.Set()) == 0) { | 2830 if (setjmp(*jump.Set()) == 0) { |
2831 NoSafepointScope no_safepoint; | 2831 NoSafepointScope no_safepoint; |
2832 WriteObject(obj.raw()); | 2832 WriteObject(obj.raw()); |
2833 } else { | 2833 } else { |
2834 ThrowException(exception_type(), exception_msg()); | 2834 ThrowException(exception_type(), exception_msg()); |
2835 } | 2835 } |
2836 } | 2836 } |
2837 | 2837 |
2838 | 2838 |
2839 } // namespace dart | 2839 } // namespace dart |
OLD | NEW |