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

Side by Side Diff: src/objects.h

Issue 17153011: DataView implementation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Self-review 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
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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 V(JS_OBJECT_TYPE) \ 401 V(JS_OBJECT_TYPE) \
402 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ 402 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \
403 V(JS_GENERATOR_OBJECT_TYPE) \ 403 V(JS_GENERATOR_OBJECT_TYPE) \
404 V(JS_MODULE_TYPE) \ 404 V(JS_MODULE_TYPE) \
405 V(JS_GLOBAL_OBJECT_TYPE) \ 405 V(JS_GLOBAL_OBJECT_TYPE) \
406 V(JS_BUILTINS_OBJECT_TYPE) \ 406 V(JS_BUILTINS_OBJECT_TYPE) \
407 V(JS_GLOBAL_PROXY_TYPE) \ 407 V(JS_GLOBAL_PROXY_TYPE) \
408 V(JS_ARRAY_TYPE) \ 408 V(JS_ARRAY_TYPE) \
409 V(JS_ARRAY_BUFFER_TYPE) \ 409 V(JS_ARRAY_BUFFER_TYPE) \
410 V(JS_TYPED_ARRAY_TYPE) \ 410 V(JS_TYPED_ARRAY_TYPE) \
411 V(JS_DATA_VIEW_TYPE) \
411 V(JS_PROXY_TYPE) \ 412 V(JS_PROXY_TYPE) \
412 V(JS_WEAK_MAP_TYPE) \ 413 V(JS_WEAK_MAP_TYPE) \
413 V(JS_REGEXP_TYPE) \ 414 V(JS_REGEXP_TYPE) \
414 \ 415 \
415 V(JS_FUNCTION_TYPE) \ 416 V(JS_FUNCTION_TYPE) \
416 V(JS_FUNCTION_PROXY_TYPE) \ 417 V(JS_FUNCTION_PROXY_TYPE) \
417 418
418 #ifdef ENABLE_DEBUGGER_SUPPORT 419 #ifdef ENABLE_DEBUGGER_SUPPORT
419 #define INSTANCE_TYPE_LIST_DEBUGGER(V) \ 420 #define INSTANCE_TYPE_LIST_DEBUGGER(V) \
420 V(DEBUG_INFO_TYPE) \ 421 V(DEBUG_INFO_TYPE) \
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 JS_OBJECT_TYPE, 738 JS_OBJECT_TYPE,
738 JS_CONTEXT_EXTENSION_OBJECT_TYPE, 739 JS_CONTEXT_EXTENSION_OBJECT_TYPE,
739 JS_GENERATOR_OBJECT_TYPE, 740 JS_GENERATOR_OBJECT_TYPE,
740 JS_MODULE_TYPE, 741 JS_MODULE_TYPE,
741 JS_GLOBAL_OBJECT_TYPE, 742 JS_GLOBAL_OBJECT_TYPE,
742 JS_BUILTINS_OBJECT_TYPE, 743 JS_BUILTINS_OBJECT_TYPE,
743 JS_GLOBAL_PROXY_TYPE, 744 JS_GLOBAL_PROXY_TYPE,
744 JS_ARRAY_TYPE, 745 JS_ARRAY_TYPE,
745 JS_ARRAY_BUFFER_TYPE, 746 JS_ARRAY_BUFFER_TYPE,
746 JS_TYPED_ARRAY_TYPE, 747 JS_TYPED_ARRAY_TYPE,
748 JS_DATA_VIEW_TYPE,
747 JS_SET_TYPE, 749 JS_SET_TYPE,
748 JS_MAP_TYPE, 750 JS_MAP_TYPE,
749 JS_WEAK_MAP_TYPE, 751 JS_WEAK_MAP_TYPE,
750 752
751 JS_REGEXP_TYPE, 753 JS_REGEXP_TYPE,
752 754
753 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE 755 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE
754 756
755 // Pseudo-types 757 // Pseudo-types
756 FIRST_TYPE = 0x0, 758 FIRST_TYPE = 0x0,
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 V(Oddball) \ 988 V(Oddball) \
987 V(SharedFunctionInfo) \ 989 V(SharedFunctionInfo) \
988 V(JSValue) \ 990 V(JSValue) \
989 V(JSDate) \ 991 V(JSDate) \
990 V(JSMessageObject) \ 992 V(JSMessageObject) \
991 V(StringWrapper) \ 993 V(StringWrapper) \
992 V(Foreign) \ 994 V(Foreign) \
993 V(Boolean) \ 995 V(Boolean) \
994 V(JSArray) \ 996 V(JSArray) \
995 V(JSArrayBuffer) \ 997 V(JSArrayBuffer) \
998 V(JSArrayBufferView) \
rossberg 2013/06/21 08:44:01 Please add the new classes to the hierarchy commen
Dmitry Lomov (no reviews) 2013/06/21 11:32:10 Done.
996 V(JSTypedArray) \ 999 V(JSTypedArray) \
1000 V(JSDataView) \
997 V(JSProxy) \ 1001 V(JSProxy) \
998 V(JSFunctionProxy) \ 1002 V(JSFunctionProxy) \
999 V(JSSet) \ 1003 V(JSSet) \
1000 V(JSMap) \ 1004 V(JSMap) \
1001 V(JSWeakMap) \ 1005 V(JSWeakMap) \
1002 V(JSRegExp) \ 1006 V(JSRegExp) \
1003 V(HashTable) \ 1007 V(HashTable) \
1004 V(Dictionary) \ 1008 V(Dictionary) \
1005 V(StringTable) \ 1009 V(StringTable) \
1006 V(JSFunctionResultCache) \ 1010 V(JSFunctionResultCache) \
(...skipping 7827 matching lines...) Expand 10 before | Expand all | Expand 10 after
8834 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize; 8838 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize;
8835 8839
8836 private: 8840 private:
8837 // Bit position in a flag 8841 // Bit position in a flag
8838 static const int kIsExternalBit = 0; 8842 static const int kIsExternalBit = 0;
8839 8843
8840 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer); 8844 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer);
8841 }; 8845 };
8842 8846
8843 8847
8844 class JSTypedArray: public JSObject { 8848 class JSArrayBufferView: public JSObject {
8845 public: 8849 public:
8846 // [buffer]: ArrayBuffer that this typed array views. 8850 // [buffer]: ArrayBuffer that this typed array views.
8847 DECL_ACCESSORS(buffer, Object) 8851 DECL_ACCESSORS(buffer, Object)
8848 8852
8849 // [byte_length]: offset of typed array in bytes. 8853 // [byte_length]: offset of typed array in bytes.
8850 DECL_ACCESSORS(byte_offset, Object) 8854 DECL_ACCESSORS(byte_offset, Object)
8851 8855
8852 // [byte_length]: length of typed array in bytes. 8856 // [byte_length]: length of typed array in bytes.
8853 DECL_ACCESSORS(byte_length, Object) 8857 DECL_ACCESSORS(byte_length, Object)
8854 8858
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. 8859 // [weak_next]: linked list of typed arrays over the same array buffer.
8859 DECL_ACCESSORS(weak_next, Object) 8860 DECL_ACCESSORS(weak_next, Object)
8860 8861
8862 // Casting.
8863 static inline JSArrayBufferView* cast(Object* obj);
8864
8865 DECLARE_VERIFIER(JSArrayBufferView);
8866
8867 static const int kBufferOffset = JSObject::kHeaderSize;
8868 static const int kByteOffsetOffset = kBufferOffset + kPointerSize;
8869 static const int kByteLengthOffset = kByteOffsetOffset + kPointerSize;
8870 static const int kWeakNextOffset = kByteLengthOffset + kPointerSize;
8871 static const int kViewSize = kWeakNextOffset + kPointerSize;
8872
8873 protected:
8874 void NeuterView();
8875
8876 private:
8877 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBufferView);
8878 };
8879
8880
8881 class JSTypedArray: public JSArrayBufferView {
8882 public:
8883 // [length]: length of typed array in elements.
8884 DECL_ACCESSORS(length, Object)
8885
8861 // Neutering. Only neuters this typed array. 8886 // Neutering. Only neuters this typed array.
8862 void Neuter(); 8887 void Neuter();
8863 8888
8864 // Casting. 8889 // Casting.
8865 static inline JSTypedArray* cast(Object* obj); 8890 static inline JSTypedArray* cast(Object* obj);
8866 8891
8867 ExternalArrayType type(); 8892 ExternalArrayType type();
8868 size_t element_size(); 8893 size_t element_size();
8869 8894
8870 // Dispatched behavior. 8895 // Dispatched behavior.
8871 DECLARE_PRINTER(JSTypedArray) 8896 DECLARE_PRINTER(JSTypedArray)
8872 DECLARE_VERIFIER(JSTypedArray) 8897 DECLARE_VERIFIER(JSTypedArray)
8873 8898
8874 static const int kBufferOffset = JSObject::kHeaderSize; 8899 static const int kLengthOffset = kViewSize + kPointerSize;
8875 static const int kByteOffsetOffset = kBufferOffset + kPointerSize; 8900 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 8901
8881 private: 8902 private:
8882 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); 8903 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray);
8883 }; 8904 };
8884 8905
8885 8906
8907 class JSDataView: public JSArrayBufferView {
8908 public:
8909 // Only neuters this DataView
8910 void Neuter();
8911
8912 // Casting.
8913 static inline JSDataView* cast(Object* obj);
8914
8915 // Dispatched behavior.
8916 DECLARE_PRINTER(JSDataView)
8917 DECLARE_VERIFIER(JSDataView)
8918
8919 static const int kSize = kViewSize;
8920
8921 private:
8922 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataView);
8923 };
8924
8925
8886 // Foreign describes objects pointing from JavaScript to C structures. 8926 // Foreign describes objects pointing from JavaScript to C structures.
8887 // Since they cannot contain references to JS HeapObjects they can be 8927 // Since they cannot contain references to JS HeapObjects they can be
8888 // placed in old_data_space. 8928 // placed in old_data_space.
8889 class Foreign: public HeapObject { 8929 class Foreign: public HeapObject {
8890 public: 8930 public:
8891 // [address]: field containing the address. 8931 // [address]: field containing the address.
8892 inline Address foreign_address(); 8932 inline Address foreign_address();
8893 inline void set_foreign_address(Address value); 8933 inline void set_foreign_address(Address value);
8894 8934
8895 // Casting. 8935 // Casting.
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
9684 } else { 9724 } else {
9685 value &= ~(1 << bit_position); 9725 value &= ~(1 << bit_position);
9686 } 9726 }
9687 return value; 9727 return value;
9688 } 9728 }
9689 }; 9729 };
9690 9730
9691 } } // namespace v8::internal 9731 } } // namespace v8::internal
9692 9732
9693 #endif // V8_OBJECTS_H_ 9733 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/messages.js ('k') | src/objects.cc » ('j') | src/objects-debug.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698