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

Side by Side Diff: src/objects.h

Issue 15943002: v8 typed arrays: add DataView type (Closed)
Patch Set: v8 typed arrays: add DataView type, v2 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
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // Inheritance hierarchy: 50 // Inheritance hierarchy:
51 // - MaybeObject (an object or a failure) 51 // - MaybeObject (an object or a failure)
52 // - Failure (immediate for marking failed operation) 52 // - Failure (immediate for marking failed operation)
53 // - Object 53 // - Object
54 // - Smi (immediate small integer) 54 // - Smi (immediate small integer)
55 // - HeapObject (superclass for everything allocated in the heap) 55 // - HeapObject (superclass for everything allocated in the heap)
56 // - JSReceiver (suitable for property access) 56 // - JSReceiver (suitable for property access)
57 // - JSObject 57 // - JSObject
58 // - JSArray 58 // - JSArray
59 // - JSArrayBuffer 59 // - JSArrayBuffer
60 // - JSDataView
60 // - JSTypedArray 61 // - JSTypedArray
61 // - JSSet 62 // - JSSet
62 // - JSMap 63 // - JSMap
63 // - JSWeakMap 64 // - JSWeakMap
64 // - JSRegExp 65 // - JSRegExp
65 // - JSFunction 66 // - JSFunction
66 // - JSGeneratorObject 67 // - JSGeneratorObject
67 // - JSModule 68 // - JSModule
68 // - GlobalObject 69 // - GlobalObject
69 // - JSGlobalObject 70 // - JSGlobalObject
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 V(JS_DATE_TYPE) \ 395 V(JS_DATE_TYPE) \
395 V(JS_OBJECT_TYPE) \ 396 V(JS_OBJECT_TYPE) \
396 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ 397 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \
397 V(JS_GENERATOR_OBJECT_TYPE) \ 398 V(JS_GENERATOR_OBJECT_TYPE) \
398 V(JS_MODULE_TYPE) \ 399 V(JS_MODULE_TYPE) \
399 V(JS_GLOBAL_OBJECT_TYPE) \ 400 V(JS_GLOBAL_OBJECT_TYPE) \
400 V(JS_BUILTINS_OBJECT_TYPE) \ 401 V(JS_BUILTINS_OBJECT_TYPE) \
401 V(JS_GLOBAL_PROXY_TYPE) \ 402 V(JS_GLOBAL_PROXY_TYPE) \
402 V(JS_ARRAY_TYPE) \ 403 V(JS_ARRAY_TYPE) \
403 V(JS_ARRAY_BUFFER_TYPE) \ 404 V(JS_ARRAY_BUFFER_TYPE) \
405 V(JS_DATA_VIEW_TYPE) \
404 V(JS_TYPED_ARRAY_TYPE) \ 406 V(JS_TYPED_ARRAY_TYPE) \
405 V(JS_PROXY_TYPE) \ 407 V(JS_PROXY_TYPE) \
406 V(JS_WEAK_MAP_TYPE) \ 408 V(JS_WEAK_MAP_TYPE) \
407 V(JS_REGEXP_TYPE) \ 409 V(JS_REGEXP_TYPE) \
408 \ 410 \
409 V(JS_FUNCTION_TYPE) \ 411 V(JS_FUNCTION_TYPE) \
410 V(JS_FUNCTION_PROXY_TYPE) \ 412 V(JS_FUNCTION_PROXY_TYPE) \
411 413
412 #ifdef ENABLE_DEBUGGER_SUPPORT 414 #ifdef ENABLE_DEBUGGER_SUPPORT
413 #define INSTANCE_TYPE_LIST_DEBUGGER(V) \ 415 #define INSTANCE_TYPE_LIST_DEBUGGER(V) \
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 JS_DATE_TYPE, 729 JS_DATE_TYPE,
728 JS_OBJECT_TYPE, 730 JS_OBJECT_TYPE,
729 JS_CONTEXT_EXTENSION_OBJECT_TYPE, 731 JS_CONTEXT_EXTENSION_OBJECT_TYPE,
730 JS_GENERATOR_OBJECT_TYPE, 732 JS_GENERATOR_OBJECT_TYPE,
731 JS_MODULE_TYPE, 733 JS_MODULE_TYPE,
732 JS_GLOBAL_OBJECT_TYPE, 734 JS_GLOBAL_OBJECT_TYPE,
733 JS_BUILTINS_OBJECT_TYPE, 735 JS_BUILTINS_OBJECT_TYPE,
734 JS_GLOBAL_PROXY_TYPE, 736 JS_GLOBAL_PROXY_TYPE,
735 JS_ARRAY_TYPE, 737 JS_ARRAY_TYPE,
736 JS_ARRAY_BUFFER_TYPE, 738 JS_ARRAY_BUFFER_TYPE,
739 JS_DATA_VIEW_TYPE,
737 JS_TYPED_ARRAY_TYPE, 740 JS_TYPED_ARRAY_TYPE,
738 JS_SET_TYPE, 741 JS_SET_TYPE,
739 JS_MAP_TYPE, 742 JS_MAP_TYPE,
740 JS_WEAK_MAP_TYPE, 743 JS_WEAK_MAP_TYPE,
741 744
742 JS_REGEXP_TYPE, 745 JS_REGEXP_TYPE,
743 746
744 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE 747 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE
745 748
746 // Pseudo-types 749 // Pseudo-types
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 V(Oddball) \ 978 V(Oddball) \
976 V(SharedFunctionInfo) \ 979 V(SharedFunctionInfo) \
977 V(JSValue) \ 980 V(JSValue) \
978 V(JSDate) \ 981 V(JSDate) \
979 V(JSMessageObject) \ 982 V(JSMessageObject) \
980 V(StringWrapper) \ 983 V(StringWrapper) \
981 V(Foreign) \ 984 V(Foreign) \
982 V(Boolean) \ 985 V(Boolean) \
983 V(JSArray) \ 986 V(JSArray) \
984 V(JSArrayBuffer) \ 987 V(JSArrayBuffer) \
988 V(JSDataView) \
985 V(JSTypedArray) \ 989 V(JSTypedArray) \
986 V(JSProxy) \ 990 V(JSProxy) \
987 V(JSFunctionProxy) \ 991 V(JSFunctionProxy) \
988 V(JSSet) \ 992 V(JSSet) \
989 V(JSMap) \ 993 V(JSMap) \
990 V(JSWeakMap) \ 994 V(JSWeakMap) \
991 V(JSRegExp) \ 995 V(JSRegExp) \
992 V(HashTable) \ 996 V(HashTable) \
993 V(Dictionary) \ 997 V(Dictionary) \
994 V(StringTable) \ 998 V(StringTable) \
(...skipping 7791 matching lines...) Expand 10 before | Expand all | Expand 10 after
8786 static const int kSize = kFlagOffset + kPointerSize; 8790 static const int kSize = kFlagOffset + kPointerSize;
8787 8791
8788 private: 8792 private:
8789 // Bit position in a flag 8793 // Bit position in a flag
8790 static const int kIsExternalBit = 0; 8794 static const int kIsExternalBit = 0;
8791 8795
8792 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer); 8796 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer);
8793 }; 8797 };
8794 8798
8795 8799
8800 class JSDataView: public JSObject {
8801 public:
8802 // [buffer]: ArrayBuffer that this data view views.
8803 DECL_ACCESSORS(buffer, Object)
8804
8805 // [byte_length]: offset of data view in bytes.
8806 DECL_ACCESSORS(byte_offset, Object)
8807
8808 // [byte_length]: length of data view in bytes.
8809 DECL_ACCESSORS(byte_length, Object)
8810
8811 // Casting.
8812 static inline JSDataView* cast(Object* obj);
8813
8814 // Dispatched behavior.
8815 DECLARE_PRINTER(JSDataView)
8816 DECLARE_VERIFIER(JSDataView)
8817
8818 template <typename TypeName>
8819 TypeName Get(size_t byte_offset, bool little_endian = false);
8820
8821 template <typename TypeName>
8822 void Set(size_t byte_offset, TypeName value, bool little_endian = false);
8823
8824 static const int kBufferOffset = JSObject::kHeaderSize;
8825 static const int kByteOffsetOffset = kBufferOffset + kPointerSize;
8826 static const int kByteLengthOffset = kByteOffsetOffset + kPointerSize;
8827 static const int kSize = kByteLengthOffset + kPointerSize;
8828
8829 private:
8830 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataView);
8831 };
8832
8833
8796 class JSTypedArray: public JSObject { 8834 class JSTypedArray: public JSObject {
8797 public: 8835 public:
8798 // [buffer]: ArrayBuffer that this typed array views. 8836 // [buffer]: ArrayBuffer that this typed array views.
8799 DECL_ACCESSORS(buffer, Object) 8837 DECL_ACCESSORS(buffer, Object)
8800 8838
8801 // [byte_length]: offset of typed array in bytes. 8839 // [byte_length]: offset of typed array in bytes.
8802 DECL_ACCESSORS(byte_offset, Object) 8840 DECL_ACCESSORS(byte_offset, Object)
8803 8841
8804 // [byte_length]: length of typed array in bytes. 8842 // [byte_length]: length of typed array in bytes.
8805 DECL_ACCESSORS(byte_length, Object) 8843 DECL_ACCESSORS(byte_length, Object)
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
9629 } else { 9667 } else {
9630 value &= ~(1 << bit_position); 9668 value &= ~(1 << bit_position);
9631 } 9669 }
9632 return value; 9670 return value;
9633 } 9671 }
9634 }; 9672 };
9635 9673
9636 } } // namespace v8::internal 9674 } } // namespace v8::internal
9637 9675
9638 #endif // V8_OBJECTS_H_ 9676 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698