Changeset 26881 in webkit for trunk/JavaScriptCore/kjs/array_instance.h
- Timestamp:
- Oct 22, 2007, 6:35:17 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/array_instance.h
r26850 r26881 1 1 // -*- c-basic-offset: 2 -*- 2 2 /* 3 * This file is part of the KDE libraries4 3 * Copyright (C) 1999-2000 Harri Porten ([email protected]) 5 4 * Copyright (C) 2003, 2007 Apple Inc. All rights reserved. … … 28 27 namespace KJS { 29 28 29 struct ArrayStorage; 30 30 31 class ArrayInstance : public JSObject { 31 32 public: 32 ArrayInstance(JSObject *proto, unsigned initialLength);33 ArrayInstance(JSObject *proto, const List &initialValues);33 ArrayInstance(JSObject* prototype, unsigned initialLength); 34 ArrayInstance(JSObject* prototype, const List& initialValues); 34 35 ~ArrayInstance(); 35 36 36 virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);37 virtual bool getOwnPropertySlot(ExecState *, unsigned, PropertySlot&);38 virtual void put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr= None);39 virtual void put(ExecState *exec, unsigned propertyName, JSValue *value, int attr= None);40 virtual bool deleteProperty(ExecState * exec, const Identifier &propertyName);41 virtual bool deleteProperty(ExecState * exec, unsigned propertyName);37 virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); 38 virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&); 39 virtual void put(ExecState*, const Identifier& propertyName, JSValue*, int attributes = None); 40 virtual void put(ExecState*, unsigned propertyName, JSValue*, int attributes = None); 41 virtual bool deleteProperty(ExecState *, const Identifier& propertyName); 42 virtual bool deleteProperty(ExecState *, unsigned propertyName); 42 43 virtual void getPropertyNames(ExecState*, PropertyNameArray&); 43 44 44 45 virtual void mark(); 45 46 46 virtual const ClassInfo *classInfo() const { return &info; }47 virtual const ClassInfo* classInfo() const { return &info; } 47 48 static const ClassInfo info; 49 50 unsigned getLength() const { return m_length; } 51 JSValue* getItem(unsigned) const; 52 53 void sort(ExecState*); 54 void sort(ExecState*, JSObject* compareFunction); 55 56 private: 57 static JSValue* lengthGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&); 58 bool inlineGetOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&); 59 60 void setLength(unsigned); 61 void increaseVectorLength(unsigned newLength); 48 62 49 unsigned getLength() const { return length; } 50 JSValue* getItem(unsigned) const; 51 52 void sort(ExecState *exec); 53 void sort(ExecState *exec, JSObject *compareFunction); 54 55 private: 56 static JSValue *lengthGetter(ExecState *, JSObject *, const Identifier&, const PropertySlot&); 63 unsigned compactForSorting(); 57 64 58 void setLength(unsigned newLength); 59 60 unsigned compactForSorting(); 61 62 void resizeStorage(unsigned); 63 64 // store capacity in extra space at the beginning of the storage array to save space 65 size_t capacity() { return storage ? reinterpret_cast<size_t>(storage[-1]) : 0; } 66 67 unsigned length; 68 unsigned storageLength; 69 JSValue **storage; 65 unsigned m_length; 66 unsigned m_vectorLength; 67 ArrayStorage* m_storage; 70 68 }; 71 69
Note:
See TracChangeset
for help on using the changeset viewer.