Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(516)

Side by Side Diff: src/objects.h

Issue 15562008: Recording array buffer views. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR feedback Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8766 matching lines...) Expand 10 before | Expand all | Expand 10 after
8777 8777
8778 // [byte_length]: length in bytes 8778 // [byte_length]: length in bytes
8779 DECL_ACCESSORS(byte_length, Object) 8779 DECL_ACCESSORS(byte_length, Object)
8780 8780
8781 // [flags] 8781 // [flags]
8782 DECL_ACCESSORS(flag, Smi) 8782 DECL_ACCESSORS(flag, Smi)
8783 8783
8784 inline bool is_external(); 8784 inline bool is_external();
8785 inline void set_is_external(bool value); 8785 inline void set_is_external(bool value);
8786 8786
8787 // [weak_next]: linked list of array buffers.
8788 DECL_ACCESSORS(weak_next, Object)
8789
8790 // [weak_first_array]: weak linked list of typed arrays.
8791 DECL_ACCESSORS(weak_first_array, Object)
8792
8787 // Casting. 8793 // Casting.
8788 static inline JSArrayBuffer* cast(Object* obj); 8794 static inline JSArrayBuffer* cast(Object* obj);
8789 8795
8790 // Dispatched behavior. 8796 // Dispatched behavior.
8791 DECLARE_PRINTER(JSArrayBuffer) 8797 DECLARE_PRINTER(JSArrayBuffer)
8792 DECLARE_VERIFIER(JSArrayBuffer) 8798 DECLARE_VERIFIER(JSArrayBuffer)
8793 8799
8794 static const int kBackingStoreOffset = JSObject::kHeaderSize; 8800 static const int kBackingStoreOffset = JSObject::kHeaderSize;
8795 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize; 8801 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize;
8796 static const int kFlagOffset = kByteLengthOffset + kPointerSize; 8802 static const int kFlagOffset = kByteLengthOffset + kPointerSize;
8797 static const int kSize = kFlagOffset + kPointerSize; 8803 static const int kWeakNextOffset = kFlagOffset + kPointerSize;
8804 static const int kWeakFirstArrayOffset = kWeakNextOffset + kPointerSize;
8805 static const int kSize = kWeakFirstArrayOffset + kPointerSize;
8806
8807 static const int kSizeWithInternalFields =
8808 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize;
8798 8809
8799 private: 8810 private:
8800 // Bit position in a flag 8811 // Bit position in a flag
8801 static const int kIsExternalBit = 0; 8812 static const int kIsExternalBit = 0;
8802 8813
8803 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer); 8814 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer);
8804 }; 8815 };
8805 8816
8806 8817
8807 class JSTypedArray: public JSObject { 8818 class JSTypedArray: public JSObject {
8808 public: 8819 public:
8809 // [buffer]: ArrayBuffer that this typed array views. 8820 // [buffer]: ArrayBuffer that this typed array views.
8810 DECL_ACCESSORS(buffer, Object) 8821 DECL_ACCESSORS(buffer, Object)
8811 8822
8812 // [byte_length]: offset of typed array in bytes. 8823 // [byte_length]: offset of typed array in bytes.
8813 DECL_ACCESSORS(byte_offset, Object) 8824 DECL_ACCESSORS(byte_offset, Object)
8814 8825
8815 // [byte_length]: length of typed array in bytes. 8826 // [byte_length]: length of typed array in bytes.
8816 DECL_ACCESSORS(byte_length, Object) 8827 DECL_ACCESSORS(byte_length, Object)
8817 8828
8818 // [length]: length of typed array in elements. 8829 // [length]: length of typed array in elements.
8819 DECL_ACCESSORS(length, Object) 8830 DECL_ACCESSORS(length, Object)
8820 8831
8832 // [weak_next]: linked list of typed arrays over the same array buffer.
8833 DECL_ACCESSORS(weak_next, Object)
8834
8821 // Casting. 8835 // Casting.
8822 static inline JSTypedArray* cast(Object* obj); 8836 static inline JSTypedArray* cast(Object* obj);
8823 8837
8824 ExternalArrayType type(); 8838 ExternalArrayType type();
8825 size_t element_size(); 8839 size_t element_size();
8826 8840
8827 // Dispatched behavior. 8841 // Dispatched behavior.
8828 DECLARE_PRINTER(JSTypedArray) 8842 DECLARE_PRINTER(JSTypedArray)
8829 DECLARE_VERIFIER(JSTypedArray) 8843 DECLARE_VERIFIER(JSTypedArray)
8830 8844
8831 static const int kBufferOffset = JSObject::kHeaderSize; 8845 static const int kBufferOffset = JSObject::kHeaderSize;
8832 static const int kByteOffsetOffset = kBufferOffset + kPointerSize; 8846 static const int kByteOffsetOffset = kBufferOffset + kPointerSize;
8833 static const int kByteLengthOffset = kByteOffsetOffset + kPointerSize; 8847 static const int kByteLengthOffset = kByteOffsetOffset + kPointerSize;
8834 static const int kLengthOffset = kByteLengthOffset + kPointerSize; 8848 static const int kLengthOffset = kByteLengthOffset + kPointerSize;
8835 static const int kSize = kLengthOffset + kPointerSize; 8849 static const int kWeakNextOffset = kLengthOffset + kPointerSize;
8850 static const int kSize = kWeakNextOffset + kPointerSize;
8836 8851
8837 private: 8852 private:
8838 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); 8853 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray);
8839 }; 8854 };
8840 8855
8841 8856
8842 // Foreign describes objects pointing from JavaScript to C structures. 8857 // Foreign describes objects pointing from JavaScript to C structures.
8843 // Since they cannot contain references to JS HeapObjects they can be 8858 // Since they cannot contain references to JS HeapObjects they can be
8844 // placed in old_data_space. 8859 // placed in old_data_space.
8845 class Foreign: public HeapObject { 8860 class Foreign: public HeapObject {
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
9640 } else { 9655 } else {
9641 value &= ~(1 << bit_position); 9656 value &= ~(1 << bit_position);
9642 } 9657 }
9643 return value; 9658 return value;
9644 } 9659 }
9645 }; 9660 };
9646 9661
9647 } } // namespace v8::internal 9662 } } // namespace v8::internal
9648 9663
9649 #endif // V8_OBJECTS_H_ 9664 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698