| 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 2182 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2193   inline bool HasExternalUint8Elements(); | 2193   inline bool HasExternalUint8Elements(); | 
| 2194   inline bool HasExternalInt16Elements(); | 2194   inline bool HasExternalInt16Elements(); | 
| 2195   inline bool HasExternalUint16Elements(); | 2195   inline bool HasExternalUint16Elements(); | 
| 2196   inline bool HasExternalInt32Elements(); | 2196   inline bool HasExternalInt32Elements(); | 
| 2197   inline bool HasExternalUint32Elements(); | 2197   inline bool HasExternalUint32Elements(); | 
| 2198   inline bool HasExternalFloat32Elements(); | 2198   inline bool HasExternalFloat32Elements(); | 
| 2199   inline bool HasExternalFloat64Elements(); | 2199   inline bool HasExternalFloat64Elements(); | 
| 2200 | 2200 | 
| 2201   inline bool HasFixedTypedArrayElements(); | 2201   inline bool HasFixedTypedArrayElements(); | 
| 2202 | 2202 | 
|  | 2203   inline bool HasFixedUint8ClampedElements(); | 
|  | 2204   inline bool HasFixedArrayElements(); | 
|  | 2205   inline bool HasFixedInt8Elements(); | 
|  | 2206   inline bool HasFixedUint8Elements(); | 
|  | 2207   inline bool HasFixedInt16Elements(); | 
|  | 2208   inline bool HasFixedUint16Elements(); | 
|  | 2209   inline bool HasFixedInt32Elements(); | 
|  | 2210   inline bool HasFixedUint32Elements(); | 
|  | 2211   inline bool HasFixedFloat32Elements(); | 
|  | 2212   inline bool HasFixedFloat64Elements(); | 
|  | 2213 | 
| 2203   bool HasFastArgumentsElements(); | 2214   bool HasFastArgumentsElements(); | 
| 2204   bool HasDictionaryArgumentsElements(); | 2215   bool HasDictionaryArgumentsElements(); | 
| 2205   inline SeededNumberDictionary* element_dictionary();  // Gets slow elements. | 2216   inline SeededNumberDictionary* element_dictionary();  // Gets slow elements. | 
| 2206 | 2217 | 
| 2207   inline void set_map_and_elements( | 2218   inline void set_map_and_elements( | 
| 2208       Map* map, | 2219       Map* map, | 
| 2209       FixedArrayBase* value, | 2220       FixedArrayBase* value, | 
| 2210       WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 2221       WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 
| 2211 | 2222 | 
| 2212   // Requires: HasFastElements(). | 2223   // Requires: HasFastElements(). | 
| (...skipping 2704 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4917 | 4928 | 
| 4918 class FixedTypedArrayBase: public FixedArrayBase { | 4929 class FixedTypedArrayBase: public FixedArrayBase { | 
| 4919  public: | 4930  public: | 
| 4920   // Casting: | 4931   // Casting: | 
| 4921   static inline FixedTypedArrayBase* cast(Object* obj); | 4932   static inline FixedTypedArrayBase* cast(Object* obj); | 
| 4922 | 4933 | 
| 4923   static const int kDataOffset = kHeaderSize; | 4934   static const int kDataOffset = kHeaderSize; | 
| 4924 | 4935 | 
| 4925   inline int size(); | 4936   inline int size(); | 
| 4926 | 4937 | 
|  | 4938   // Use with care: returns raw pointer into heap. | 
|  | 4939   inline void* DataPtr(); | 
|  | 4940 | 
|  | 4941   inline int DataSize(); | 
|  | 4942 | 
| 4927  private: | 4943  private: | 
| 4928   DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArrayBase); | 4944   DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArrayBase); | 
| 4929 }; | 4945 }; | 
| 4930 | 4946 | 
| 4931 | 4947 | 
| 4932 template <class Traits> | 4948 template <class Traits> | 
| 4933 class FixedTypedArray: public FixedTypedArrayBase { | 4949 class FixedTypedArray: public FixedTypedArrayBase { | 
| 4934  public: | 4950  public: | 
| 4935   typedef typename Traits::ElementType ElementType; | 4951   typedef typename Traits::ElementType ElementType; | 
| 4936   static const InstanceType kInstanceType = Traits::kInstanceType; | 4952   static const InstanceType kInstanceType = Traits::kInstanceType; | 
| 4937 | 4953 | 
| 4938   // Casting: | 4954   // Casting: | 
| 4939   static inline FixedTypedArray<Traits>* cast(Object* obj); | 4955   static inline FixedTypedArray<Traits>* cast(Object* obj); | 
| 4940 | 4956 | 
| 4941   static inline int ElementOffset(int index) { | 4957   static inline int ElementOffset(int index) { | 
| 4942     return kDataOffset + index * sizeof(ElementType); | 4958     return kDataOffset + index * sizeof(ElementType); | 
| 4943   } | 4959   } | 
| 4944 | 4960 | 
| 4945   static inline int SizeFor(int length) { | 4961   static inline int SizeFor(int length) { | 
| 4946     return ElementOffset(length); | 4962     return ElementOffset(length); | 
| 4947   } | 4963   } | 
| 4948 | 4964 | 
| 4949   inline ElementType get_scalar(int index); | 4965   inline ElementType get_scalar(int index); | 
| 4950   MUST_USE_RESULT inline MaybeObject* get(int index); | 4966   MUST_USE_RESULT inline MaybeObject* get(int index); | 
| 4951   inline void set(int index, ElementType value); | 4967   inline void set(int index, ElementType value); | 
| 4952 | 4968 | 
|  | 4969   static inline ElementType from_int(int value); | 
|  | 4970   static inline ElementType from_double(double value); | 
|  | 4971 | 
| 4953   // This accessor applies the correct conversion from Smi, HeapNumber | 4972   // This accessor applies the correct conversion from Smi, HeapNumber | 
| 4954   // and undefined. | 4973   // and undefined. | 
| 4955   MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); | 4974   MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); | 
| 4956 | 4975 | 
| 4957   static Handle<Object> SetValue(Handle<FixedTypedArray<Traits> > array, | 4976   static Handle<Object> SetValue(Handle<FixedTypedArray<Traits> > array, | 
| 4958                                  uint32_t index, | 4977                                  uint32_t index, | 
| 4959                                  Handle<Object> value); | 4978                                  Handle<Object> value); | 
| 4960 | 4979 | 
| 4961   DECLARE_PRINTER(FixedTypedArray) | 4980   DECLARE_PRINTER(FixedTypedArray) | 
| 4962   DECLARE_VERIFIER(FixedTypedArray) | 4981   DECLARE_VERIFIER(FixedTypedArray) | 
| 4963 | 4982 | 
| 4964  private: | 4983  private: | 
| 4965   DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArray); | 4984   DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArray); | 
| 4966 }; | 4985 }; | 
| 4967 | 4986 | 
| 4968 #define FIXED_TYPED_ARRAY_TRAITS(Type, type, TYPE, elementType, size)         \ | 4987 #define FIXED_TYPED_ARRAY_TRAITS(Type, type, TYPE, elementType, size)         \ | 
| 4969   class Type##ArrayTraits {                                                   \ | 4988   class Type##ArrayTraits {                                                   \ | 
| 4970     public:                                                                   \ | 4989     public:                                                                   \ | 
| 4971       typedef elementType ElementType;                                        \ | 4990       typedef elementType ElementType;                                        \ | 
| 4972       static const InstanceType kInstanceType = FIXED_##TYPE##_ARRAY_TYPE;    \ | 4991       static const InstanceType kInstanceType = FIXED_##TYPE##_ARRAY_TYPE;    \ | 
| 4973       static const char* Designator() { return #type " array"; }              \ | 4992       static const char* Designator() { return #type " array"; }              \ | 
| 4974       static inline MaybeObject* ToObject(Heap* heap, elementType scalar);    \ | 4993       static inline MaybeObject* ToObject(Heap* heap, elementType scalar);    \ | 
| 4975       static elementType defaultValue() { return 0; }                         \ | 4994       static inline elementType defaultValue();                               \ | 
| 4976   };                                                                          \ | 4995   };                                                                          \ | 
| 4977                                                                               \ | 4996                                                                               \ | 
| 4978   typedef FixedTypedArray<Type##ArrayTraits> Fixed##Type##Array; | 4997   typedef FixedTypedArray<Type##ArrayTraits> Fixed##Type##Array; | 
| 4979 | 4998 | 
| 4980 TYPED_ARRAYS(FIXED_TYPED_ARRAY_TRAITS) | 4999 TYPED_ARRAYS(FIXED_TYPED_ARRAY_TRAITS) | 
| 4981 | 5000 | 
| 4982 #undef FIXED_TYPED_ARRAY_TRAITS | 5001 #undef FIXED_TYPED_ARRAY_TRAITS | 
| 4983 | 5002 | 
| 4984 // DeoptimizationInputData is a fixed array used to hold the deoptimization | 5003 // DeoptimizationInputData is a fixed array used to hold the deoptimization | 
| 4985 // data for code generated by the Hydrogen/Lithium compiler.  It also | 5004 // data for code generated by the Hydrogen/Lithium compiler.  It also | 
| (...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6181                                                  TransitionFlag flag); | 6200                                                  TransitionFlag flag); | 
| 6182   MUST_USE_RESULT MaybeObject* CopyInsertDescriptor(Descriptor* descriptor, | 6201   MUST_USE_RESULT MaybeObject* CopyInsertDescriptor(Descriptor* descriptor, | 
| 6183                                                     TransitionFlag flag); | 6202                                                     TransitionFlag flag); | 
| 6184   MUST_USE_RESULT MaybeObject* CopyReplaceDescriptor( | 6203   MUST_USE_RESULT MaybeObject* CopyReplaceDescriptor( | 
| 6185       DescriptorArray* descriptors, | 6204       DescriptorArray* descriptors, | 
| 6186       Descriptor* descriptor, | 6205       Descriptor* descriptor, | 
| 6187       int index, | 6206       int index, | 
| 6188       TransitionFlag flag); | 6207       TransitionFlag flag); | 
| 6189   MUST_USE_RESULT MaybeObject* AsElementsKind(ElementsKind kind); | 6208   MUST_USE_RESULT MaybeObject* AsElementsKind(ElementsKind kind); | 
| 6190 | 6209 | 
|  | 6210   static Handle<Map> AsElementsKind(Handle<Map> map, ElementsKind kind); | 
|  | 6211 | 
| 6191   MUST_USE_RESULT MaybeObject* CopyAsElementsKind(ElementsKind kind, | 6212   MUST_USE_RESULT MaybeObject* CopyAsElementsKind(ElementsKind kind, | 
| 6192                                                   TransitionFlag flag); | 6213                                                   TransitionFlag flag); | 
| 6193 | 6214 | 
| 6194   static Handle<Map> CopyForObserved(Handle<Map> map); | 6215   static Handle<Map> CopyForObserved(Handle<Map> map); | 
| 6195 | 6216 | 
| 6196   static Handle<Map> CopyNormalized(Handle<Map> map, | 6217   static Handle<Map> CopyNormalized(Handle<Map> map, | 
| 6197                                     PropertyNormalizationMode mode, | 6218                                     PropertyNormalizationMode mode, | 
| 6198                                     NormalizedMapSharingMode sharing); | 6219                                     NormalizedMapSharingMode sharing); | 
| 6199 | 6220 | 
| 6200   inline void AppendDescriptor(Descriptor* desc, | 6221   inline void AppendDescriptor(Descriptor* desc, | 
| (...skipping 3703 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 9904 | 9925 | 
| 9905   // Neutering. Only neuters this typed array. | 9926   // Neutering. Only neuters this typed array. | 
| 9906   void Neuter(); | 9927   void Neuter(); | 
| 9907 | 9928 | 
| 9908   // Casting. | 9929   // Casting. | 
| 9909   static inline JSTypedArray* cast(Object* obj); | 9930   static inline JSTypedArray* cast(Object* obj); | 
| 9910 | 9931 | 
| 9911   ExternalArrayType type(); | 9932   ExternalArrayType type(); | 
| 9912   size_t element_size(); | 9933   size_t element_size(); | 
| 9913 | 9934 | 
|  | 9935   Handle<JSArrayBuffer> GetBuffer(); | 
|  | 9936 | 
| 9914   // Dispatched behavior. | 9937   // Dispatched behavior. | 
| 9915   DECLARE_PRINTER(JSTypedArray) | 9938   DECLARE_PRINTER(JSTypedArray) | 
| 9916   DECLARE_VERIFIER(JSTypedArray) | 9939   DECLARE_VERIFIER(JSTypedArray) | 
| 9917 | 9940 | 
| 9918   static const int kLengthOffset = kViewSize + kPointerSize; | 9941   static const int kLengthOffset = kViewSize + kPointerSize; | 
| 9919   static const int kSize = kLengthOffset + kPointerSize; | 9942   static const int kSize = kLengthOffset + kPointerSize; | 
| 9920 | 9943 | 
| 9921   static const int kSizeWithInternalFields = | 9944   static const int kSizeWithInternalFields = | 
| 9922       kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; | 9945       kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; | 
| 9923 | 9946 | 
| 9924  private: | 9947  private: | 
|  | 9948   static Handle<JSArrayBuffer> MaterializeArrayBuffer( | 
|  | 9949       Handle<JSTypedArray> typed_array); | 
|  | 9950 | 
| 9925   DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); | 9951   DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); | 
| 9926 }; | 9952 }; | 
| 9927 | 9953 | 
| 9928 | 9954 | 
| 9929 class JSDataView: public JSArrayBufferView { | 9955 class JSDataView: public JSArrayBufferView { | 
| 9930  public: | 9956  public: | 
| 9931   // Only neuters this DataView | 9957   // Only neuters this DataView | 
| 9932   void Neuter(); | 9958   void Neuter(); | 
| 9933 | 9959 | 
| 9934   // Casting. | 9960   // Casting. | 
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 10777     } else { | 10803     } else { | 
| 10778       value &= ~(1 << bit_position); | 10804       value &= ~(1 << bit_position); | 
| 10779     } | 10805     } | 
| 10780     return value; | 10806     return value; | 
| 10781   } | 10807   } | 
| 10782 }; | 10808 }; | 
| 10783 | 10809 | 
| 10784 } }  // namespace v8::internal | 10810 } }  // namespace v8::internal | 
| 10785 | 10811 | 
| 10786 #endif  // V8_OBJECTS_H_ | 10812 #endif  // V8_OBJECTS_H_ | 
| OLD | NEW | 
|---|