OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 8725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8736 static inline JSWeakMap* cast(Object* obj); | 8736 static inline JSWeakMap* cast(Object* obj); |
8737 | 8737 |
8738 // Dispatched behavior. | 8738 // Dispatched behavior. |
8739 DECLARE_PRINTER(JSWeakMap) | 8739 DECLARE_PRINTER(JSWeakMap) |
8740 DECLARE_VERIFIER(JSWeakMap) | 8740 DECLARE_VERIFIER(JSWeakMap) |
8741 | 8741 |
8742 static const int kTableOffset = JSObject::kHeaderSize; | 8742 static const int kTableOffset = JSObject::kHeaderSize; |
8743 static const int kNextOffset = kTableOffset + kPointerSize; | 8743 static const int kNextOffset = kTableOffset + kPointerSize; |
8744 static const int kSize = kNextOffset + kPointerSize; | 8744 static const int kSize = kNextOffset + kPointerSize; |
8745 | 8745 |
8746 private: | |
8747 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakMap); | 8746 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakMap); |
8748 }; | 8747 }; |
8749 | 8748 |
8750 | 8749 |
8751 class JSArrayBuffer: public JSObject { | 8750 class JSArrayBuffer: public JSObject { |
8752 public: | 8751 public: |
8753 // [backing_store]: backing memory for this array | 8752 // [backing_store]: backing memory for this array |
8754 DECL_ACCESSORS(backing_store, void) | 8753 DECL_ACCESSORS(backing_store, void) |
8755 | 8754 |
8756 // [byte_length]: length in bytes | 8755 // [byte_length]: length in bytes |
8757 DECL_ACCESSORS(byte_length, Object) | 8756 DECL_ACCESSORS(byte_length, Object) |
8758 | 8757 |
| 8758 // [next]: linked list of encountered array buffers during GC. |
| 8759 DECL_ACCESSORS(next, Object) |
| 8760 |
| 8761 // [first_array]: weak linked list of typed arrays. |
| 8762 DECL_ACCESSORS(first_array, Object) |
| 8763 |
8759 // Casting. | 8764 // Casting. |
8760 static inline JSArrayBuffer* cast(Object* obj); | 8765 static inline JSArrayBuffer* cast(Object* obj); |
8761 | 8766 |
8762 // Dispatched behavior. | 8767 // Dispatched behavior. |
8763 DECLARE_PRINTER(JSArrayBuffer) | 8768 DECLARE_PRINTER(JSArrayBuffer) |
8764 DECLARE_VERIFIER(JSArrayBuffer) | 8769 DECLARE_VERIFIER(JSArrayBuffer) |
8765 | 8770 |
8766 static const int kBackingStoreOffset = JSObject::kHeaderSize; | 8771 static const int kBackingStoreOffset = JSObject::kHeaderSize; |
8767 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize; | 8772 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize; |
8768 static const int kSize = kByteLengthOffset + kPointerSize; | 8773 static const int kNextOffset = kByteLengthOffset + kPointerSize; |
| 8774 static const int kFirstArrayOffset = kNextOffset + kPointerSize; |
| 8775 static const int kSize = kFirstArrayOffset + kPointerSize; |
8769 | 8776 |
8770 private: | 8777 private: |
8771 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer); | 8778 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer); |
8772 }; | 8779 }; |
8773 | 8780 |
8774 | 8781 |
8775 class JSTypedArray: public JSObject { | 8782 class JSTypedArray: public JSObject { |
8776 public: | 8783 public: |
8777 // [buffer]: ArrayBuffer that this typed array views. | 8784 // [buffer]: ArrayBuffer that this typed array views. |
8778 DECL_ACCESSORS(buffer, Object) | 8785 DECL_ACCESSORS(buffer, Object) |
8779 | 8786 |
8780 // [byte_length]: offset of typed array in bytes. | 8787 // [byte_length]: offset of typed array in bytes. |
8781 DECL_ACCESSORS(byte_offset, Object) | 8788 DECL_ACCESSORS(byte_offset, Object) |
8782 | 8789 |
8783 // [byte_length]: length of typed array in bytes. | 8790 // [byte_length]: length of typed array in bytes. |
8784 DECL_ACCESSORS(byte_length, Object) | 8791 DECL_ACCESSORS(byte_length, Object) |
8785 | 8792 |
8786 // [length]: length of typed array in elements. | 8793 // [length]: length of typed array in elements. |
8787 DECL_ACCESSORS(length, Object) | 8794 DECL_ACCESSORS(length, Object) |
8788 | 8795 |
| 8796 // [next]: linked list of typed arrays over the same array buffer. |
| 8797 DECL_ACCESSORS(next, Object) |
| 8798 |
8789 // Casting. | 8799 // Casting. |
8790 static inline JSTypedArray* cast(Object* obj); | 8800 static inline JSTypedArray* cast(Object* obj); |
8791 | 8801 |
8792 ExternalArrayType type(); | 8802 ExternalArrayType type(); |
8793 size_t element_size(); | 8803 size_t element_size(); |
8794 | 8804 |
8795 // Dispatched behavior. | 8805 // Dispatched behavior. |
8796 DECLARE_PRINTER(JSTypedArray) | 8806 DECLARE_PRINTER(JSTypedArray) |
8797 DECLARE_VERIFIER(JSTypedArray) | 8807 DECLARE_VERIFIER(JSTypedArray) |
8798 | 8808 |
8799 static const int kBufferOffset = JSObject::kHeaderSize; | 8809 static const int kBufferOffset = JSObject::kHeaderSize; |
8800 static const int kByteOffsetOffset = kBufferOffset + kPointerSize; | 8810 static const int kByteOffsetOffset = kBufferOffset + kPointerSize; |
8801 static const int kByteLengthOffset = kByteOffsetOffset + kPointerSize; | 8811 static const int kByteLengthOffset = kByteOffsetOffset + kPointerSize; |
8802 static const int kLengthOffset = kByteLengthOffset + kPointerSize; | 8812 static const int kLengthOffset = kByteLengthOffset + kPointerSize; |
8803 static const int kSize = kLengthOffset + kPointerSize; | 8813 static const int kNextOffset = kLengthOffset + kLengthOffset; |
| 8814 static const int kSize = kNextOffset + kPointerSize; |
8804 | 8815 |
8805 private: | 8816 private: |
8806 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); | 8817 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); |
8807 }; | 8818 }; |
8808 | 8819 |
8809 | 8820 |
8810 // Foreign describes objects pointing from JavaScript to C structures. | 8821 // Foreign describes objects pointing from JavaScript to C structures. |
8811 // Since they cannot contain references to JS HeapObjects they can be | 8822 // Since they cannot contain references to JS HeapObjects they can be |
8812 // placed in old_data_space. | 8823 // placed in old_data_space. |
8813 class Foreign: public HeapObject { | 8824 class Foreign: public HeapObject { |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9608 } else { | 9619 } else { |
9609 value &= ~(1 << bit_position); | 9620 value &= ~(1 << bit_position); |
9610 } | 9621 } |
9611 return value; | 9622 return value; |
9612 } | 9623 } |
9613 }; | 9624 }; |
9614 | 9625 |
9615 } } // namespace v8::internal | 9626 } } // namespace v8::internal |
9616 | 9627 |
9617 #endif // V8_OBJECTS_H_ | 9628 #endif // V8_OBJECTS_H_ |
OLD | NEW |