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

Side by Side Diff: runtime/vm/object.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.h ('k') | runtime/vm/object_graph.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 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 } 892 }
893 893
894 894
895 // Make unused space in an object whose type has been transformed safe 895 // Make unused space in an object whose type has been transformed safe
896 // for traversing during GC. 896 // for traversing during GC.
897 // The unused part of the transformed object is marked as an TypedDataInt8Array 897 // The unused part of the transformed object is marked as an TypedDataInt8Array
898 // object. 898 // object.
899 void Object::MakeUnusedSpaceTraversable(const Object& obj, 899 void Object::MakeUnusedSpaceTraversable(const Object& obj,
900 intptr_t original_size, 900 intptr_t original_size,
901 intptr_t used_size) { 901 intptr_t used_size) {
902 ASSERT(Isolate::Current()->no_safepoint_scope_depth() > 0); 902 ASSERT(Thread::Current()->no_safepoint_scope_depth() > 0);
903 ASSERT(!obj.IsNull()); 903 ASSERT(!obj.IsNull());
904 ASSERT(original_size >= used_size); 904 ASSERT(original_size >= used_size);
905 if (original_size > used_size) { 905 if (original_size > used_size) {
906 intptr_t leftover_size = original_size - used_size; 906 intptr_t leftover_size = original_size - used_size;
907 907
908 uword addr = RawObject::ToAddr(obj.raw()) + used_size; 908 uword addr = RawObject::ToAddr(obj.raw()) + used_size;
909 if (leftover_size >= TypedData::InstanceSize(0)) { 909 if (leftover_size >= TypedData::InstanceSize(0)) {
910 // Update the leftover space as a TypedDataInt8Array object. 910 // Update the leftover space as a TypedDataInt8Array object.
911 RawTypedData* raw = 911 RawTypedData* raw =
912 reinterpret_cast<RawTypedData*>(RawObject::FromAddr(addr)); 912 reinterpret_cast<RawTypedData*>(RawObject::FromAddr(addr));
(...skipping 13381 matching lines...) Expand 10 before | Expand all | Expand 10 after
14294 return Integer::Cast(*this).Equals(other); 14294 return Integer::Cast(*this).Equals(other);
14295 } 14295 }
14296 if (IsDouble() && other.IsDouble()) { 14296 if (IsDouble() && other.IsDouble()) {
14297 return Double::Cast(*this).CanonicalizeEquals(other); 14297 return Double::Cast(*this).CanonicalizeEquals(other);
14298 } 14298 }
14299 return false; 14299 return false;
14300 } 14300 }
14301 14301
14302 14302
14303 intptr_t* Instance::NativeFieldsDataAddr() const { 14303 intptr_t* Instance::NativeFieldsDataAddr() const {
14304 ASSERT(Isolate::Current()->no_safepoint_scope_depth() > 0); 14304 ASSERT(Thread::Current()->no_safepoint_scope_depth() > 0);
14305 RawTypedData* native_fields = 14305 RawTypedData* native_fields =
14306 reinterpret_cast<RawTypedData*>(*NativeFieldsAddr()); 14306 reinterpret_cast<RawTypedData*>(*NativeFieldsAddr());
14307 if (native_fields == TypedData::null()) { 14307 if (native_fields == TypedData::null()) {
14308 return NULL; 14308 return NULL;
14309 } 14309 }
14310 return reinterpret_cast<intptr_t*>(native_fields->ptr()->data()); 14310 return reinterpret_cast<intptr_t*>(native_fields->ptr()->data());
14311 } 14311 }
14312 14312
14313 14313
14314 void Instance::SetNativeField(int index, intptr_t value) const { 14314 void Instance::SetNativeField(int index, intptr_t value) const {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
14443 if (IsNull()) { 14443 if (IsNull()) {
14444 return "null"; 14444 return "null";
14445 } else if (raw() == Object::sentinel().raw()) { 14445 } else if (raw() == Object::sentinel().raw()) {
14446 return "sentinel"; 14446 return "sentinel";
14447 } else if (raw() == Object::transition_sentinel().raw()) { 14447 } else if (raw() == Object::transition_sentinel().raw()) {
14448 return "transition_sentinel"; 14448 return "transition_sentinel";
14449 } else if (raw() == Object::unknown_constant().raw()) { 14449 } else if (raw() == Object::unknown_constant().raw()) {
14450 return "unknown_constant"; 14450 return "unknown_constant";
14451 } else if (raw() == Object::non_constant().raw()) { 14451 } else if (raw() == Object::non_constant().raw()) {
14452 return "non_constant"; 14452 return "non_constant";
14453 } else if (Isolate::Current()->no_safepoint_scope_depth() > 0) { 14453 } else if (Thread::Current()->no_safepoint_scope_depth() > 0) {
14454 // Can occur when running disassembler. 14454 // Can occur when running disassembler.
14455 return "Instance"; 14455 return "Instance";
14456 } else { 14456 } else {
14457 if (IsClosure()) { 14457 if (IsClosure()) {
14458 return Closure::ToCString(*this); 14458 return Closure::ToCString(*this);
14459 } 14459 }
14460 const char* kFormat = "Instance of '%s'"; 14460 const char* kFormat = "Instance of '%s'";
14461 const Class& cls = Class::Handle(clazz()); 14461 const Class& cls = Class::Handle(clazz());
14462 TypeArguments& type_arguments = TypeArguments::Handle(); 14462 TypeArguments& type_arguments = TypeArguments::Handle();
14463 const intptr_t num_type_arguments = cls.NumTypeArguments(); 14463 const intptr_t num_type_arguments = cls.NumTypeArguments();
(...skipping 6746 matching lines...) Expand 10 before | Expand all | Expand 10 after
21210 return tag_label.ToCString(); 21210 return tag_label.ToCString();
21211 } 21211 }
21212 21212
21213 21213
21214 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 21214 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
21215 Instance::PrintJSONImpl(stream, ref); 21215 Instance::PrintJSONImpl(stream, ref);
21216 } 21216 }
21217 21217
21218 21218
21219 } // namespace dart 21219 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_graph.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698