OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1711 // [length]: length of the array. | 1711 // [length]: length of the array. |
1712 inline int length(); | 1712 inline int length(); |
1713 inline void set_length(int value); | 1713 inline void set_length(int value); |
1714 | 1714 |
1715 // Convert an object to an array index. | 1715 // Convert an object to an array index. |
1716 // Returns true if the conversion succeeded. | 1716 // Returns true if the conversion succeeded. |
1717 static inline bool IndexFromObject(Object* object, uint32_t* index); | 1717 static inline bool IndexFromObject(Object* object, uint32_t* index); |
1718 | 1718 |
1719 // Layout descriptor. | 1719 // Layout descriptor. |
1720 static const int kLengthOffset = HeapObject::kHeaderSize; | 1720 static const int kLengthOffset = HeapObject::kHeaderSize; |
| 1721 |
| 1722 protected: |
| 1723 // No code should use the Array class directly, only its subclasses. |
| 1724 // Use the kHeaderSize of the appropriate subclass, which may be aligned. |
1721 static const int kHeaderSize = kLengthOffset + kIntSize; | 1725 static const int kHeaderSize = kLengthOffset + kIntSize; |
1722 static const int kAlignedSize = POINTER_SIZE_ALIGN(kHeaderSize); | 1726 static const int kAlignedSize = POINTER_SIZE_ALIGN(kHeaderSize); |
1723 | 1727 |
1724 private: | 1728 private: |
1725 DISALLOW_IMPLICIT_CONSTRUCTORS(Array); | 1729 DISALLOW_IMPLICIT_CONSTRUCTORS(Array); |
1726 }; | 1730 }; |
1727 | 1731 |
1728 | 1732 |
1729 // FixedArray describes fixed sized arrays where element | 1733 // FixedArray describes fixed sized arrays where element |
1730 // type is Object*. | 1734 // type is Object*. |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2420 // Casting. | 2424 // Casting. |
2421 static inline ByteArray* cast(Object* obj); | 2425 static inline ByteArray* cast(Object* obj); |
2422 | 2426 |
2423 // Dispatched behavior. | 2427 // Dispatched behavior. |
2424 int ByteArraySize() { return SizeFor(length()); } | 2428 int ByteArraySize() { return SizeFor(length()); } |
2425 #ifdef DEBUG | 2429 #ifdef DEBUG |
2426 void ByteArrayPrint(); | 2430 void ByteArrayPrint(); |
2427 void ByteArrayVerify(); | 2431 void ByteArrayVerify(); |
2428 #endif | 2432 #endif |
2429 | 2433 |
| 2434 // ByteArray headers are not quadword aligned. |
| 2435 static const int kHeaderSize = Array::kHeaderSize; |
| 2436 static const int kAlignedSize = Array::kAlignedSize; |
| 2437 |
2430 private: | 2438 private: |
2431 DISALLOW_IMPLICIT_CONSTRUCTORS(ByteArray); | 2439 DISALLOW_IMPLICIT_CONSTRUCTORS(ByteArray); |
2432 }; | 2440 }; |
2433 | 2441 |
2434 | 2442 |
2435 // Code describes objects with on-the-fly generated machine code. | 2443 // Code describes objects with on-the-fly generated machine code. |
2436 class Code: public HeapObject { | 2444 class Code: public HeapObject { |
2437 public: | 2445 public: |
2438 // Opaque data type for encapsulating code flags like kind, inline | 2446 // Opaque data type for encapsulating code flags like kind, inline |
2439 // cache state, and arguments count. | 2447 // cache state, and arguments count. |
(...skipping 2299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4739 } else { | 4747 } else { |
4740 value &= ~(1 << bit_position); | 4748 value &= ~(1 << bit_position); |
4741 } | 4749 } |
4742 return value; | 4750 return value; |
4743 } | 4751 } |
4744 }; | 4752 }; |
4745 | 4753 |
4746 } } // namespace v8::internal | 4754 } } // namespace v8::internal |
4747 | 4755 |
4748 #endif // V8_OBJECTS_H_ | 4756 #endif // V8_OBJECTS_H_ |
OLD | NEW |