Changeset 63268 in webkit for trunk/JavaScriptCore/runtime/JSArray.h
- Timestamp:
- Jul 13, 2010, 5:29:32 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/JSArray.h
r55262 r63268 23 23 24 24 #include "JSObject.h" 25 26 #define CHECK_ARRAY_CONSISTENCY 0 25 27 26 28 namespace JSC { … … 34 36 void* subclassData; // A JSArray subclass can use this to fill the vector lazily. 35 37 size_t reportedMapCapacity; 38 #if CHECK_ARRAY_CONSISTENCY 39 bool m_inCompactInitialization; 40 #endif 36 41 JSValue m_vector[1]; 37 42 }; 43 44 // The CreateCompact creation mode is used for fast construction of arrays 45 // whose size and contents are known at time of creation. 46 // 47 // There are two obligations when using this mode: 48 // 49 // - uncheckedSetIndex() must be used when initializing the array. 50 // - setLength() must be called after initialization. 51 52 enum ArrayCreationMode { CreateCompact, CreateInitialized }; 38 53 39 54 class JSArray : public JSObject { … … 43 58 public: 44 59 explicit JSArray(NonNullPassRefPtr<Structure>); 45 JSArray(NonNullPassRefPtr<Structure>, unsigned initialLength );60 JSArray(NonNullPassRefPtr<Structure>, unsigned initialLength, ArrayCreationMode); 46 61 JSArray(NonNullPassRefPtr<Structure>, const ArgList& initialValues); 47 62 virtual ~JSArray(); … … 82 97 } 83 98 x = v; 99 } 100 101 void uncheckedSetIndex(unsigned i, JSValue v) 102 { 103 ASSERT(canSetIndex(i)); 104 #if CHECK_ARRAY_CONSISTENCY 105 ASSERT(m_storage->m_inCompactInitialization); 106 #endif 107 m_storage->m_vector[i] = v; 84 108 } 85 109
Note:
See TracChangeset
for help on using the changeset viewer.