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

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

Issue 1250463004: Migrate NoSafepointScope; add constrained concurrent allocation to unit test (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Assert current thread is mutator; add shared assertion macro. Created 5 years, 5 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/object_graph.cc ('k') | runtime/vm/snapshot.cc » ('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/object.h" 5 #include "vm/object.h"
6 #include "vm/object_store.h" 6 #include "vm/object_store.h"
7 #include "vm/snapshot.h" 7 #include "vm/snapshot.h"
8 #include "vm/stub_code.h" 8 #include "vm/stub_code.h"
9 #include "vm/symbols.h" 9 #include "vm/symbols.h"
10 #include "vm/visitor.h" 10 #include "vm/visitor.h"
(...skipping 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after
2052 intptr_t object_id, 2052 intptr_t object_id,
2053 intptr_t tags, 2053 intptr_t tags,
2054 Snapshot::Kind kind) { 2054 Snapshot::Kind kind) {
2055 // Read the length so that we can determine instance size to allocate. 2055 // Read the length so that we can determine instance size to allocate.
2056 ASSERT(reader != NULL); 2056 ASSERT(reader != NULL);
2057 intptr_t len = reader->ReadSmiValue(); 2057 intptr_t len = reader->ReadSmiValue();
2058 intptr_t hash = reader->ReadSmiValue(); 2058 intptr_t hash = reader->ReadSmiValue();
2059 String& str_obj = String::Handle(reader->zone(), String::null()); 2059 String& str_obj = String::Handle(reader->zone(), String::null());
2060 2060
2061 if (kind == Snapshot::kFull) { 2061 if (kind == Snapshot::kFull) {
2062 ASSERT(reader->isolate()->no_safepoint_scope_depth() != 0); 2062 // We currently only expect the Dart mutator to read snapshots.
2063 reader->isolate()->AssertCurrentThreadIsMutator();
2064 ASSERT(Thread::Current()->no_safepoint_scope_depth() != 0);
2063 RawOneByteString* obj = reader->NewOneByteString(len); 2065 RawOneByteString* obj = reader->NewOneByteString(len);
2064 str_obj = obj; 2066 str_obj = obj;
2065 str_obj.set_tags(tags); 2067 str_obj.set_tags(tags);
2066 str_obj.SetHash(hash); 2068 str_obj.SetHash(hash);
2067 if (len > 0) { 2069 if (len > 0) {
2068 uint8_t* raw_ptr = CharAddr(str_obj, 0); 2070 uint8_t* raw_ptr = CharAddr(str_obj, 0);
2069 reader->ReadBytes(raw_ptr, len); 2071 reader->ReadBytes(raw_ptr, len);
2070 } 2072 }
2071 ASSERT((hash == 0) || (String::Hash(str_obj, 0, str_obj.Length()) == hash)); 2073 ASSERT((hash == 0) || (String::Hash(str_obj, 0, str_obj.Length()) == hash));
2072 } else { 2074 } else {
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
3097 // We do not allow objects with native fields in an isolate message. 3099 // We do not allow objects with native fields in an isolate message.
3098 writer->SetWriteException(Exceptions::kArgument, 3100 writer->SetWriteException(Exceptions::kArgument,
3099 "Illegal argument in isolate message" 3101 "Illegal argument in isolate message"
3100 " : (object is a UserTag)"); 3102 " : (object is a UserTag)");
3101 } else { 3103 } else {
3102 UNREACHABLE(); 3104 UNREACHABLE();
3103 } 3105 }
3104 } 3106 }
3105 3107
3106 } // namespace dart 3108 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object_graph.cc ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698