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 40 matching lines...) Loading... |
51 // Inheritance hierarchy: | 51 // Inheritance hierarchy: |
52 // - MaybeObject (an object or a failure) | 52 // - MaybeObject (an object or a failure) |
53 // - Failure (immediate for marking failed operation) | 53 // - Failure (immediate for marking failed operation) |
54 // - Object | 54 // - Object |
55 // - Smi (immediate small integer) | 55 // - Smi (immediate small integer) |
56 // - HeapObject (superclass for everything allocated in the heap) | 56 // - HeapObject (superclass for everything allocated in the heap) |
57 // - JSReceiver (suitable for property access) | 57 // - JSReceiver (suitable for property access) |
58 // - JSObject | 58 // - JSObject |
59 // - JSArray | 59 // - JSArray |
60 // - JSArrayBuffer | 60 // - JSArrayBuffer |
61 // - JSTypedArray | 61 // - JSArrayBufferView |
| 62 // - JSTypedArray |
| 63 // - JSDataView |
62 // - JSSet | 64 // - JSSet |
63 // - JSMap | 65 // - JSMap |
64 // - JSWeakMap | 66 // - JSWeakMap |
65 // - JSRegExp | 67 // - JSRegExp |
66 // - JSFunction | 68 // - JSFunction |
67 // - JSGeneratorObject | 69 // - JSGeneratorObject |
68 // - JSModule | 70 // - JSModule |
69 // - GlobalObject | 71 // - GlobalObject |
70 // - JSGlobalObject | 72 // - JSGlobalObject |
71 // - JSBuiltinsObject | 73 // - JSBuiltinsObject |
(...skipping 329 matching lines...) Loading... |
401 V(JS_OBJECT_TYPE) \ | 403 V(JS_OBJECT_TYPE) \ |
402 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ | 404 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ |
403 V(JS_GENERATOR_OBJECT_TYPE) \ | 405 V(JS_GENERATOR_OBJECT_TYPE) \ |
404 V(JS_MODULE_TYPE) \ | 406 V(JS_MODULE_TYPE) \ |
405 V(JS_GLOBAL_OBJECT_TYPE) \ | 407 V(JS_GLOBAL_OBJECT_TYPE) \ |
406 V(JS_BUILTINS_OBJECT_TYPE) \ | 408 V(JS_BUILTINS_OBJECT_TYPE) \ |
407 V(JS_GLOBAL_PROXY_TYPE) \ | 409 V(JS_GLOBAL_PROXY_TYPE) \ |
408 V(JS_ARRAY_TYPE) \ | 410 V(JS_ARRAY_TYPE) \ |
409 V(JS_ARRAY_BUFFER_TYPE) \ | 411 V(JS_ARRAY_BUFFER_TYPE) \ |
410 V(JS_TYPED_ARRAY_TYPE) \ | 412 V(JS_TYPED_ARRAY_TYPE) \ |
| 413 V(JS_DATA_VIEW_TYPE) \ |
411 V(JS_PROXY_TYPE) \ | 414 V(JS_PROXY_TYPE) \ |
412 V(JS_WEAK_MAP_TYPE) \ | 415 V(JS_WEAK_MAP_TYPE) \ |
413 V(JS_REGEXP_TYPE) \ | 416 V(JS_REGEXP_TYPE) \ |
414 \ | 417 \ |
415 V(JS_FUNCTION_TYPE) \ | 418 V(JS_FUNCTION_TYPE) \ |
416 V(JS_FUNCTION_PROXY_TYPE) \ | 419 V(JS_FUNCTION_PROXY_TYPE) \ |
417 | 420 |
418 #ifdef ENABLE_DEBUGGER_SUPPORT | 421 #ifdef ENABLE_DEBUGGER_SUPPORT |
419 #define INSTANCE_TYPE_LIST_DEBUGGER(V) \ | 422 #define INSTANCE_TYPE_LIST_DEBUGGER(V) \ |
420 V(DEBUG_INFO_TYPE) \ | 423 V(DEBUG_INFO_TYPE) \ |
(...skipping 316 matching lines...) Loading... |
737 JS_OBJECT_TYPE, | 740 JS_OBJECT_TYPE, |
738 JS_CONTEXT_EXTENSION_OBJECT_TYPE, | 741 JS_CONTEXT_EXTENSION_OBJECT_TYPE, |
739 JS_GENERATOR_OBJECT_TYPE, | 742 JS_GENERATOR_OBJECT_TYPE, |
740 JS_MODULE_TYPE, | 743 JS_MODULE_TYPE, |
741 JS_GLOBAL_OBJECT_TYPE, | 744 JS_GLOBAL_OBJECT_TYPE, |
742 JS_BUILTINS_OBJECT_TYPE, | 745 JS_BUILTINS_OBJECT_TYPE, |
743 JS_GLOBAL_PROXY_TYPE, | 746 JS_GLOBAL_PROXY_TYPE, |
744 JS_ARRAY_TYPE, | 747 JS_ARRAY_TYPE, |
745 JS_ARRAY_BUFFER_TYPE, | 748 JS_ARRAY_BUFFER_TYPE, |
746 JS_TYPED_ARRAY_TYPE, | 749 JS_TYPED_ARRAY_TYPE, |
| 750 JS_DATA_VIEW_TYPE, |
747 JS_SET_TYPE, | 751 JS_SET_TYPE, |
748 JS_MAP_TYPE, | 752 JS_MAP_TYPE, |
749 JS_WEAK_MAP_TYPE, | 753 JS_WEAK_MAP_TYPE, |
750 | 754 |
751 JS_REGEXP_TYPE, | 755 JS_REGEXP_TYPE, |
752 | 756 |
753 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE | 757 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE |
754 | 758 |
755 // Pseudo-types | 759 // Pseudo-types |
756 FIRST_TYPE = 0x0, | 760 FIRST_TYPE = 0x0, |
(...skipping 229 matching lines...) Loading... |
986 V(Oddball) \ | 990 V(Oddball) \ |
987 V(SharedFunctionInfo) \ | 991 V(SharedFunctionInfo) \ |
988 V(JSValue) \ | 992 V(JSValue) \ |
989 V(JSDate) \ | 993 V(JSDate) \ |
990 V(JSMessageObject) \ | 994 V(JSMessageObject) \ |
991 V(StringWrapper) \ | 995 V(StringWrapper) \ |
992 V(Foreign) \ | 996 V(Foreign) \ |
993 V(Boolean) \ | 997 V(Boolean) \ |
994 V(JSArray) \ | 998 V(JSArray) \ |
995 V(JSArrayBuffer) \ | 999 V(JSArrayBuffer) \ |
| 1000 V(JSArrayBufferView) \ |
996 V(JSTypedArray) \ | 1001 V(JSTypedArray) \ |
| 1002 V(JSDataView) \ |
997 V(JSProxy) \ | 1003 V(JSProxy) \ |
998 V(JSFunctionProxy) \ | 1004 V(JSFunctionProxy) \ |
999 V(JSSet) \ | 1005 V(JSSet) \ |
1000 V(JSMap) \ | 1006 V(JSMap) \ |
1001 V(JSWeakMap) \ | 1007 V(JSWeakMap) \ |
1002 V(JSRegExp) \ | 1008 V(JSRegExp) \ |
1003 V(HashTable) \ | 1009 V(HashTable) \ |
1004 V(Dictionary) \ | 1010 V(Dictionary) \ |
1005 V(StringTable) \ | 1011 V(StringTable) \ |
1006 V(JSFunctionResultCache) \ | 1012 V(JSFunctionResultCache) \ |
(...skipping 7796 matching lines...) Loading... |
8803 | 8809 |
8804 // [flags] | 8810 // [flags] |
8805 DECL_ACCESSORS(flag, Smi) | 8811 DECL_ACCESSORS(flag, Smi) |
8806 | 8812 |
8807 inline bool is_external(); | 8813 inline bool is_external(); |
8808 inline void set_is_external(bool value); | 8814 inline void set_is_external(bool value); |
8809 | 8815 |
8810 // [weak_next]: linked list of array buffers. | 8816 // [weak_next]: linked list of array buffers. |
8811 DECL_ACCESSORS(weak_next, Object) | 8817 DECL_ACCESSORS(weak_next, Object) |
8812 | 8818 |
8813 // [weak_first_array]: weak linked list of typed arrays. | 8819 // [weak_first_array]: weak linked list of views. |
8814 DECL_ACCESSORS(weak_first_array, Object) | 8820 DECL_ACCESSORS(weak_first_view, Object) |
8815 | 8821 |
8816 // Casting. | 8822 // Casting. |
8817 static inline JSArrayBuffer* cast(Object* obj); | 8823 static inline JSArrayBuffer* cast(Object* obj); |
8818 | 8824 |
8819 // Neutering. Only neuters the buffer, not associated typed arrays. | 8825 // Neutering. Only neuters the buffer, not associated typed arrays. |
8820 void Neuter(); | 8826 void Neuter(); |
8821 | 8827 |
8822 // Dispatched behavior. | 8828 // Dispatched behavior. |
8823 DECLARE_PRINTER(JSArrayBuffer) | 8829 DECLARE_PRINTER(JSArrayBuffer) |
8824 DECLARE_VERIFIER(JSArrayBuffer) | 8830 DECLARE_VERIFIER(JSArrayBuffer) |
8825 | 8831 |
8826 static const int kBackingStoreOffset = JSObject::kHeaderSize; | 8832 static const int kBackingStoreOffset = JSObject::kHeaderSize; |
8827 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize; | 8833 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize; |
8828 static const int kFlagOffset = kByteLengthOffset + kPointerSize; | 8834 static const int kFlagOffset = kByteLengthOffset + kPointerSize; |
8829 static const int kWeakNextOffset = kFlagOffset + kPointerSize; | 8835 static const int kWeakNextOffset = kFlagOffset + kPointerSize; |
8830 static const int kWeakFirstArrayOffset = kWeakNextOffset + kPointerSize; | 8836 static const int kWeakFirstViewOffset = kWeakNextOffset + kPointerSize; |
8831 static const int kSize = kWeakFirstArrayOffset + kPointerSize; | 8837 static const int kSize = kWeakFirstViewOffset + kPointerSize; |
8832 | 8838 |
8833 static const int kSizeWithInternalFields = | 8839 static const int kSizeWithInternalFields = |
8834 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize; | 8840 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize; |
8835 | 8841 |
8836 private: | 8842 private: |
8837 // Bit position in a flag | 8843 // Bit position in a flag |
8838 static const int kIsExternalBit = 0; | 8844 static const int kIsExternalBit = 0; |
8839 | 8845 |
8840 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer); | 8846 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer); |
8841 }; | 8847 }; |
8842 | 8848 |
8843 | 8849 |
8844 class JSTypedArray: public JSObject { | 8850 class JSArrayBufferView: public JSObject { |
8845 public: | 8851 public: |
8846 // [buffer]: ArrayBuffer that this typed array views. | 8852 // [buffer]: ArrayBuffer that this typed array views. |
8847 DECL_ACCESSORS(buffer, Object) | 8853 DECL_ACCESSORS(buffer, Object) |
8848 | 8854 |
8849 // [byte_length]: offset of typed array in bytes. | 8855 // [byte_length]: offset of typed array in bytes. |
8850 DECL_ACCESSORS(byte_offset, Object) | 8856 DECL_ACCESSORS(byte_offset, Object) |
8851 | 8857 |
8852 // [byte_length]: length of typed array in bytes. | 8858 // [byte_length]: length of typed array in bytes. |
8853 DECL_ACCESSORS(byte_length, Object) | 8859 DECL_ACCESSORS(byte_length, Object) |
8854 | 8860 |
8855 // [length]: length of typed array in elements. | |
8856 DECL_ACCESSORS(length, Object) | |
8857 | |
8858 // [weak_next]: linked list of typed arrays over the same array buffer. | 8861 // [weak_next]: linked list of typed arrays over the same array buffer. |
8859 DECL_ACCESSORS(weak_next, Object) | 8862 DECL_ACCESSORS(weak_next, Object) |
8860 | 8863 |
| 8864 // Casting. |
| 8865 static inline JSArrayBufferView* cast(Object* obj); |
| 8866 |
| 8867 DECLARE_VERIFIER(JSArrayBufferView) |
| 8868 |
| 8869 static const int kBufferOffset = JSObject::kHeaderSize; |
| 8870 static const int kByteOffsetOffset = kBufferOffset + kPointerSize; |
| 8871 static const int kByteLengthOffset = kByteOffsetOffset + kPointerSize; |
| 8872 static const int kWeakNextOffset = kByteLengthOffset + kPointerSize; |
| 8873 static const int kViewSize = kWeakNextOffset + kPointerSize; |
| 8874 |
| 8875 protected: |
| 8876 void NeuterView(); |
| 8877 |
| 8878 private: |
| 8879 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBufferView); |
| 8880 }; |
| 8881 |
| 8882 |
| 8883 class JSTypedArray: public JSArrayBufferView { |
| 8884 public: |
| 8885 // [length]: length of typed array in elements. |
| 8886 DECL_ACCESSORS(length, Object) |
| 8887 |
8861 // Neutering. Only neuters this typed array. | 8888 // Neutering. Only neuters this typed array. |
8862 void Neuter(); | 8889 void Neuter(); |
8863 | 8890 |
8864 // Casting. | 8891 // Casting. |
8865 static inline JSTypedArray* cast(Object* obj); | 8892 static inline JSTypedArray* cast(Object* obj); |
8866 | 8893 |
8867 ExternalArrayType type(); | 8894 ExternalArrayType type(); |
8868 size_t element_size(); | 8895 size_t element_size(); |
8869 | 8896 |
8870 // Dispatched behavior. | 8897 // Dispatched behavior. |
8871 DECLARE_PRINTER(JSTypedArray) | 8898 DECLARE_PRINTER(JSTypedArray) |
8872 DECLARE_VERIFIER(JSTypedArray) | 8899 DECLARE_VERIFIER(JSTypedArray) |
8873 | 8900 |
8874 static const int kBufferOffset = JSObject::kHeaderSize; | 8901 static const int kLengthOffset = kViewSize + kPointerSize; |
8875 static const int kByteOffsetOffset = kBufferOffset + kPointerSize; | 8902 static const int kSize = kLengthOffset + kPointerSize; |
8876 static const int kByteLengthOffset = kByteOffsetOffset + kPointerSize; | |
8877 static const int kLengthOffset = kByteLengthOffset + kPointerSize; | |
8878 static const int kWeakNextOffset = kLengthOffset + kPointerSize; | |
8879 static const int kSize = kWeakNextOffset + kPointerSize; | |
8880 | 8903 |
8881 private: | 8904 private: |
8882 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); | 8905 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); |
8883 }; | 8906 }; |
8884 | 8907 |
8885 | 8908 |
| 8909 class JSDataView: public JSArrayBufferView { |
| 8910 public: |
| 8911 // Only neuters this DataView |
| 8912 void Neuter(); |
| 8913 |
| 8914 // Casting. |
| 8915 static inline JSDataView* cast(Object* obj); |
| 8916 |
| 8917 // Dispatched behavior. |
| 8918 DECLARE_PRINTER(JSDataView) |
| 8919 DECLARE_VERIFIER(JSDataView) |
| 8920 |
| 8921 static const int kSize = kViewSize; |
| 8922 |
| 8923 private: |
| 8924 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataView); |
| 8925 }; |
| 8926 |
| 8927 |
8886 // Foreign describes objects pointing from JavaScript to C structures. | 8928 // Foreign describes objects pointing from JavaScript to C structures. |
8887 // Since they cannot contain references to JS HeapObjects they can be | 8929 // Since they cannot contain references to JS HeapObjects they can be |
8888 // placed in old_data_space. | 8930 // placed in old_data_space. |
8889 class Foreign: public HeapObject { | 8931 class Foreign: public HeapObject { |
8890 public: | 8932 public: |
8891 // [address]: field containing the address. | 8933 // [address]: field containing the address. |
8892 inline Address foreign_address(); | 8934 inline Address foreign_address(); |
8893 inline void set_foreign_address(Address value); | 8935 inline void set_foreign_address(Address value); |
8894 | 8936 |
8895 // Casting. | 8937 // Casting. |
(...skipping 788 matching lines...) Loading... |
9684 } else { | 9726 } else { |
9685 value &= ~(1 << bit_position); | 9727 value &= ~(1 << bit_position); |
9686 } | 9728 } |
9687 return value; | 9729 return value; |
9688 } | 9730 } |
9689 }; | 9731 }; |
9690 | 9732 |
9691 } } // namespace v8::internal | 9733 } } // namespace v8::internal |
9692 | 9734 |
9693 #endif // V8_OBJECTS_H_ | 9735 #endif // V8_OBJECTS_H_ |
OLD | NEW |