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 VM_RAW_OBJECT_H_ | 5 #ifndef VM_RAW_OBJECT_H_ |
6 #define VM_RAW_OBJECT_H_ | 6 #define 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/globals.h" | 10 #include "vm/globals.h" |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 | 385 |
386 bool IsDartInstance() { | 386 bool IsDartInstance() { |
387 return (!IsHeapObject() || (GetClassId() >= kInstanceCid)); | 387 return (!IsHeapObject() || (GetClassId() >= kInstanceCid)); |
388 } | 388 } |
389 bool IsFreeListElement() { | 389 bool IsFreeListElement() { |
390 return ((GetClassId() == kFreeListElement)); | 390 return ((GetClassId() == kFreeListElement)); |
391 } | 391 } |
392 bool IsScript() { | 392 bool IsScript() { |
393 return ((GetClassId() == kScriptCid)); | 393 return ((GetClassId() == kScriptCid)); |
394 } | 394 } |
| 395 bool IsFunction() { |
| 396 return ((GetClassId() == kFunctionCid)); |
| 397 } |
395 | 398 |
396 intptr_t Size() const { | 399 intptr_t Size() const { |
397 uword tags = ptr()->tags_; | 400 uword tags = ptr()->tags_; |
398 intptr_t result = SizeTag::decode(tags); | 401 intptr_t result = SizeTag::decode(tags); |
399 if (result != 0) { | 402 if (result != 0) { |
400 ASSERT(result == SizeFromClass()); | 403 ASSERT(result == SizeFromClass()); |
401 return result; | 404 return result; |
402 } | 405 } |
403 result = SizeFromClass(); | 406 result = SizeFromClass(); |
404 ASSERT(result > SizeTag::kMaxSizeTag); | 407 ASSERT(result > SizeTag::kMaxSizeTag); |
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2138 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2141 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
2139 kTypedDataInt8ArrayViewCid + 15); | 2142 kTypedDataInt8ArrayViewCid + 15); |
2140 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2143 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
2141 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2144 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
2142 return (kNullCid - kTypedDataInt8ArrayCid); | 2145 return (kNullCid - kTypedDataInt8ArrayCid); |
2143 } | 2146 } |
2144 | 2147 |
2145 } // namespace dart | 2148 } // namespace dart |
2146 | 2149 |
2147 #endif // VM_RAW_OBJECT_H_ | 2150 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |