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

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: merge with tot 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
« no previous file with comments | « src/elements.cc ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // - FixedArrayBase
75 // - DescriptorArray 75 // - FixedArray
76 // - HashTable 76 // - DescriptorArray
77 // - Dictionary 77 // - HashTable
78 // - SymbolTable 78 // - Dictionary
79 // - CompilationCacheTable 79 // - SymbolTable
80 // - CodeCacheHashTable 80 // - CompilationCacheTable
81 // - MapCache 81 // - CodeCacheHashTable
82 // - Context 82 // - MapCache
83 // - JSFunctionResultCache 83 // - Context
84 // - SerializedScopeInfo 84 // - JSFunctionResultCache
85 // - SerializedScopeInfo
86 // - FixedDoubleArray
85 // - String 87 // - String
86 // - SeqString 88 // - SeqString
87 // - SeqAsciiString 89 // - SeqAsciiString
88 // - SeqTwoByteString 90 // - SeqTwoByteString
89 // - ConsString 91 // - ConsString
90 // - ExternalString 92 // - ExternalString
91 // - ExternalAsciiString 93 // - ExternalAsciiString
92 // - ExternalTwoByteString 94 // - ExternalTwoByteString
93 // - HeapNumber 95 // - HeapNumber
94 // - Code 96 // - Code
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 inline bool name(); \ 625 inline bool name(); \
624 inline void set_##name(bool value); \ 626 inline void set_##name(bool value); \
625 627
626 628
627 #define DECL_ACCESSORS(name, type) \ 629 #define DECL_ACCESSORS(name, type) \
628 inline type* name(); \ 630 inline type* name(); \
629 inline void set_##name(type* value, \ 631 inline void set_##name(type* value, \
630 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \ 632 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \
631 633
632 634
635 class ElementsAccessor;
633 class StringStream; 636 class StringStream;
634 class ObjectVisitor; 637 class ObjectVisitor;
638 class DictionaryElementsAccessor;
635 639
636 struct ValueInfo : public Malloced { 640 struct ValueInfo : public Malloced {
637 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } 641 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { }
638 InstanceType type; 642 InstanceType type;
639 Object* ptr; 643 Object* ptr;
640 const char* str; 644 const char* str;
641 double number; 645 double number;
642 }; 646 };
643 647
644 648
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 // writing to any element the array must be copied. Use 1485 // writing to any element the array must be copied. Use
1482 // EnsureWritableFastElements in this case. 1486 // EnsureWritableFastElements in this case.
1483 // 1487 //
1484 // In the slow mode the elements is either a NumberDictionary, an 1488 // In the slow mode the elements is either a NumberDictionary, an
1485 // ExternalArray, or a FixedArray parameter map for a (non-strict) 1489 // ExternalArray, or a FixedArray parameter map for a (non-strict)
1486 // arguments object. 1490 // arguments object.
1487 DECL_ACCESSORS(elements, HeapObject) 1491 DECL_ACCESSORS(elements, HeapObject)
1488 inline void initialize_elements(); 1492 inline void initialize_elements();
1489 MUST_USE_RESULT inline MaybeObject* ResetElements(); 1493 MUST_USE_RESULT inline MaybeObject* ResetElements();
1490 inline ElementsKind GetElementsKind(); 1494 inline ElementsKind GetElementsKind();
1495 inline ElementsAccessor* GetElementsAccessor();
1491 inline bool HasFastElements(); 1496 inline bool HasFastElements();
1492 inline bool HasFastDoubleElements(); 1497 inline bool HasFastDoubleElements();
1493 inline bool HasDictionaryElements(); 1498 inline bool HasDictionaryElements();
1494 inline bool HasExternalPixelElements(); 1499 inline bool HasExternalPixelElements();
1495 inline bool HasExternalArrayElements(); 1500 inline bool HasExternalArrayElements();
1496 inline bool HasExternalByteElements(); 1501 inline bool HasExternalByteElements();
1497 inline bool HasExternalUnsignedByteElements(); 1502 inline bool HasExternalUnsignedByteElements();
1498 inline bool HasExternalShortElements(); 1503 inline bool HasExternalShortElements();
1499 inline bool HasExternalUnsignedShortElements(); 1504 inline bool HasExternalUnsignedShortElements();
1500 inline bool HasExternalIntElements(); 1505 inline bool HasExternalIntElements();
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, 1731 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index,
1727 Object* value, 1732 Object* value,
1728 StrictModeFlag strict_mode, 1733 StrictModeFlag strict_mode,
1729 bool check_prototype); 1734 bool check_prototype);
1730 1735
1731 // Returns the index'th element. 1736 // Returns the index'th element.
1732 // The undefined object if index is out of bounds. 1737 // The undefined object if index is out of bounds.
1733 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index); 1738 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index);
1734 MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index); 1739 MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index);
1735 1740
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 1741 // Replace the elements' backing store with fast elements of the given
1742 // capacity. Update the length for JSArrays. Returns the new backing 1742 // capacity. Update the length for JSArrays. Returns the new backing
1743 // store. 1743 // store.
1744 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(int capacity, 1744 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(int capacity,
1745 int length); 1745 int length);
1746 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength( 1746 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength(
1747 int capacity, 1747 int capacity,
1748 int length); 1748 int length);
1749 MUST_USE_RESULT MaybeObject* SetSlowElements(Object* length); 1749 MUST_USE_RESULT MaybeObject* SetSlowElements(Object* length);
1750 1750
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1994 static const int kHeaderSize = kElementsOffset + kPointerSize; 1994 static const int kHeaderSize = kElementsOffset + kPointerSize;
1995 1995
1996 STATIC_CHECK(kHeaderSize == Internals::kJSObjectHeaderSize); 1996 STATIC_CHECK(kHeaderSize == Internals::kJSObjectHeaderSize);
1997 1997
1998 class BodyDescriptor : public FlexibleBodyDescriptor<kPropertiesOffset> { 1998 class BodyDescriptor : public FlexibleBodyDescriptor<kPropertiesOffset> {
1999 public: 1999 public:
2000 static inline int SizeOf(Map* map, HeapObject* object); 2000 static inline int SizeOf(Map* map, HeapObject* object);
2001 }; 2001 };
2002 2002
2003 private: 2003 private:
2004 friend class DictionaryElementsAccessor;
2005
2004 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, 2006 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver,
2005 Object* structure, 2007 Object* structure,
2006 uint32_t index, 2008 uint32_t index,
2007 Object* holder); 2009 Object* holder);
2008 MaybeObject* SetElementWithCallback(Object* structure, 2010 MaybeObject* SetElementWithCallback(Object* structure,
2009 uint32_t index, 2011 uint32_t index,
2010 Object* value, 2012 Object* value,
2011 JSObject* holder, 2013 JSObject* holder,
2012 StrictModeFlag strict_mode); 2014 StrictModeFlag strict_mode);
2013 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor( 2015 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor(
2014 uint32_t index, 2016 uint32_t index,
2015 Object* value, 2017 Object* value,
2016 StrictModeFlag strict_mode, 2018 StrictModeFlag strict_mode,
2017 bool check_prototype); 2019 bool check_prototype);
2018 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor( 2020 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor(
2019 uint32_t index, 2021 uint32_t index,
2020 Object* value, 2022 Object* value,
2021 StrictModeFlag strict_mode, 2023 StrictModeFlag strict_mode,
2022 bool check_prototype); 2024 bool check_prototype);
2023 2025
2024 MaybeObject* GetElementPostInterceptor(Object* receiver, uint32_t index);
2025
2026 MUST_USE_RESULT MaybeObject* DeletePropertyPostInterceptor(String* name, 2026 MUST_USE_RESULT MaybeObject* DeletePropertyPostInterceptor(String* name,
2027 DeleteMode mode); 2027 DeleteMode mode);
2028 MUST_USE_RESULT MaybeObject* DeletePropertyWithInterceptor(String* name); 2028 MUST_USE_RESULT MaybeObject* DeletePropertyWithInterceptor(String* name);
2029 2029
2030 MUST_USE_RESULT MaybeObject* DeleteElementPostInterceptor(uint32_t index, 2030 MUST_USE_RESULT MaybeObject* DeleteElementPostInterceptor(uint32_t index,
2031 DeleteMode mode); 2031 DeleteMode mode);
2032 MUST_USE_RESULT MaybeObject* DeleteElementWithInterceptor(uint32_t index); 2032 MUST_USE_RESULT MaybeObject* DeleteElementWithInterceptor(uint32_t index);
2033 2033
2034 MUST_USE_RESULT MaybeObject* DeleteFastElement(uint32_t index); 2034 MUST_USE_RESULT MaybeObject* DeleteFastElement(uint32_t index);
2035 MUST_USE_RESULT MaybeObject* DeleteDictionaryElement(uint32_t index, 2035 MUST_USE_RESULT MaybeObject* DeleteDictionaryElement(uint32_t index,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2085 2085
2086 class FixedDoubleArray; 2086 class FixedDoubleArray;
2087 2087
2088 // FixedArray describes fixed-sized arrays with element type Object*. 2088 // FixedArray describes fixed-sized arrays with element type Object*.
2089 class FixedArray: public FixedArrayBase { 2089 class FixedArray: public FixedArrayBase {
2090 public: 2090 public:
2091 // Setter and getter for elements. 2091 // Setter and getter for elements.
2092 inline Object* get(int index); 2092 inline Object* get(int index);
2093 // Setter that uses write barrier. 2093 // Setter that uses write barrier.
2094 inline void set(int index, Object* value); 2094 inline void set(int index, Object* value);
2095 inline bool is_the_hole(int index);
2095 2096
2096 // Setter that doesn't need write barrier). 2097 // Setter that doesn't need write barrier).
2097 inline void set(int index, Smi* value); 2098 inline void set(int index, Smi* value);
2098 // Setter with explicit barrier mode. 2099 // Setter with explicit barrier mode.
2099 inline void set(int index, Object* value, WriteBarrierMode mode); 2100 inline void set(int index, Object* value, WriteBarrierMode mode);
2100 2101
2101 // Setters for frequently used oddballs located in old space. 2102 // Setters for frequently used oddballs located in old space.
2102 inline void set_undefined(int index); 2103 inline void set_undefined(int index);
2103 // TODO(isolates): duplicate. 2104 // TODO(isolates): duplicate.
2104 inline void set_undefined(Heap* heap, int index); 2105 inline void set_undefined(Heap* heap, int index);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
2190 2191
2191 2192
2192 // FixedDoubleArray describes fixed-sized arrays with element type double. 2193 // FixedDoubleArray describes fixed-sized arrays with element type double.
2193 class FixedDoubleArray: public FixedArrayBase { 2194 class FixedDoubleArray: public FixedArrayBase {
2194 public: 2195 public:
2195 inline void Initialize(FixedArray* from); 2196 inline void Initialize(FixedArray* from);
2196 inline void Initialize(FixedDoubleArray* from); 2197 inline void Initialize(FixedDoubleArray* from);
2197 inline void Initialize(NumberDictionary* from); 2198 inline void Initialize(NumberDictionary* from);
2198 2199
2199 // Setter and getter for elements. 2200 // Setter and getter for elements.
2200 inline double get(int index); 2201 inline double get_scalar(int index);
2202 inline MaybeObject* get(int index);
2201 inline void set(int index, double value); 2203 inline void set(int index, double value);
2202 inline void set_the_hole(int index); 2204 inline void set_the_hole(int index);
2203 2205
2204 // Checking for the hole. 2206 // Checking for the hole.
2205 inline bool is_the_hole(int index); 2207 inline bool is_the_hole(int index);
2206 2208
2207 // Garbage collection support. 2209 // Garbage collection support.
2208 inline static int SizeFor(int length) { 2210 inline static int SizeFor(int length) {
2209 return kHeaderSize + length * kDoubleSize; 2211 return kHeaderSize + length * kDoubleSize;
2210 } 2212 }
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
3122 // The semantics of these arrays differ from CanvasPixelArray. 3124 // The semantics of these arrays differ from CanvasPixelArray.
3123 // Out-of-range values passed to the setter are converted via a C 3125 // 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 3126 // cast, not clamping. Out-of-range indices cause exceptions to be
3125 // raised rather than being silently ignored. 3127 // raised rather than being silently ignored.
3126 class ExternalArray: public HeapObject { 3128 class ExternalArray: public HeapObject {
3127 public: 3129 public:
3128 // [length]: length of the array. 3130 // [length]: length of the array.
3129 inline int length(); 3131 inline int length();
3130 inline void set_length(int value); 3132 inline void set_length(int value);
3131 3133
3134 inline bool is_the_hole(int index) { return false; }
3135
3132 // [external_pointer]: The pointer to the external memory area backing this 3136 // [external_pointer]: The pointer to the external memory area backing this
3133 // external array. 3137 // external array.
3134 DECL_ACCESSORS(external_pointer, void) // Pointer to the data store. 3138 DECL_ACCESSORS(external_pointer, void) // Pointer to the data store.
3135 3139
3136 // Casting. 3140 // Casting.
3137 static inline ExternalArray* cast(Object* obj); 3141 static inline ExternalArray* cast(Object* obj);
3138 3142
3139 // Maximal acceptable length for an external array. 3143 // Maximal acceptable length for an external array.
3140 static const int kMaxLength = 0x3fffffff; 3144 static const int kMaxLength = 0x3fffffff;
3141 3145
(...skipping 15 matching lines...) Expand all
3157 3161
3158 // http://www.whatwg.org/specs/web-apps/current-work/ 3162 // http://www.whatwg.org/specs/web-apps/current-work/
3159 // multipage/the-canvas-element.html#canvaspixelarray 3163 // multipage/the-canvas-element.html#canvaspixelarray
3160 // In particular, write access clamps the value written to 0 or 255 if the 3164 // In particular, write access clamps the value written to 0 or 255 if the
3161 // value written is outside this range. 3165 // value written is outside this range.
3162 class ExternalPixelArray: public ExternalArray { 3166 class ExternalPixelArray: public ExternalArray {
3163 public: 3167 public:
3164 inline uint8_t* external_pixel_pointer(); 3168 inline uint8_t* external_pixel_pointer();
3165 3169
3166 // Setter and getter. 3170 // Setter and getter.
3167 inline uint8_t get(int index); 3171 inline uint8_t get_scalar(int index);
3172 inline MaybeObject* get(int index);
3168 inline void set(int index, uint8_t value); 3173 inline void set(int index, uint8_t value);
3169 3174
3170 // This accessor applies the correct conversion from Smi, HeapNumber and 3175 // This accessor applies the correct conversion from Smi, HeapNumber and
3171 // undefined and clamps the converted value between 0 and 255. 3176 // undefined and clamps the converted value between 0 and 255.
3172 Object* SetValue(uint32_t index, Object* value); 3177 Object* SetValue(uint32_t index, Object* value);
3173 3178
3174 // Casting. 3179 // Casting.
3175 static inline ExternalPixelArray* cast(Object* obj); 3180 static inline ExternalPixelArray* cast(Object* obj);
3176 3181
3177 #ifdef OBJECT_PRINT 3182 #ifdef OBJECT_PRINT
3178 inline void ExternalPixelArrayPrint() { 3183 inline void ExternalPixelArrayPrint() {
3179 ExternalPixelArrayPrint(stdout); 3184 ExternalPixelArrayPrint(stdout);
3180 } 3185 }
3181 void ExternalPixelArrayPrint(FILE* out); 3186 void ExternalPixelArrayPrint(FILE* out);
3182 #endif 3187 #endif
3183 #ifdef DEBUG 3188 #ifdef DEBUG
3184 void ExternalPixelArrayVerify(); 3189 void ExternalPixelArrayVerify();
3185 #endif // DEBUG 3190 #endif // DEBUG
3186 3191
3187 private: 3192 private:
3188 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalPixelArray); 3193 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalPixelArray);
3189 }; 3194 };
3190 3195
3191 3196
3192 class ExternalByteArray: public ExternalArray { 3197 class ExternalByteArray: public ExternalArray {
3193 public: 3198 public:
3194 // Setter and getter. 3199 // Setter and getter.
3195 inline int8_t get(int index); 3200 inline int8_t get_scalar(int index);
3201 inline MaybeObject* get(int index);
3196 inline void set(int index, int8_t value); 3202 inline void set(int index, int8_t value);
3197 3203
3198 // This accessor applies the correct conversion from Smi, HeapNumber 3204 // This accessor applies the correct conversion from Smi, HeapNumber
3199 // and undefined. 3205 // and undefined.
3200 MaybeObject* SetValue(uint32_t index, Object* value); 3206 MaybeObject* SetValue(uint32_t index, Object* value);
3201 3207
3202 // Casting. 3208 // Casting.
3203 static inline ExternalByteArray* cast(Object* obj); 3209 static inline ExternalByteArray* cast(Object* obj);
3204 3210
3205 #ifdef OBJECT_PRINT 3211 #ifdef OBJECT_PRINT
3206 inline void ExternalByteArrayPrint() { 3212 inline void ExternalByteArrayPrint() {
3207 ExternalByteArrayPrint(stdout); 3213 ExternalByteArrayPrint(stdout);
3208 } 3214 }
3209 void ExternalByteArrayPrint(FILE* out); 3215 void ExternalByteArrayPrint(FILE* out);
3210 #endif 3216 #endif
3211 #ifdef DEBUG 3217 #ifdef DEBUG
3212 void ExternalByteArrayVerify(); 3218 void ExternalByteArrayVerify();
3213 #endif // DEBUG 3219 #endif // DEBUG
3214 3220
3215 private: 3221 private:
3216 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray); 3222 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray);
3217 }; 3223 };
3218 3224
3219 3225
3220 class ExternalUnsignedByteArray: public ExternalArray { 3226 class ExternalUnsignedByteArray: public ExternalArray {
3221 public: 3227 public:
3222 // Setter and getter. 3228 // Setter and getter.
3223 inline uint8_t get(int index); 3229 inline uint8_t get_scalar(int index);
3230 inline MaybeObject* get(int index);
3224 inline void set(int index, uint8_t value); 3231 inline void set(int index, uint8_t value);
3225 3232
3226 // This accessor applies the correct conversion from Smi, HeapNumber 3233 // This accessor applies the correct conversion from Smi, HeapNumber
3227 // and undefined. 3234 // and undefined.
3228 MaybeObject* SetValue(uint32_t index, Object* value); 3235 MaybeObject* SetValue(uint32_t index, Object* value);
3229 3236
3230 // Casting. 3237 // Casting.
3231 static inline ExternalUnsignedByteArray* cast(Object* obj); 3238 static inline ExternalUnsignedByteArray* cast(Object* obj);
3232 3239
3233 #ifdef OBJECT_PRINT 3240 #ifdef OBJECT_PRINT
3234 inline void ExternalUnsignedByteArrayPrint() { 3241 inline void ExternalUnsignedByteArrayPrint() {
3235 ExternalUnsignedByteArrayPrint(stdout); 3242 ExternalUnsignedByteArrayPrint(stdout);
3236 } 3243 }
3237 void ExternalUnsignedByteArrayPrint(FILE* out); 3244 void ExternalUnsignedByteArrayPrint(FILE* out);
3238 #endif 3245 #endif
3239 #ifdef DEBUG 3246 #ifdef DEBUG
3240 void ExternalUnsignedByteArrayVerify(); 3247 void ExternalUnsignedByteArrayVerify();
3241 #endif // DEBUG 3248 #endif // DEBUG
3242 3249
3243 private: 3250 private:
3244 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray); 3251 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray);
3245 }; 3252 };
3246 3253
3247 3254
3248 class ExternalShortArray: public ExternalArray { 3255 class ExternalShortArray: public ExternalArray {
3249 public: 3256 public:
3250 // Setter and getter. 3257 // Setter and getter.
3251 inline int16_t get(int index); 3258 inline int16_t get_scalar(int index);
3259 inline MaybeObject* get(int index);
3252 inline void set(int index, int16_t value); 3260 inline void set(int index, int16_t value);
3253 3261
3254 // This accessor applies the correct conversion from Smi, HeapNumber 3262 // This accessor applies the correct conversion from Smi, HeapNumber
3255 // and undefined. 3263 // and undefined.
3256 MaybeObject* SetValue(uint32_t index, Object* value); 3264 MaybeObject* SetValue(uint32_t index, Object* value);
3257 3265
3258 // Casting. 3266 // Casting.
3259 static inline ExternalShortArray* cast(Object* obj); 3267 static inline ExternalShortArray* cast(Object* obj);
3260 3268
3261 #ifdef OBJECT_PRINT 3269 #ifdef OBJECT_PRINT
3262 inline void ExternalShortArrayPrint() { 3270 inline void ExternalShortArrayPrint() {
3263 ExternalShortArrayPrint(stdout); 3271 ExternalShortArrayPrint(stdout);
3264 } 3272 }
3265 void ExternalShortArrayPrint(FILE* out); 3273 void ExternalShortArrayPrint(FILE* out);
3266 #endif 3274 #endif
3267 #ifdef DEBUG 3275 #ifdef DEBUG
3268 void ExternalShortArrayVerify(); 3276 void ExternalShortArrayVerify();
3269 #endif // DEBUG 3277 #endif // DEBUG
3270 3278
3271 private: 3279 private:
3272 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray); 3280 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray);
3273 }; 3281 };
3274 3282
3275 3283
3276 class ExternalUnsignedShortArray: public ExternalArray { 3284 class ExternalUnsignedShortArray: public ExternalArray {
3277 public: 3285 public:
3278 // Setter and getter. 3286 // Setter and getter.
3279 inline uint16_t get(int index); 3287 inline uint16_t get_scalar(int index);
3288 inline MaybeObject* get(int index);
3280 inline void set(int index, uint16_t value); 3289 inline void set(int index, uint16_t value);
3281 3290
3282 // This accessor applies the correct conversion from Smi, HeapNumber 3291 // This accessor applies the correct conversion from Smi, HeapNumber
3283 // and undefined. 3292 // and undefined.
3284 MaybeObject* SetValue(uint32_t index, Object* value); 3293 MaybeObject* SetValue(uint32_t index, Object* value);
3285 3294
3286 // Casting. 3295 // Casting.
3287 static inline ExternalUnsignedShortArray* cast(Object* obj); 3296 static inline ExternalUnsignedShortArray* cast(Object* obj);
3288 3297
3289 #ifdef OBJECT_PRINT 3298 #ifdef OBJECT_PRINT
3290 inline void ExternalUnsignedShortArrayPrint() { 3299 inline void ExternalUnsignedShortArrayPrint() {
3291 ExternalUnsignedShortArrayPrint(stdout); 3300 ExternalUnsignedShortArrayPrint(stdout);
3292 } 3301 }
3293 void ExternalUnsignedShortArrayPrint(FILE* out); 3302 void ExternalUnsignedShortArrayPrint(FILE* out);
3294 #endif 3303 #endif
3295 #ifdef DEBUG 3304 #ifdef DEBUG
3296 void ExternalUnsignedShortArrayVerify(); 3305 void ExternalUnsignedShortArrayVerify();
3297 #endif // DEBUG 3306 #endif // DEBUG
3298 3307
3299 private: 3308 private:
3300 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray); 3309 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray);
3301 }; 3310 };
3302 3311
3303 3312
3304 class ExternalIntArray: public ExternalArray { 3313 class ExternalIntArray: public ExternalArray {
3305 public: 3314 public:
3306 // Setter and getter. 3315 // Setter and getter.
3307 inline int32_t get(int index); 3316 inline int32_t get_scalar(int index);
3317 inline MaybeObject* get(int index);
3308 inline void set(int index, int32_t value); 3318 inline void set(int index, int32_t value);
3309 3319
3310 // This accessor applies the correct conversion from Smi, HeapNumber 3320 // This accessor applies the correct conversion from Smi, HeapNumber
3311 // and undefined. 3321 // and undefined.
3312 MaybeObject* SetValue(uint32_t index, Object* value); 3322 MaybeObject* SetValue(uint32_t index, Object* value);
3313 3323
3314 // Casting. 3324 // Casting.
3315 static inline ExternalIntArray* cast(Object* obj); 3325 static inline ExternalIntArray* cast(Object* obj);
3316 3326
3317 #ifdef OBJECT_PRINT 3327 #ifdef OBJECT_PRINT
3318 inline void ExternalIntArrayPrint() { 3328 inline void ExternalIntArrayPrint() {
3319 ExternalIntArrayPrint(stdout); 3329 ExternalIntArrayPrint(stdout);
3320 } 3330 }
3321 void ExternalIntArrayPrint(FILE* out); 3331 void ExternalIntArrayPrint(FILE* out);
3322 #endif 3332 #endif
3323 #ifdef DEBUG 3333 #ifdef DEBUG
3324 void ExternalIntArrayVerify(); 3334 void ExternalIntArrayVerify();
3325 #endif // DEBUG 3335 #endif // DEBUG
3326 3336
3327 private: 3337 private:
3328 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray); 3338 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray);
3329 }; 3339 };
3330 3340
3331 3341
3332 class ExternalUnsignedIntArray: public ExternalArray { 3342 class ExternalUnsignedIntArray: public ExternalArray {
3333 public: 3343 public:
3334 // Setter and getter. 3344 // Setter and getter.
3335 inline uint32_t get(int index); 3345 inline uint32_t get_scalar(int index);
3346 inline MaybeObject* get(int index);
3336 inline void set(int index, uint32_t value); 3347 inline void set(int index, uint32_t value);
3337 3348
3338 // This accessor applies the correct conversion from Smi, HeapNumber 3349 // This accessor applies the correct conversion from Smi, HeapNumber
3339 // and undefined. 3350 // and undefined.
3340 MaybeObject* SetValue(uint32_t index, Object* value); 3351 MaybeObject* SetValue(uint32_t index, Object* value);
3341 3352
3342 // Casting. 3353 // Casting.
3343 static inline ExternalUnsignedIntArray* cast(Object* obj); 3354 static inline ExternalUnsignedIntArray* cast(Object* obj);
3344 3355
3345 #ifdef OBJECT_PRINT 3356 #ifdef OBJECT_PRINT
3346 inline void ExternalUnsignedIntArrayPrint() { 3357 inline void ExternalUnsignedIntArrayPrint() {
3347 ExternalUnsignedIntArrayPrint(stdout); 3358 ExternalUnsignedIntArrayPrint(stdout);
3348 } 3359 }
3349 void ExternalUnsignedIntArrayPrint(FILE* out); 3360 void ExternalUnsignedIntArrayPrint(FILE* out);
3350 #endif 3361 #endif
3351 #ifdef DEBUG 3362 #ifdef DEBUG
3352 void ExternalUnsignedIntArrayVerify(); 3363 void ExternalUnsignedIntArrayVerify();
3353 #endif // DEBUG 3364 #endif // DEBUG
3354 3365
3355 private: 3366 private:
3356 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray); 3367 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray);
3357 }; 3368 };
3358 3369
3359 3370
3360 class ExternalFloatArray: public ExternalArray { 3371 class ExternalFloatArray: public ExternalArray {
3361 public: 3372 public:
3362 // Setter and getter. 3373 // Setter and getter.
3363 inline float get(int index); 3374 inline float get_scalar(int index);
3375 inline MaybeObject* get(int index);
3364 inline void set(int index, float value); 3376 inline void set(int index, float value);
3365 3377
3366 // This accessor applies the correct conversion from Smi, HeapNumber 3378 // This accessor applies the correct conversion from Smi, HeapNumber
3367 // and undefined. 3379 // and undefined.
3368 MaybeObject* SetValue(uint32_t index, Object* value); 3380 MaybeObject* SetValue(uint32_t index, Object* value);
3369 3381
3370 // Casting. 3382 // Casting.
3371 static inline ExternalFloatArray* cast(Object* obj); 3383 static inline ExternalFloatArray* cast(Object* obj);
3372 3384
3373 #ifdef OBJECT_PRINT 3385 #ifdef OBJECT_PRINT
3374 inline void ExternalFloatArrayPrint() { 3386 inline void ExternalFloatArrayPrint() {
3375 ExternalFloatArrayPrint(stdout); 3387 ExternalFloatArrayPrint(stdout);
3376 } 3388 }
3377 void ExternalFloatArrayPrint(FILE* out); 3389 void ExternalFloatArrayPrint(FILE* out);
3378 #endif 3390 #endif
3379 #ifdef DEBUG 3391 #ifdef DEBUG
3380 void ExternalFloatArrayVerify(); 3392 void ExternalFloatArrayVerify();
3381 #endif // DEBUG 3393 #endif // DEBUG
3382 3394
3383 private: 3395 private:
3384 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray); 3396 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray);
3385 }; 3397 };
3386 3398
3387 3399
3388 class ExternalDoubleArray: public ExternalArray { 3400 class ExternalDoubleArray: public ExternalArray {
3389 public: 3401 public:
3390 // Setter and getter. 3402 // Setter and getter.
3391 inline double get(int index); 3403 inline double get_scalar(int index);
3404 inline MaybeObject* get(int index);
3392 inline void set(int index, double value); 3405 inline void set(int index, double value);
3393 3406
3394 // This accessor applies the correct conversion from Smi, HeapNumber 3407 // This accessor applies the correct conversion from Smi, HeapNumber
3395 // and undefined. 3408 // and undefined.
3396 MaybeObject* SetValue(uint32_t index, Object* value); 3409 MaybeObject* SetValue(uint32_t index, Object* value);
3397 3410
3398 // Casting. 3411 // Casting.
3399 static inline ExternalDoubleArray* cast(Object* obj); 3412 static inline ExternalDoubleArray* cast(Object* obj);
3400 3413
3401 #ifdef OBJECT_PRINT 3414 #ifdef OBJECT_PRINT
(...skipping 3854 matching lines...) Expand 10 before | Expand all | Expand 10 after
7256 } else { 7269 } else {
7257 value &= ~(1 << bit_position); 7270 value &= ~(1 << bit_position);
7258 } 7271 }
7259 return value; 7272 return value;
7260 } 7273 }
7261 }; 7274 };
7262 7275
7263 } } // namespace v8::internal 7276 } } // namespace v8::internal
7264 7277
7265 #endif // V8_OBJECTS_H_ 7278 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/elements.cc ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698