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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 const intptr_t kMessageBufferSize = 256; | 589 const intptr_t kMessageBufferSize = 256; |
590 char message_buffer[kMessageBufferSize]; | 590 char message_buffer[kMessageBufferSize]; |
591 char* actual_version = OS::StrNDup(version, version_len); | 591 char* actual_version = OS::StrNDup(version, version_len); |
592 OS::SNPrint(message_buffer, | 592 OS::SNPrint(message_buffer, |
593 kMessageBufferSize, | 593 kMessageBufferSize, |
594 "Wrong %s snapshot version, expected '%s' found '%s'", | 594 "Wrong %s snapshot version, expected '%s' found '%s'", |
595 (kind_ == Snapshot::kFull) ? "full" : "script", | 595 (kind_ == Snapshot::kFull) ? "full" : "script", |
596 Version::SnapshotString(), | 596 Version::SnapshotString(), |
597 actual_version); | 597 actual_version); |
598 free(actual_version); | 598 free(actual_version); |
599 const String& msg = String::Handle(String::New(message_buffer)); | 599 // This can also fail while bringing up the VM isolate, so make sure to |
600 return ApiError::New(msg); | 600 // allocate the error message in old space. |
| 601 const String& msg = String::Handle(String::New(message_buffer, Heap::kOld)); |
| 602 return ApiError::New(msg, Heap::kOld); |
601 } | 603 } |
602 Advance(version_len); | 604 Advance(version_len); |
603 return ApiError::null(); | 605 return ApiError::null(); |
604 } | 606 } |
605 | 607 |
606 | 608 |
607 #define ALLOC_NEW_OBJECT_WITH_LEN(type, length) \ | 609 #define ALLOC_NEW_OBJECT_WITH_LEN(type, length) \ |
608 ASSERT(kind_ == Snapshot::kFull); \ | 610 ASSERT(kind_ == Snapshot::kFull); \ |
609 ASSERT(isolate()->no_safepoint_scope_depth() != 0); \ | 611 ASSERT(isolate()->no_safepoint_scope_depth() != 0); \ |
610 Raw##type* obj = reinterpret_cast<Raw##type*>( \ | 612 Raw##type* obj = reinterpret_cast<Raw##type*>( \ |
(...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2291 NoSafepointScope no_safepoint; | 2293 NoSafepointScope no_safepoint; |
2292 WriteObject(obj.raw()); | 2294 WriteObject(obj.raw()); |
2293 UnmarkAll(); | 2295 UnmarkAll(); |
2294 } else { | 2296 } else { |
2295 ThrowException(exception_type(), exception_msg()); | 2297 ThrowException(exception_type(), exception_msg()); |
2296 } | 2298 } |
2297 } | 2299 } |
2298 | 2300 |
2299 | 2301 |
2300 } // namespace dart | 2302 } // namespace dart |
OLD | NEW |