| 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 #ifndef RUNTIME_VM_RAW_OBJECT_H_ | 5 #ifndef RUNTIME_VM_RAW_OBJECT_H_ |
| 6 #define RUNTIME_VM_RAW_OBJECT_H_ | 6 #define RUNTIME_VM_RAW_OBJECT_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/atomic.h" | 9 #include "vm/atomic.h" |
| 10 #include "vm/exceptions.h" | 10 #include "vm/exceptions.h" |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 } | 425 } |
| 426 bool IsPseudoObject() const { | 426 bool IsPseudoObject() const { |
| 427 return IsFreeListElement() || IsForwardingCorpse(); | 427 return IsFreeListElement() || IsForwardingCorpse(); |
| 428 } | 428 } |
| 429 | 429 |
| 430 intptr_t Size() const { | 430 intptr_t Size() const { |
| 431 uint32_t tags = ptr()->tags_; | 431 uint32_t tags = ptr()->tags_; |
| 432 intptr_t result = SizeTag::decode(tags); | 432 intptr_t result = SizeTag::decode(tags); |
| 433 if (result != 0) { | 433 if (result != 0) { |
| 434 #if defined(DEBUG) | 434 #if defined(DEBUG) |
| 435 // TODO(22501) Array::MakeFixedLength has a race with this code: we might | 435 // TODO(22501) Array::MakeArray has a race with this code: we might have |
| 436 // have loaded tags field and then MakeFixedLength could have updated it | 436 // loaded tags field and then MakeArray could have updated it leading |
| 437 // leading to inconsistency between SizeFromClass() and | 437 // to inconsistency between SizeFromClass() and SizeTag::decode(tags). |
| 438 // SizeTag::decode(tags). We are working around it by reloading tags_ and | 438 // We are working around it by reloading tags_ and recomputing |
| 439 // recomputing size from tags. | 439 // size from tags. |
| 440 const intptr_t size_from_class = SizeFromClass(); | 440 const intptr_t size_from_class = SizeFromClass(); |
| 441 if ((result > size_from_class) && (GetClassId() == kArrayCid) && | 441 if ((result > size_from_class) && (GetClassId() == kArrayCid) && |
| 442 (ptr()->tags_ != tags)) { | 442 (ptr()->tags_ != tags)) { |
| 443 result = SizeTag::decode(ptr()->tags_); | 443 result = SizeTag::decode(ptr()->tags_); |
| 444 } | 444 } |
| 445 ASSERT(result == size_from_class); | 445 ASSERT(result == size_from_class); |
| 446 #endif | 446 #endif |
| 447 return result; | 447 return result; |
| 448 } | 448 } |
| 449 result = SizeFromClass(); | 449 result = SizeFromClass(); |
| (...skipping 2072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2522 kTypedDataInt8ArrayViewCid + 15); | 2522 kTypedDataInt8ArrayViewCid + 15); |
| 2523 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2523 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
| 2524 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2524 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
| 2525 return (kNullCid - kTypedDataInt8ArrayCid); | 2525 return (kNullCid - kTypedDataInt8ArrayCid); |
| 2526 } | 2526 } |
| 2527 | 2527 |
| 2528 | 2528 |
| 2529 } // namespace dart | 2529 } // namespace dart |
| 2530 | 2530 |
| 2531 #endif // RUNTIME_VM_RAW_OBJECT_H_ | 2531 #endif // RUNTIME_VM_RAW_OBJECT_H_ |
| OLD | NEW |