summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
commit32761a6cee1d0dee366b885b7b9c777e67885688 (patch)
treed6bec92bebfb216f4126356e55518842c2f476a1 /Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp
parenta4e969f4965059196ca948db781e52f7cfebf19e (diff)
downloadWebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp')
-rw-r--r--Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp b/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp
index 24d5244af..0db43b7b6 100644
--- a/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp
+++ b/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011, 2012, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
#include "ClassInfo.h"
#include "GetterSetter.h"
#include "JSObject.h"
-#include "JSCInlines.h"
+#include "Operations.h"
#include "PropertySlot.h"
#include "Reject.h"
#include "SlotVisitor.h"
@@ -37,7 +37,7 @@
namespace JSC {
-const ClassInfo SparseArrayValueMap::s_info = { "SparseArrayValueMap", 0, 0, CREATE_METHOD_TABLE(SparseArrayValueMap) };
+const ClassInfo SparseArrayValueMap::s_info = { "SparseArrayValueMap", 0, 0, 0, CREATE_METHOD_TABLE(SparseArrayValueMap) };
SparseArrayValueMap::SparseArrayValueMap(VM& vm)
: Base(vm, vm.sparseArrayValueMapStructure.get())
@@ -69,7 +69,7 @@ void SparseArrayValueMap::destroy(JSCell* cell)
Structure* SparseArrayValueMap::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
- return Structure::create(vm, globalObject, prototype, TypeInfo(CellType, StructureFlags), info());
+ return Structure::create(vm, globalObject, prototype, TypeInfo(CompoundType, StructureFlags), info());
}
SparseArrayValueMap::AddResult SparseArrayValueMap::add(JSObject* array, unsigned i)
@@ -80,9 +80,7 @@ SparseArrayValueMap::AddResult SparseArrayValueMap::add(JSObject* array, unsigne
AddResult result = m_map.add(i, entry);
size_t capacity = m_map.capacity();
if (capacity != m_reportedCapacity) {
- // 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>)));
+ Heap::heap(array)->reportExtraMemoryCost((capacity - m_reportedCapacity) * (sizeof(unsigned) + sizeof(WriteBarrier<Unknown>)));
m_reportedCapacity = capacity;
}
return result;
@@ -90,8 +88,6 @@ SparseArrayValueMap::AddResult SparseArrayValueMap::add(JSObject* array, unsigne
void SparseArrayValueMap::putEntry(ExecState* exec, JSObject* array, unsigned i, JSValue value, bool shouldThrow)
{
- ASSERT(value);
-
AddResult result = add(array, i);
SparseArrayEntry& entry = result.iterator->value;
@@ -110,8 +106,6 @@ void SparseArrayValueMap::putEntry(ExecState* exec, JSObject* array, unsigned i,
bool SparseArrayValueMap::putDirect(ExecState* exec, JSObject* array, unsigned i, JSValue value, unsigned attributes, PutDirectIndexMode mode)
{
- ASSERT(value);
-
AddResult result = add(array, i);
SparseArrayEntry& entry = result.iterator->value;
@@ -146,6 +140,17 @@ void SparseArrayEntry::get(PropertyDescriptor& descriptor) const
descriptor.setDescriptor(Base::get(), attributes);
}
+JSValue SparseArrayEntry::get(ExecState* exec, JSObject* array) const
+{
+ JSValue value = Base::get();
+ ASSERT(value);
+
+ if (LIKELY(!value.isGetterSetter()))
+ return value;
+
+ return callGetter(exec, array, jsCast<GetterSetter*>(value));
+}
+
void SparseArrayEntry::put(ExecState* exec, JSValue thisValue, SparseArrayValueMap* map, JSValue value, bool shouldThrow)
{
if (!(attributes & Accessor)) {