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 7527001: Encapsulate element handling into a class keyed on ElementsKind (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix nits Created 9 years, 4 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // - ByteArray 64 // - ByteArray
65 // - ExternalArray 65 // - ExternalArray
66 // - ExternalPixelArray 66 // - ExternalPixelArray
67 // - ExternalByteArray 67 // - ExternalByteArray
68 // - ExternalUnsignedByteArray 68 // - ExternalUnsignedByteArray
69 // - ExternalShortArray 69 // - ExternalShortArray
70 // - ExternalUnsignedShortArray 70 // - ExternalUnsignedShortArray
71 // - ExternalIntArray 71 // - ExternalIntArray
72 // - ExternalUnsignedIntArray 72 // - ExternalUnsignedIntArray
73 // - ExternalFloatArray 73 // - ExternalFloatArray
74 // - FixedArray 74 // - FixedArray
Lasse Reichstein 2011/08/02 12:23:46 I suddently remembered that this documentation is
danno 2011/08/02 13:37:46 Done.
75 // - DescriptorArray 75 // - DescriptorArray
76 // - HashTable 76 // - HashTable
77 // - Dictionary 77 // - Dictionary
78 // - SymbolTable 78 // - SymbolTable
79 // - CompilationCacheTable 79 // - CompilationCacheTable
80 // - CodeCacheHashTable 80 // - CodeCacheHashTable
81 // - MapCache 81 // - MapCache
82 // - Context 82 // - Context
83 // - JSFunctionResultCache 83 // - JSFunctionResultCache
84 // - SerializedScopeInfo 84 // - SerializedScopeInfo
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 inline bool name(); \ 623 inline bool name(); \
624 inline void set_##name(bool value); \ 624 inline void set_##name(bool value); \
625 625
626 626
627 #define DECL_ACCESSORS(name, type) \ 627 #define DECL_ACCESSORS(name, type) \
628 inline type* name(); \ 628 inline type* name(); \
629 inline void set_##name(type* value, \ 629 inline void set_##name(type* value, \
630 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \ 630 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \
631 631
632 632
633 class ElementsHandler;
633 class StringStream; 634 class StringStream;
634 class ObjectVisitor; 635 class ObjectVisitor;
636 class DictionaryElementsHandlerImpl;
635 637
636 struct ValueInfo : public Malloced { 638 struct ValueInfo : public Malloced {
637 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } 639 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { }
638 InstanceType type; 640 InstanceType type;
639 Object* ptr; 641 Object* ptr;
640 const char* str; 642 const char* str;
641 double number; 643 double number;
642 }; 644 };
643 645
644 646
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 // writing to any element the array must be copied. Use 1483 // writing to any element the array must be copied. Use
1482 // EnsureWritableFastElements in this case. 1484 // EnsureWritableFastElements in this case.
1483 // 1485 //
1484 // In the slow mode the elements is either a NumberDictionary, an 1486 // In the slow mode the elements is either a NumberDictionary, an
1485 // ExternalArray, or a FixedArray parameter map for a (non-strict) 1487 // ExternalArray, or a FixedArray parameter map for a (non-strict)
1486 // arguments object. 1488 // arguments object.
1487 DECL_ACCESSORS(elements, HeapObject) 1489 DECL_ACCESSORS(elements, HeapObject)
1488 inline void initialize_elements(); 1490 inline void initialize_elements();
1489 MUST_USE_RESULT inline MaybeObject* ResetElements(); 1491 MUST_USE_RESULT inline MaybeObject* ResetElements();
1490 inline ElementsKind GetElementsKind(); 1492 inline ElementsKind GetElementsKind();
1493 inline ElementsHandler* GetElementsHandler();
1491 inline bool HasFastElements(); 1494 inline bool HasFastElements();
1492 inline bool HasFastDoubleElements(); 1495 inline bool HasFastDoubleElements();
1493 inline bool HasDictionaryElements(); 1496 inline bool HasDictionaryElements();
1494 inline bool HasExternalPixelElements(); 1497 inline bool HasExternalPixelElements();
1495 inline bool HasExternalArrayElements(); 1498 inline bool HasExternalArrayElements();
1496 inline bool HasExternalByteElements(); 1499 inline bool HasExternalByteElements();
1497 inline bool HasExternalUnsignedByteElements(); 1500 inline bool HasExternalUnsignedByteElements();
1498 inline bool HasExternalShortElements(); 1501 inline bool HasExternalShortElements();
1499 inline bool HasExternalUnsignedShortElements(); 1502 inline bool HasExternalUnsignedShortElements();
1500 inline bool HasExternalIntElements(); 1503 inline bool HasExternalIntElements();
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, 1729 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index,
1727 Object* value, 1730 Object* value,
1728 StrictModeFlag strict_mode, 1731 StrictModeFlag strict_mode,
1729 bool check_prototype); 1732 bool check_prototype);
1730 1733
1731 // Returns the index'th element. 1734 // Returns the index'th element.
1732 // The undefined object if index is out of bounds. 1735 // The undefined object if index is out of bounds.
1733 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index); 1736 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index);
1734 MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index); 1737 MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index);
1735 1738
1736 // Get external element value at index if there is one and undefined
1737 // otherwise. Can return a failure if allocation of a heap number
1738 // failed.
1739 MaybeObject* GetExternalElement(uint32_t index);
1740
1741 // Replace the elements' backing store with fast elements of the given 1739 // Replace the elements' backing store with fast elements of the given
1742 // capacity. Update the length for JSArrays. Returns the new backing 1740 // capacity. Update the length for JSArrays. Returns the new backing
1743 // store. 1741 // store.
1744 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(int capacity, 1742 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(int capacity,
1745 int length); 1743 int length);
1746 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength( 1744 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength(
1747 int capacity, 1745 int capacity,
1748 int length); 1746 int length);
1749 MUST_USE_RESULT MaybeObject* SetSlowElements(Object* length); 1747 MUST_USE_RESULT MaybeObject* SetSlowElements(Object* length);
1750 1748
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1994 static const int kHeaderSize = kElementsOffset + kPointerSize; 1992 static const int kHeaderSize = kElementsOffset + kPointerSize;
1995 1993
1996 STATIC_CHECK(kHeaderSize == Internals::kJSObjectHeaderSize); 1994 STATIC_CHECK(kHeaderSize == Internals::kJSObjectHeaderSize);
1997 1995
1998 class BodyDescriptor : public FlexibleBodyDescriptor<kPropertiesOffset> { 1996 class BodyDescriptor : public FlexibleBodyDescriptor<kPropertiesOffset> {
1999 public: 1997 public:
2000 static inline int SizeOf(Map* map, HeapObject* object); 1998 static inline int SizeOf(Map* map, HeapObject* object);
2001 }; 1999 };
2002 2000
2003 private: 2001 private:
2002 friend class DictionaryElementsHandlerImpl;
2003
2004 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, 2004 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver,
2005 Object* structure, 2005 Object* structure,
2006 uint32_t index, 2006 uint32_t index,
2007 Object* holder); 2007 Object* holder);
2008 MaybeObject* SetElementWithCallback(Object* structure, 2008 MaybeObject* SetElementWithCallback(Object* structure,
2009 uint32_t index, 2009 uint32_t index,
2010 Object* value, 2010 Object* value,
2011 JSObject* holder, 2011 JSObject* holder,
2012 StrictModeFlag strict_mode); 2012 StrictModeFlag strict_mode);
2013 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor( 2013 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor(
2014 uint32_t index, 2014 uint32_t index,
2015 Object* value, 2015 Object* value,
2016 StrictModeFlag strict_mode, 2016 StrictModeFlag strict_mode,
2017 bool check_prototype); 2017 bool check_prototype);
2018 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor( 2018 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor(
2019 uint32_t index, 2019 uint32_t index,
2020 Object* value, 2020 Object* value,
2021 StrictModeFlag strict_mode, 2021 StrictModeFlag strict_mode,
2022 bool check_prototype); 2022 bool check_prototype);
2023 2023
2024 MaybeObject* GetElementPostInterceptor(Object* receiver, uint32_t index);
2025
2026 MUST_USE_RESULT MaybeObject* DeletePropertyPostInterceptor(String* name, 2024 MUST_USE_RESULT MaybeObject* DeletePropertyPostInterceptor(String* name,
2027 DeleteMode mode); 2025 DeleteMode mode);
2028 MUST_USE_RESULT MaybeObject* DeletePropertyWithInterceptor(String* name); 2026 MUST_USE_RESULT MaybeObject* DeletePropertyWithInterceptor(String* name);
2029 2027
2030 MUST_USE_RESULT MaybeObject* DeleteElementPostInterceptor(uint32_t index, 2028 MUST_USE_RESULT MaybeObject* DeleteElementPostInterceptor(uint32_t index,
2031 DeleteMode mode); 2029 DeleteMode mode);
2032 MUST_USE_RESULT MaybeObject* DeleteElementWithInterceptor(uint32_t index); 2030 MUST_USE_RESULT MaybeObject* DeleteElementWithInterceptor(uint32_t index);
2033 2031
2034 MUST_USE_RESULT MaybeObject* DeleteFastElement(uint32_t index); 2032 MUST_USE_RESULT MaybeObject* DeleteFastElement(uint32_t index);
2035 MUST_USE_RESULT MaybeObject* DeleteDictionaryElement(uint32_t index, 2033 MUST_USE_RESULT MaybeObject* DeleteDictionaryElement(uint32_t index,
(...skipping 26 matching lines...) Expand all
2062 PropertyAttributes attributes); 2060 PropertyAttributes attributes);
2063 2061
2064 void LookupInDescriptor(String* name, LookupResult* result); 2062 void LookupInDescriptor(String* name, LookupResult* result);
2065 2063
2066 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); 2064 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject);
2067 }; 2065 };
2068 2066
2069 2067
2070 // Common superclass for FixedArrays that allow implementations to share 2068 // Common superclass for FixedArrays that allow implementations to share
2071 // common accessors and some code paths. 2069 // common accessors and some code paths.
2072 class FixedArrayBase: public HeapObject { 2070 class FixedArrayBase: public HeapObject {
Lasse Reichstein 2011/08/01 09:35:54 Preferably this should be called FixedArray, as th
danno 2011/08/02 13:37:46 That's a reasonable observation, but I think I'll
2073 public: 2071 public:
2074 // [length]: length of the array. 2072 // [length]: length of the array.
2075 inline int length(); 2073 inline int length();
2076 inline void set_length(int value); 2074 inline void set_length(int value);
2077 2075
2078 inline static FixedArrayBase* cast(Object* object); 2076 inline static FixedArrayBase* cast(Object* object);
2079 2077
2080 // Layout description. 2078 // Layout description.
2081 // Length is smi tagged when it is stored. 2079 // Length is smi tagged when it is stored.
2082 static const int kLengthOffset = HeapObject::kHeaderSize; 2080 static const int kLengthOffset = HeapObject::kHeaderSize;
2083 static const int kHeaderSize = kLengthOffset + kPointerSize; 2081 static const int kHeaderSize = kLengthOffset + kPointerSize;
2084 }; 2082 };
2085 2083
2086 class FixedDoubleArray; 2084 class FixedDoubleArray;
2087 2085
2088 // FixedArray describes fixed-sized arrays with element type Object*. 2086 // FixedArray describes fixed-sized arrays with element type Object*.
2089 class FixedArray: public FixedArrayBase { 2087 class FixedArray: public FixedArrayBase {
2090 public: 2088 public:
2091 // Setter and getter for elements. 2089 // Setter and getter for elements.
2092 inline Object* get(int index); 2090 inline Object* get(int index);
2093 // Setter that uses write barrier. 2091 // Setter that uses write barrier.
2094 inline void set(int index, Object* value); 2092 inline void set(int index, Object* value);
2093 inline bool is_the_hole(int index);
2095 2094
2096 // Setter that doesn't need write barrier). 2095 // Setter that doesn't need write barrier).
2097 inline void set(int index, Smi* value); 2096 inline void set(int index, Smi* value);
2098 // Setter with explicit barrier mode. 2097 // Setter with explicit barrier mode.
2099 inline void set(int index, Object* value, WriteBarrierMode mode); 2098 inline void set(int index, Object* value, WriteBarrierMode mode);
2100 2099
2101 // Setters for frequently used oddballs located in old space. 2100 // Setters for frequently used oddballs located in old space.
2102 inline void set_undefined(int index); 2101 inline void set_undefined(int index);
2103 // TODO(isolates): duplicate. 2102 // TODO(isolates): duplicate.
2104 inline void set_undefined(Heap* heap, int index); 2103 inline void set_undefined(Heap* heap, int index);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
2190 2189
2191 2190
2192 // FixedDoubleArray describes fixed-sized arrays with element type double. 2191 // FixedDoubleArray describes fixed-sized arrays with element type double.
2193 class FixedDoubleArray: public FixedArrayBase { 2192 class FixedDoubleArray: public FixedArrayBase {
2194 public: 2193 public:
2195 inline void Initialize(FixedArray* from); 2194 inline void Initialize(FixedArray* from);
2196 inline void Initialize(FixedDoubleArray* from); 2195 inline void Initialize(FixedDoubleArray* from);
2197 inline void Initialize(NumberDictionary* from); 2196 inline void Initialize(NumberDictionary* from);
2198 2197
2199 // Setter and getter for elements. 2198 // Setter and getter for elements.
2200 inline double get(int index); 2199 inline double get_scalar(int index);
2200 inline MaybeObject* get(int index);
2201 inline void set(int index, double value); 2201 inline void set(int index, double value);
2202 inline void set_the_hole(int index); 2202 inline void set_the_hole(int index);
2203 2203
2204 // Checking for the hole. 2204 // Checking for the hole.
2205 inline bool is_the_hole(int index); 2205 inline bool is_the_hole(int index);
2206 2206
2207 // Garbage collection support. 2207 // Garbage collection support.
2208 inline static int SizeFor(int length) { 2208 inline static int SizeFor(int length) {
2209 return kHeaderSize + length * kDoubleSize; 2209 return kHeaderSize + length * kDoubleSize;
2210 } 2210 }
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
3122 // The semantics of these arrays differ from CanvasPixelArray. 3122 // The semantics of these arrays differ from CanvasPixelArray.
3123 // Out-of-range values passed to the setter are converted via a C 3123 // Out-of-range values passed to the setter are converted via a C
3124 // cast, not clamping. Out-of-range indices cause exceptions to be 3124 // cast, not clamping. Out-of-range indices cause exceptions to be
3125 // raised rather than being silently ignored. 3125 // raised rather than being silently ignored.
3126 class ExternalArray: public HeapObject { 3126 class ExternalArray: public HeapObject {
3127 public: 3127 public:
3128 // [length]: length of the array. 3128 // [length]: length of the array.
3129 inline int length(); 3129 inline int length();
3130 inline void set_length(int value); 3130 inline void set_length(int value);
3131 3131
3132 inline bool is_the_hole(int index) { return false; }
3133
3132 // [external_pointer]: The pointer to the external memory area backing this 3134 // [external_pointer]: The pointer to the external memory area backing this
3133 // external array. 3135 // external array.
3134 DECL_ACCESSORS(external_pointer, void) // Pointer to the data store. 3136 DECL_ACCESSORS(external_pointer, void) // Pointer to the data store.
3135 3137
3136 // Casting. 3138 // Casting.
3137 static inline ExternalArray* cast(Object* obj); 3139 static inline ExternalArray* cast(Object* obj);
3138 3140
3139 // Maximal acceptable length for an external array. 3141 // Maximal acceptable length for an external array.
3140 static const int kMaxLength = 0x3fffffff; 3142 static const int kMaxLength = 0x3fffffff;
3141 3143
(...skipping 15 matching lines...) Expand all
3157 3159
3158 // http://www.whatwg.org/specs/web-apps/current-work/ 3160 // http://www.whatwg.org/specs/web-apps/current-work/
3159 // multipage/the-canvas-element.html#canvaspixelarray 3161 // multipage/the-canvas-element.html#canvaspixelarray
3160 // In particular, write access clamps the value written to 0 or 255 if the 3162 // In particular, write access clamps the value written to 0 or 255 if the
3161 // value written is outside this range. 3163 // value written is outside this range.
3162 class ExternalPixelArray: public ExternalArray { 3164 class ExternalPixelArray: public ExternalArray {
3163 public: 3165 public:
3164 inline uint8_t* external_pixel_pointer(); 3166 inline uint8_t* external_pixel_pointer();
3165 3167
3166 // Setter and getter. 3168 // Setter and getter.
3167 inline uint8_t get(int index); 3169 inline uint8_t get_scalar(int index);
3170 inline MaybeObject* get(int index);
3168 inline void set(int index, uint8_t value); 3171 inline void set(int index, uint8_t value);
3169 3172
3170 // This accessor applies the correct conversion from Smi, HeapNumber and 3173 // This accessor applies the correct conversion from Smi, HeapNumber and
3171 // undefined and clamps the converted value between 0 and 255. 3174 // undefined and clamps the converted value between 0 and 255.
3172 Object* SetValue(uint32_t index, Object* value); 3175 Object* SetValue(uint32_t index, Object* value);
3173 3176
3174 // Casting. 3177 // Casting.
3175 static inline ExternalPixelArray* cast(Object* obj); 3178 static inline ExternalPixelArray* cast(Object* obj);
3176 3179
3177 #ifdef OBJECT_PRINT 3180 #ifdef OBJECT_PRINT
3178 inline void ExternalPixelArrayPrint() { 3181 inline void ExternalPixelArrayPrint() {
3179 ExternalPixelArrayPrint(stdout); 3182 ExternalPixelArrayPrint(stdout);
3180 } 3183 }
3181 void ExternalPixelArrayPrint(FILE* out); 3184 void ExternalPixelArrayPrint(FILE* out);
3182 #endif 3185 #endif
3183 #ifdef DEBUG 3186 #ifdef DEBUG
3184 void ExternalPixelArrayVerify(); 3187 void ExternalPixelArrayVerify();
3185 #endif // DEBUG 3188 #endif // DEBUG
3186 3189
3187 private: 3190 private:
3188 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalPixelArray); 3191 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalPixelArray);
3189 }; 3192 };
3190 3193
3191 3194
3192 class ExternalByteArray: public ExternalArray { 3195 class ExternalByteArray: public ExternalArray {
3193 public: 3196 public:
3194 // Setter and getter. 3197 // Setter and getter.
3195 inline int8_t get(int index); 3198 inline int8_t get_scalar(int index);
3199 inline MaybeObject* get(int index);
3196 inline void set(int index, int8_t value); 3200 inline void set(int index, int8_t value);
3197 3201
3198 // This accessor applies the correct conversion from Smi, HeapNumber 3202 // This accessor applies the correct conversion from Smi, HeapNumber
3199 // and undefined. 3203 // and undefined.
3200 MaybeObject* SetValue(uint32_t index, Object* value); 3204 MaybeObject* SetValue(uint32_t index, Object* value);
3201 3205
3202 // Casting. 3206 // Casting.
3203 static inline ExternalByteArray* cast(Object* obj); 3207 static inline ExternalByteArray* cast(Object* obj);
3204 3208
3205 #ifdef OBJECT_PRINT 3209 #ifdef OBJECT_PRINT
3206 inline void ExternalByteArrayPrint() { 3210 inline void ExternalByteArrayPrint() {
3207 ExternalByteArrayPrint(stdout); 3211 ExternalByteArrayPrint(stdout);
3208 } 3212 }
3209 void ExternalByteArrayPrint(FILE* out); 3213 void ExternalByteArrayPrint(FILE* out);
3210 #endif 3214 #endif
3211 #ifdef DEBUG 3215 #ifdef DEBUG
3212 void ExternalByteArrayVerify(); 3216 void ExternalByteArrayVerify();
3213 #endif // DEBUG 3217 #endif // DEBUG
3214 3218
3215 private: 3219 private:
3216 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray); 3220 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray);
3217 }; 3221 };
3218 3222
3219 3223
3220 class ExternalUnsignedByteArray: public ExternalArray { 3224 class ExternalUnsignedByteArray: public ExternalArray {
3221 public: 3225 public:
3222 // Setter and getter. 3226 // Setter and getter.
3223 inline uint8_t get(int index); 3227 inline uint8_t get_scalar(int index);
3228 inline MaybeObject* get(int index);
3224 inline void set(int index, uint8_t value); 3229 inline void set(int index, uint8_t value);
3225 3230
3226 // This accessor applies the correct conversion from Smi, HeapNumber 3231 // This accessor applies the correct conversion from Smi, HeapNumber
3227 // and undefined. 3232 // and undefined.
3228 MaybeObject* SetValue(uint32_t index, Object* value); 3233 MaybeObject* SetValue(uint32_t index, Object* value);
3229 3234
3230 // Casting. 3235 // Casting.
3231 static inline ExternalUnsignedByteArray* cast(Object* obj); 3236 static inline ExternalUnsignedByteArray* cast(Object* obj);
3232 3237
3233 #ifdef OBJECT_PRINT 3238 #ifdef OBJECT_PRINT
3234 inline void ExternalUnsignedByteArrayPrint() { 3239 inline void ExternalUnsignedByteArrayPrint() {
3235 ExternalUnsignedByteArrayPrint(stdout); 3240 ExternalUnsignedByteArrayPrint(stdout);
3236 } 3241 }
3237 void ExternalUnsignedByteArrayPrint(FILE* out); 3242 void ExternalUnsignedByteArrayPrint(FILE* out);
3238 #endif 3243 #endif
3239 #ifdef DEBUG 3244 #ifdef DEBUG
3240 void ExternalUnsignedByteArrayVerify(); 3245 void ExternalUnsignedByteArrayVerify();
3241 #endif // DEBUG 3246 #endif // DEBUG
3242 3247
3243 private: 3248 private:
3244 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray); 3249 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray);
3245 }; 3250 };
3246 3251
3247 3252
3248 class ExternalShortArray: public ExternalArray { 3253 class ExternalShortArray: public ExternalArray {
3249 public: 3254 public:
3250 // Setter and getter. 3255 // Setter and getter.
3251 inline int16_t get(int index); 3256 inline int16_t get_scalar(int index);
3257 inline MaybeObject* get(int index);
3252 inline void set(int index, int16_t value); 3258 inline void set(int index, int16_t value);
3253 3259
3254 // This accessor applies the correct conversion from Smi, HeapNumber 3260 // This accessor applies the correct conversion from Smi, HeapNumber
3255 // and undefined. 3261 // and undefined.
3256 MaybeObject* SetValue(uint32_t index, Object* value); 3262 MaybeObject* SetValue(uint32_t index, Object* value);
3257 3263
3258 // Casting. 3264 // Casting.
3259 static inline ExternalShortArray* cast(Object* obj); 3265 static inline ExternalShortArray* cast(Object* obj);
3260 3266
3261 #ifdef OBJECT_PRINT 3267 #ifdef OBJECT_PRINT
3262 inline void ExternalShortArrayPrint() { 3268 inline void ExternalShortArrayPrint() {
3263 ExternalShortArrayPrint(stdout); 3269 ExternalShortArrayPrint(stdout);
3264 } 3270 }
3265 void ExternalShortArrayPrint(FILE* out); 3271 void ExternalShortArrayPrint(FILE* out);
3266 #endif 3272 #endif
3267 #ifdef DEBUG 3273 #ifdef DEBUG
3268 void ExternalShortArrayVerify(); 3274 void ExternalShortArrayVerify();
3269 #endif // DEBUG 3275 #endif // DEBUG
3270 3276
3271 private: 3277 private:
3272 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray); 3278 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray);
3273 }; 3279 };
3274 3280
3275 3281
3276 class ExternalUnsignedShortArray: public ExternalArray { 3282 class ExternalUnsignedShortArray: public ExternalArray {
3277 public: 3283 public:
3278 // Setter and getter. 3284 // Setter and getter.
3279 inline uint16_t get(int index); 3285 inline uint16_t get_scalar(int index);
3286 inline MaybeObject* get(int index);
3280 inline void set(int index, uint16_t value); 3287 inline void set(int index, uint16_t value);
3281 3288
3282 // This accessor applies the correct conversion from Smi, HeapNumber 3289 // This accessor applies the correct conversion from Smi, HeapNumber
3283 // and undefined. 3290 // and undefined.
3284 MaybeObject* SetValue(uint32_t index, Object* value); 3291 MaybeObject* SetValue(uint32_t index, Object* value);
3285 3292
3286 // Casting. 3293 // Casting.
3287 static inline ExternalUnsignedShortArray* cast(Object* obj); 3294 static inline ExternalUnsignedShortArray* cast(Object* obj);
3288 3295
3289 #ifdef OBJECT_PRINT 3296 #ifdef OBJECT_PRINT
3290 inline void ExternalUnsignedShortArrayPrint() { 3297 inline void ExternalUnsignedShortArrayPrint() {
3291 ExternalUnsignedShortArrayPrint(stdout); 3298 ExternalUnsignedShortArrayPrint(stdout);
3292 } 3299 }
3293 void ExternalUnsignedShortArrayPrint(FILE* out); 3300 void ExternalUnsignedShortArrayPrint(FILE* out);
3294 #endif 3301 #endif
3295 #ifdef DEBUG 3302 #ifdef DEBUG
3296 void ExternalUnsignedShortArrayVerify(); 3303 void ExternalUnsignedShortArrayVerify();
3297 #endif // DEBUG 3304 #endif // DEBUG
3298 3305
3299 private: 3306 private:
3300 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray); 3307 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray);
3301 }; 3308 };
3302 3309
3303 3310
3304 class ExternalIntArray: public ExternalArray { 3311 class ExternalIntArray: public ExternalArray {
3305 public: 3312 public:
3306 // Setter and getter. 3313 // Setter and getter.
3307 inline int32_t get(int index); 3314 inline int32_t get_scalar(int index);
3315 inline MaybeObject* get(int index);
3308 inline void set(int index, int32_t value); 3316 inline void set(int index, int32_t value);
3309 3317
3310 // This accessor applies the correct conversion from Smi, HeapNumber 3318 // This accessor applies the correct conversion from Smi, HeapNumber
3311 // and undefined. 3319 // and undefined.
3312 MaybeObject* SetValue(uint32_t index, Object* value); 3320 MaybeObject* SetValue(uint32_t index, Object* value);
3313 3321
3314 // Casting. 3322 // Casting.
3315 static inline ExternalIntArray* cast(Object* obj); 3323 static inline ExternalIntArray* cast(Object* obj);
3316 3324
3317 #ifdef OBJECT_PRINT 3325 #ifdef OBJECT_PRINT
3318 inline void ExternalIntArrayPrint() { 3326 inline void ExternalIntArrayPrint() {
3319 ExternalIntArrayPrint(stdout); 3327 ExternalIntArrayPrint(stdout);
3320 } 3328 }
3321 void ExternalIntArrayPrint(FILE* out); 3329 void ExternalIntArrayPrint(FILE* out);
3322 #endif 3330 #endif
3323 #ifdef DEBUG 3331 #ifdef DEBUG
3324 void ExternalIntArrayVerify(); 3332 void ExternalIntArrayVerify();
3325 #endif // DEBUG 3333 #endif // DEBUG
3326 3334
3327 private: 3335 private:
3328 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray); 3336 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray);
3329 }; 3337 };
3330 3338
3331 3339
3332 class ExternalUnsignedIntArray: public ExternalArray { 3340 class ExternalUnsignedIntArray: public ExternalArray {
3333 public: 3341 public:
3334 // Setter and getter. 3342 // Setter and getter.
3335 inline uint32_t get(int index); 3343 inline uint32_t get_scalar(int index);
3344 inline MaybeObject* get(int index);
3336 inline void set(int index, uint32_t value); 3345 inline void set(int index, uint32_t value);
3337 3346
3338 // This accessor applies the correct conversion from Smi, HeapNumber 3347 // This accessor applies the correct conversion from Smi, HeapNumber
3339 // and undefined. 3348 // and undefined.
3340 MaybeObject* SetValue(uint32_t index, Object* value); 3349 MaybeObject* SetValue(uint32_t index, Object* value);
3341 3350
3342 // Casting. 3351 // Casting.
3343 static inline ExternalUnsignedIntArray* cast(Object* obj); 3352 static inline ExternalUnsignedIntArray* cast(Object* obj);
3344 3353
3345 #ifdef OBJECT_PRINT 3354 #ifdef OBJECT_PRINT
3346 inline void ExternalUnsignedIntArrayPrint() { 3355 inline void ExternalUnsignedIntArrayPrint() {
3347 ExternalUnsignedIntArrayPrint(stdout); 3356 ExternalUnsignedIntArrayPrint(stdout);
3348 } 3357 }
3349 void ExternalUnsignedIntArrayPrint(FILE* out); 3358 void ExternalUnsignedIntArrayPrint(FILE* out);
3350 #endif 3359 #endif
3351 #ifdef DEBUG 3360 #ifdef DEBUG
3352 void ExternalUnsignedIntArrayVerify(); 3361 void ExternalUnsignedIntArrayVerify();
3353 #endif // DEBUG 3362 #endif // DEBUG
3354 3363
3355 private: 3364 private:
3356 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray); 3365 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray);
3357 }; 3366 };
3358 3367
3359 3368
3360 class ExternalFloatArray: public ExternalArray { 3369 class ExternalFloatArray: public ExternalArray {
3361 public: 3370 public:
3362 // Setter and getter. 3371 // Setter and getter.
3363 inline float get(int index); 3372 inline float get_scalar(int index);
3373 inline MaybeObject* get(int index);
3364 inline void set(int index, float value); 3374 inline void set(int index, float value);
3365 3375
3366 // This accessor applies the correct conversion from Smi, HeapNumber 3376 // This accessor applies the correct conversion from Smi, HeapNumber
3367 // and undefined. 3377 // and undefined.
3368 MaybeObject* SetValue(uint32_t index, Object* value); 3378 MaybeObject* SetValue(uint32_t index, Object* value);
3369 3379
3370 // Casting. 3380 // Casting.
3371 static inline ExternalFloatArray* cast(Object* obj); 3381 static inline ExternalFloatArray* cast(Object* obj);
3372 3382
3373 #ifdef OBJECT_PRINT 3383 #ifdef OBJECT_PRINT
3374 inline void ExternalFloatArrayPrint() { 3384 inline void ExternalFloatArrayPrint() {
3375 ExternalFloatArrayPrint(stdout); 3385 ExternalFloatArrayPrint(stdout);
3376 } 3386 }
3377 void ExternalFloatArrayPrint(FILE* out); 3387 void ExternalFloatArrayPrint(FILE* out);
3378 #endif 3388 #endif
3379 #ifdef DEBUG 3389 #ifdef DEBUG
3380 void ExternalFloatArrayVerify(); 3390 void ExternalFloatArrayVerify();
3381 #endif // DEBUG 3391 #endif // DEBUG
3382 3392
3383 private: 3393 private:
3384 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray); 3394 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray);
3385 }; 3395 };
3386 3396
3387 3397
3388 class ExternalDoubleArray: public ExternalArray { 3398 class ExternalDoubleArray: public ExternalArray {
3389 public: 3399 public:
3390 // Setter and getter. 3400 // Setter and getter.
3391 inline double get(int index); 3401 inline double get_scalar(int index);
3402 inline MaybeObject* get(int index);
3392 inline void set(int index, double value); 3403 inline void set(int index, double value);
3393 3404
3394 // This accessor applies the correct conversion from Smi, HeapNumber 3405 // This accessor applies the correct conversion from Smi, HeapNumber
3395 // and undefined. 3406 // and undefined.
3396 MaybeObject* SetValue(uint32_t index, Object* value); 3407 MaybeObject* SetValue(uint32_t index, Object* value);
3397 3408
3398 // Casting. 3409 // Casting.
3399 static inline ExternalDoubleArray* cast(Object* obj); 3410 static inline ExternalDoubleArray* cast(Object* obj);
3400 3411
3401 #ifdef OBJECT_PRINT 3412 #ifdef OBJECT_PRINT
(...skipping 3854 matching lines...) Expand 10 before | Expand all | Expand 10 after
7256 } else { 7267 } else {
7257 value &= ~(1 << bit_position); 7268 value &= ~(1 << bit_position);
7258 } 7269 }
7259 return value; 7270 return value;
7260 } 7271 }
7261 }; 7272 };
7262 7273
7263 } } // namespace v8::internal 7274 } } // namespace v8::internal
7264 7275
7265 #endif // V8_OBJECTS_H_ 7276 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698