]>
git.saurik.com Git - apple/javascriptcore.git/blob - kjs/array_instance.h
1 // -*- c-basic-offset: 2 -*-
3 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
4 * Copyright (C) 2003, 2007 Apple Inc. All rights reserved.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef ARRAY_INSTANCE_H
23 #define ARRAY_INSTANCE_H
31 class ArrayInstance
: public JSObject
{
33 ArrayInstance(JSObject
* prototype
, unsigned initialLength
);
34 ArrayInstance(JSObject
* prototype
, const List
& initialValues
);
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
);
43 virtual void getPropertyNames(ExecState
*, PropertyNameArray
&);
47 virtual const ClassInfo
* classInfo() const { return &info
; }
48 static const ClassInfo info
;
50 unsigned getLength() const { return m_length
; }
51 JSValue
* getItem(unsigned) const;
53 void sort(ExecState
*);
54 void sort(ExecState
*, JSObject
* compareFunction
);
57 static JSValue
* lengthGetter(ExecState
*, JSObject
*, const Identifier
&, const PropertySlot
&);
58 bool inlineGetOwnPropertySlot(ExecState
*, unsigned propertyName
, PropertySlot
&);
60 void setLength(unsigned);
61 void increaseVectorLength(unsigned newLength
);
63 unsigned compactForSorting();
66 unsigned m_vectorLength
;
67 ArrayStorage
* m_storage
;