2 * Copyright (C) 2008, 2012 Apple Inc. All rights reserved.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 #include "Executable.h"
24 #include "JSFunction.h"
25 #include "JSCInlines.h"
29 void HashTable::createTable(VM
&) const
32 keys
= static_cast<const char**>(fastMalloc(sizeof(char*) * numberOfValues
));
34 for (int i
= 0; i
< numberOfValues
; ++i
) {
36 keys
[i
] = values
[i
].m_key
;
42 void HashTable::deleteTable() const
50 bool setUpStaticFunctionSlot(ExecState
* exec
, const HashTableValue
* entry
, JSObject
* thisObj
, PropertyName propertyName
, PropertySlot
& slot
)
52 ASSERT(thisObj
->globalObject());
53 ASSERT(entry
->attributes() & BuiltinOrFunction
);
56 PropertyOffset offset
= thisObj
->getDirectOffset(vm
, propertyName
, attributes
);
58 if (!isValidOffset(offset
)) {
59 // If a property is ever deleted from an object with a static table, then we reify
60 // all static functions at that time - after this we shouldn't be re-adding anything.
61 if (thisObj
->staticFunctionsReified())
64 if (entry
->attributes() & Builtin
)
65 thisObj
->putDirectBuiltinFunction(vm
, thisObj
->globalObject(), propertyName
, entry
->builtinGenerator()(vm
), entry
->attributes());
67 thisObj
->putDirectNativeFunction(
68 vm
, thisObj
->globalObject(), propertyName
, entry
->functionLength(),
69 entry
->function(), entry
->intrinsic(), entry
->attributes());
71 offset
= thisObj
->getDirectOffset(vm
, propertyName
, attributes
);
72 ASSERT(isValidOffset(offset
));
75 slot
.setValue(thisObj
, attributes
, thisObj
->getDirect(offset
), offset
);