Diff
Modified: releases/WebKitGTK/webkit-2.18/Source/_javascript_Core/ChangeLog (220652 => 220653)
--- releases/WebKitGTK/webkit-2.18/Source/_javascript_Core/ChangeLog 2017-08-14 07:34:23 UTC (rev 220652)
+++ releases/WebKitGTK/webkit-2.18/Source/_javascript_Core/ChangeLog 2017-08-14 07:40:18 UTC (rev 220653)
@@ -1,3 +1,21 @@
+2017-08-09 Caio Lima <ticaiol...@gmail.com>
+
+ [JSC] Create JSSet constructor that accepts it's size as parameter
+ https://bugs.webkit.org/show_bug.cgi?id=173297
+
+ Reviewed by Saam Barati.
+
+ This patch is adding a new constructor to JSSet that gives its
+ expected initial size. It is important to avoid re-hashing and mutiple
+ allocations when we know the final size of JSSet, such as in
+ CodeBlock::setConstantIdentifierSetRegisters.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::setConstantIdentifierSetRegisters):
+ * runtime/HashMapImpl.h:
+ (JSC::HashMapImpl::HashMapImpl):
+ * runtime/JSSet.h:
+
2017-08-09 Caitlin Potter <ca...@igalia.com>
Early error on ANY operator before new.target
Modified: releases/WebKitGTK/webkit-2.18/Source/_javascript_Core/bytecode/CodeBlock.cpp (220652 => 220653)
--- releases/WebKitGTK/webkit-2.18/Source/_javascript_Core/bytecode/CodeBlock.cpp 2017-08-14 07:34:23 UTC (rev 220652)
+++ releases/WebKitGTK/webkit-2.18/Source/_javascript_Core/bytecode/CodeBlock.cpp 2017-08-14 07:40:18 UTC (rev 220653)
@@ -877,12 +877,13 @@
ExecState* exec = globalObject->globalExec();
for (const auto& entry : constants) {
+ const IdentifierSet& set = entry.first;
+
Structure* setStructure = globalObject->setStructure();
RETURN_IF_EXCEPTION(scope, void());
- JSSet* jsSet = JSSet::create(exec, vm, setStructure);
+ JSSet* jsSet = JSSet::create(exec, vm, setStructure, set.size());
RETURN_IF_EXCEPTION(scope, void());
- const IdentifierSet& set = entry.first;
for (auto setEntry : set) {
JSString* jsString = jsOwnedString(&vm, setEntry.get());
jsSet->add(exec, jsString);
Modified: releases/WebKitGTK/webkit-2.18/Source/_javascript_Core/runtime/HashMapImpl.h (220652 => 220653)
--- releases/WebKitGTK/webkit-2.18/Source/_javascript_Core/runtime/HashMapImpl.h 2017-08-14 07:34:23 UTC (rev 220652)
+++ releases/WebKitGTK/webkit-2.18/Source/_javascript_Core/runtime/HashMapImpl.h 2017-08-14 07:40:18 UTC (rev 220653)
@@ -300,6 +300,16 @@
{
}
+ HashMapImpl(VM& vm, Structure* structure, uint32_t sizeHint)
+ : Base(vm, structure)
+ , m_keyCount(0)
+ , m_deleteCount(0)
+ {
+ uint32_t capacity = ((Checked<uint32_t>(sizeHint) * 2) + 1).unsafeGet();
+ capacity = std::max<uint32_t>(WTF::roundUpToPowerOfTwo(capacity), 4U);
+ m_capacity = capacity;
+ }
+
ALWAYS_INLINE HashMapBucketType** buffer() const
{
return m_buffer->buffer();
Modified: releases/WebKitGTK/webkit-2.18/Source/_javascript_Core/runtime/JSSet.h (220652 => 220653)
--- releases/WebKitGTK/webkit-2.18/Source/_javascript_Core/runtime/JSSet.h 2017-08-14 07:34:23 UTC (rev 220652)
+++ releases/WebKitGTK/webkit-2.18/Source/_javascript_Core/runtime/JSSet.h 2017-08-14 07:40:18 UTC (rev 220653)
@@ -47,7 +47,12 @@
static JSSet* create(ExecState* exec, VM& vm, Structure* structure)
{
- JSSet* instance = new (NotNull, allocateCell<JSSet>(vm.heap)) JSSet(vm, structure);
+ return create(exec, vm, structure, 0);
+ }
+
+ static JSSet* create(ExecState* exec, VM& vm, Structure* structure, uint32_t size)
+ {
+ JSSet* instance = new (NotNull, allocateCell<JSSet>(vm.heap)) JSSet(vm, structure, size);
instance->finishCreation(exec, vm);
return instance;
}
@@ -62,6 +67,11 @@
{
}
+ JSSet(VM& vm, Structure* structure, uint32_t sizeHint)
+ : Base(vm, structure, sizeHint)
+ {
+ }
+
static String toStringName(const JSObject*, ExecState*);
};