Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: runtime/vm/snapshot.cc

Issue 2654443003: Revert "VM: Fix memory leaks during isolate spawning" (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/snapshot.h ('k') | tests/isolate/isolate.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1901 for (RawObject** current = first; current <= last; current++) { 1901 for (RawObject** current = first; current <= last; current++) {
1902 RawObject* raw_obj = *current; 1902 RawObject* raw_obj = *current;
1903 writer_->WriteObjectImpl(raw_obj, as_references_); 1903 writer_->WriteObjectImpl(raw_obj, as_references_);
1904 } 1904 }
1905 } 1905 }
1906 1906
1907 1907
1908 MessageWriter::MessageWriter(uint8_t** buffer, 1908 MessageWriter::MessageWriter(uint8_t** buffer,
1909 ReAlloc alloc, 1909 ReAlloc alloc,
1910 DeAlloc dealloc, 1910 DeAlloc dealloc,
1911 bool can_send_any_object, 1911 bool can_send_any_object)
1912 intptr_t* buffer_len)
1913 : SnapshotWriter(Thread::Current(), 1912 : SnapshotWriter(Thread::Current(),
1914 Snapshot::kMessage, 1913 Snapshot::kMessage,
1915 buffer, 1914 buffer,
1916 alloc, 1915 alloc,
1917 dealloc, 1916 dealloc,
1918 kInitialSize, 1917 kInitialSize,
1919 &forward_list_, 1918 &forward_list_,
1920 can_send_any_object), 1919 can_send_any_object),
1921 forward_list_(thread(), kMaxPredefinedObjectIds), 1920 forward_list_(thread(), kMaxPredefinedObjectIds) {
1922 buffer_len_(buffer_len) {
1923 ASSERT(buffer != NULL); 1921 ASSERT(buffer != NULL);
1924 ASSERT(alloc != NULL); 1922 ASSERT(alloc != NULL);
1925 } 1923 }
1926 1924
1927 1925
1928 void MessageWriter::WriteMessage(const Object& obj) { 1926 void MessageWriter::WriteMessage(const Object& obj) {
1929 ASSERT(kind() == Snapshot::kMessage); 1927 ASSERT(kind() == Snapshot::kMessage);
1930 ASSERT(isolate() != NULL); 1928 ASSERT(isolate() != NULL);
1931 1929
1932 // Setup for long jump in case there is an exception while writing 1930 // Setup for long jump in case there is an exception while writing
1933 // the message. 1931 // the message.
1934 LongJumpScope jump; 1932 LongJumpScope jump;
1935 if (setjmp(*jump.Set()) == 0) { 1933 if (setjmp(*jump.Set()) == 0) {
1936 NoSafepointScope no_safepoint; 1934 NoSafepointScope no_safepoint;
1937 WriteObject(obj.raw()); 1935 WriteObject(obj.raw());
1938 if (buffer_len_ != NULL) {
1939 *buffer_len_ = BytesWritten();
1940 }
1941 } else { 1936 } else {
1942 FreeBuffer(); 1937 FreeBuffer();
1943 ThrowException(exception_type(), exception_msg()); 1938 ThrowException(exception_type(), exception_msg());
1944 } 1939 }
1945 } 1940 }
1946 1941
1947 1942
1948 } // namespace dart 1943 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/snapshot.h ('k') | tests/isolate/isolate.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698