#include "ClassInfo.h"
#include "GetterSetter.h"
#include "JSObject.h"
-#include "Operations.h"
+#include "JSCInlines.h"
#include "PropertySlot.h"
#include "Reject.h"
#include "SlotVisitor.h"
namespace JSC {
-const ClassInfo SparseArrayValueMap::s_info = { "SparseArrayValueMap", 0, 0, 0, CREATE_METHOD_TABLE(SparseArrayValueMap) };
+const ClassInfo SparseArrayValueMap::s_info = { "SparseArrayValueMap", 0, 0, CREATE_METHOD_TABLE(SparseArrayValueMap) };
SparseArrayValueMap::SparseArrayValueMap(VM& vm)
: Base(vm, vm.sparseArrayValueMapStructure.get())
Structure* SparseArrayValueMap::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
- return Structure::create(vm, globalObject, prototype, TypeInfo(CompoundType, StructureFlags), &s_info);
+ return Structure::create(vm, globalObject, prototype, TypeInfo(CellType, StructureFlags), info());
}
SparseArrayValueMap::AddResult SparseArrayValueMap::add(JSObject* array, unsigned i)
AddResult result = m_map.add(i, entry);
size_t capacity = m_map.capacity();
if (capacity != m_reportedCapacity) {
- Heap::heap(array)->reportExtraMemoryCost((capacity - m_reportedCapacity) * (sizeof(unsigned) + sizeof(WriteBarrier<Unknown>)));
+ // FIXME: Adopt reportExtraMemoryVisited, and switch to reportExtraMemoryAllocated.
+ // https://bugs.webkit.org/show_bug.cgi?id=142595
+ Heap::heap(array)->deprecatedReportExtraMemory((capacity - m_reportedCapacity) * (sizeof(unsigned) + sizeof(WriteBarrier<Unknown>)));
m_reportedCapacity = capacity;
}
return result;
return true;
}
-void SparseArrayEntry::get(PropertySlot& slot) const
+void SparseArrayEntry::get(JSObject* thisObject, PropertySlot& slot) const
{
JSValue value = Base::get();
ASSERT(value);
if (LIKELY(!value.isGetterSetter())) {
- slot.setValue(value);
+ slot.setValue(thisObject, attributes, value);
return;
}
- JSObject* getter = asGetterSetter(value)->getter();
- if (!getter) {
- slot.setUndefined();
- return;
- }
-
- slot.setGetterSlot(getter);
+ slot.setGetterSlot(thisObject, attributes, jsCast<GetterSetter*>(value));
}
void SparseArrayEntry::get(PropertyDescriptor& descriptor) const
JSValue SparseArrayEntry::get(ExecState* exec, JSObject* array) const
{
- JSValue result = Base::get();
- ASSERT(result);
-
- if (LIKELY(!result.isGetterSetter()))
- return result;
+ JSValue value = Base::get();
+ ASSERT(value);
- JSObject* getter = asGetterSetter(result)->getter();
- if (!getter)
- return jsUndefined();
+ if (LIKELY(!value.isGetterSetter()))
+ return value;
- CallData callData;
- CallType callType = getter->methodTable()->getCallData(getter, callData);
- return call(exec, getter, callType, callData, array->methodTable()->toThisObject(array, exec), exec->emptyList());
+ return callGetter(exec, array, jsCast<GetterSetter*>(value));
}
void SparseArrayEntry::put(ExecState* exec, JSValue thisValue, SparseArrayValueMap* map, JSValue value, bool shouldThrow)
return;
}
- JSValue accessor = Base::get();
- ASSERT(accessor.isGetterSetter());
- JSObject* setter = asGetterSetter(accessor)->setter();
-
- if (!setter) {
- if (shouldThrow)
- throwTypeError(exec, StrictModeReadonlyPropertyWriteError);
- return;
- }
-
- CallData callData;
- CallType callType = setter->methodTable()->getCallData(setter, callData);
- MarkedArgumentBuffer args;
- args.append(value);
- if (thisValue.isObject())
- thisValue = asObject(thisValue)->methodTable()->toThisObject(asObject(thisValue), exec);
- call(exec, setter, callType, callData, thisValue, args);
+ callSetter(exec, thisValue, Base::get(), value, shouldThrow ? StrictMode : NotStrictMode);
}
JSValue SparseArrayEntry::getNonSparseMode() const