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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 } | 420 } |
421 bool IsPseudoObject() const { | 421 bool IsPseudoObject() const { |
422 return IsFreeListElement() || IsForwardingCorpse(); | 422 return IsFreeListElement() || IsForwardingCorpse(); |
423 } | 423 } |
424 | 424 |
425 intptr_t Size() const { | 425 intptr_t Size() const { |
426 uword tags = ptr()->tags_; | 426 uword tags = ptr()->tags_; |
427 intptr_t result = SizeTag::decode(tags); | 427 intptr_t result = SizeTag::decode(tags); |
428 if (result != 0) { | 428 if (result != 0) { |
429 #if defined(DEBUG) | 429 #if defined(DEBUG) |
430 // TODO(22501) Array::MakeArray has a race with this code: we might have | 430 // TODO(22501) Array::MakeFixedLength has a race with this code: we might |
431 // loaded tags field and then MakeArray could have updated it leading | 431 // have loaded tags field and then MakeFixedLength could have updated it |
432 // to inconsistency between SizeFromClass() and SizeTag::decode(tags). | 432 // leading to inconsistency between SizeFromClass() and |
433 // We are working around it by reloading tags_ and recomputing | 433 // SizeTag::decode(tags). We are working around it by reloading tags_ and |
434 // size from tags. | 434 // recomputing size from tags. |
435 const intptr_t size_from_class = SizeFromClass(); | 435 const intptr_t size_from_class = SizeFromClass(); |
436 if ((result > size_from_class) && (GetClassId() == kArrayCid) && | 436 if ((result > size_from_class) && (GetClassId() == kArrayCid) && |
437 (ptr()->tags_ != tags)) { | 437 (ptr()->tags_ != tags)) { |
438 result = SizeTag::decode(ptr()->tags_); | 438 result = SizeTag::decode(ptr()->tags_); |
439 } | 439 } |
440 ASSERT(result == size_from_class); | 440 ASSERT(result == size_from_class); |
441 #endif | 441 #endif |
442 return result; | 442 return result; |
443 } | 443 } |
444 result = SizeFromClass(); | 444 result = SizeFromClass(); |
(...skipping 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2496 kTypedDataInt8ArrayViewCid + 15); | 2496 kTypedDataInt8ArrayViewCid + 15); |
2497 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2497 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
2498 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2498 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
2499 return (kNullCid - kTypedDataInt8ArrayCid); | 2499 return (kNullCid - kTypedDataInt8ArrayCid); |
2500 } | 2500 } |
2501 | 2501 |
2502 | 2502 |
2503 } // namespace dart | 2503 } // namespace dart |
2504 | 2504 |
2505 #endif // RUNTIME_VM_RAW_OBJECT_H_ | 2505 #endif // RUNTIME_VM_RAW_OBJECT_H_ |
OLD | NEW |