Chromium Code Reviews| 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/raw_object.h" | 5 #include "vm/raw_object.h" |
| 6 | 6 |
| 7 #include "vm/class_table.h" | 7 #include "vm/class_table.h" |
| 8 #include "vm/dart.h" | 8 #include "vm/dart.h" |
| 9 #include "vm/freelist.h" | 9 #include "vm/freelist.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 } | 209 } |
| 210 default: | 210 default: |
| 211 UNREACHABLE(); | 211 UNREACHABLE(); |
| 212 break; | 212 break; |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 ASSERT(instance_size != 0); | 215 ASSERT(instance_size != 0); |
| 216 #if defined(DEBUG) | 216 #if defined(DEBUG) |
| 217 uword tags = ptr()->tags_; | 217 uword tags = ptr()->tags_; |
| 218 intptr_t tags_size = SizeTag::decode(tags); | 218 intptr_t tags_size = SizeTag::decode(tags); |
| 219 if ((instance_size > tags_size && tags_size > 0) && (class_id == kArrayCid)) { | |
|
Ivan Posva
2015/02/19 22:43:56
"if ((class_id == kArrayCid) && ...) {"
is a bit
koda
2015/02/19 22:48:49
Agreed.
Slightly less efficient, but OK since thi
| |
| 220 // TODO(22501): Array::MakeArray could be in the process of shrinking | |
| 221 // the array (see comment therein). Wait a millisecond and try again. | |
| 222 int retries_remaining = 1000; // ... but not forever. | |
| 223 do { | |
| 224 OS::Sleep(1); | |
| 225 const RawArray* raw_array = reinterpret_cast<const RawArray*>(this); | |
| 226 intptr_t array_length = Smi::Value(raw_array->ptr()->length_); | |
| 227 instance_size = Array::InstanceSize(array_length); | |
|
Ivan Posva
2015/02/19 22:43:56
Might need a comment why you are only reloading th
koda
2015/02/19 22:48:49
Done.
| |
| 228 } while ((instance_size > tags_size) && (--retries_remaining > 0)); | |
| 229 } | |
| 219 if ((instance_size != tags_size) && (tags_size != 0)) { | 230 if ((instance_size != tags_size) && (tags_size != 0)) { |
| 220 FATAL3("Size mismatch: %" Pd " from class vs %" Pd " from tags %" Px "\n", | 231 FATAL3("Size mismatch: %" Pd " from class vs %" Pd " from tags %" Px "\n", |
| 221 instance_size, tags_size, tags); | 232 instance_size, tags_size, tags); |
| 222 } | 233 } |
| 223 #endif // DEBUG | 234 #endif // DEBUG |
| 224 return instance_size; | 235 return instance_size; |
| 225 } | 236 } |
| 226 | 237 |
| 227 | 238 |
| 228 #if defined(DEBUG) | 239 #if defined(DEBUG) |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 924 intptr_t RawUserTag::VisitUserTagPointers( | 935 intptr_t RawUserTag::VisitUserTagPointers( |
| 925 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { | 936 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { |
| 926 // Make sure that we got here with the tagged pointer as this. | 937 // Make sure that we got here with the tagged pointer as this. |
| 927 ASSERT(raw_obj->IsHeapObject()); | 938 ASSERT(raw_obj->IsHeapObject()); |
| 928 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 939 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 929 return UserTag::InstanceSize(); | 940 return UserTag::InstanceSize(); |
| 930 } | 941 } |
| 931 | 942 |
| 932 | 943 |
| 933 } // namespace dart | 944 } // namespace dart |
| OLD | NEW |