Title: [185382] trunk/Source/_javascript_Core
- Revision
- 185382
- Author
- [email protected]
- Date
- 2015-06-09 14:25:40 -0700 (Tue, 09 Jun 2015)
Log Message
[JSC] CodeBlock::m_constantRegisters should be sized-to-fit.
<https://webkit.org/b/145784>
Reviewed by Darin Adler.
Spotted this Vector looking chubby on cnet.com, with 1.23 MB of memory
allocated below CodeBlock::setConstantRegisters().
Use resizeToFit() instead since we know the final size up front.
Also removed some unused functions that operated on this constants vector
and the corresponding one in UnlinkedCodeBlock.
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::addOrFindConstant): Deleted.
(JSC::CodeBlock::findConstant): Deleted.
* bytecode/CodeBlock.h:
(JSC::CodeBlock::setConstantRegisters):
(JSC::CodeBlock::numberOfConstantRegisters): Deleted.
* bytecode/UnlinkedCodeBlock.cpp:
(JSC::UnlinkedCodeBlock::addOrFindConstant): Deleted.
* bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedCodeBlock::numberOfConstantRegisters): Deleted.
(JSC::UnlinkedCodeBlock::getConstant): Deleted.
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (185381 => 185382)
--- trunk/Source/_javascript_Core/ChangeLog 2015-06-09 21:23:03 UTC (rev 185381)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-06-09 21:25:40 UTC (rev 185382)
@@ -1,5 +1,31 @@
2015-06-09 Andreas Kling <[email protected]>
+ [JSC] CodeBlock::m_constantRegisters should be sized-to-fit.
+ <https://webkit.org/b/145784>
+
+ Reviewed by Darin Adler.
+
+ Spotted this Vector looking chubby on cnet.com, with 1.23 MB of memory
+ allocated below CodeBlock::setConstantRegisters().
+
+ Use resizeToFit() instead since we know the final size up front.
+ Also removed some unused functions that operated on this constants vector
+ and the corresponding one in UnlinkedCodeBlock.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::addOrFindConstant): Deleted.
+ (JSC::CodeBlock::findConstant): Deleted.
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::setConstantRegisters):
+ (JSC::CodeBlock::numberOfConstantRegisters): Deleted.
+ * bytecode/UnlinkedCodeBlock.cpp:
+ (JSC::UnlinkedCodeBlock::addOrFindConstant): Deleted.
+ * bytecode/UnlinkedCodeBlock.h:
+ (JSC::UnlinkedCodeBlock::numberOfConstantRegisters): Deleted.
+ (JSC::UnlinkedCodeBlock::getConstant): Deleted.
+
+2015-06-09 Andreas Kling <[email protected]>
+
[JSC] Polymorphic{Get,Put}ByIdList::addAccess() should optimize for size, not speed.
<https://webkit.org/b/145786>
Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (185381 => 185382)
--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2015-06-09 21:23:03 UTC (rev 185381)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2015-06-09 21:25:40 UTC (rev 185382)
@@ -2964,27 +2964,6 @@
} // else don't shrink these, because we would have already pointed pointers into these tables.
}
-unsigned CodeBlock::addOrFindConstant(JSValue v)
-{
- unsigned result;
- if (findConstant(v, result))
- return result;
- return addConstant(v);
-}
-
-bool CodeBlock::findConstant(JSValue v, unsigned& index)
-{
- unsigned numberOfConstants = numberOfConstantRegisters();
- for (unsigned i = 0; i < numberOfConstants; ++i) {
- if (getConstant(FirstConstantRegisterIndex + i) == v) {
- index = i;
- return true;
- }
- }
- index = numberOfConstants;
- return false;
-}
-
#if ENABLE(JIT)
void CodeBlock::unlinkCalls()
{
Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.h (185381 => 185382)
--- trunk/Source/_javascript_Core/bytecode/CodeBlock.h 2015-06-09 21:23:03 UTC (rev 185381)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.h 2015-06-09 21:25:40 UTC (rev 185382)
@@ -572,7 +572,6 @@
Vector<WriteBarrier<Unknown>>& constants() { return m_constantRegisters; }
Vector<SourceCodeRepresentation>& constantsSourceCodeRepresentation() { return m_constantsSourceCodeRepresentation; }
- size_t numberOfConstantRegisters() const { return m_constantRegisters.size(); }
unsigned addConstant(JSValue v)
{
unsigned result = m_constantRegisters.size();
@@ -590,8 +589,6 @@
return result;
}
- bool findConstant(JSValue, unsigned& result);
- unsigned addOrFindConstant(JSValue);
WriteBarrier<Unknown>& constantRegister(int index) { return m_constantRegisters[index - FirstConstantRegisterIndex]; }
ALWAYS_INLINE bool isConstantRegisterIndex(int index) const { return index >= FirstConstantRegisterIndex; }
ALWAYS_INLINE JSValue getConstant(int index) const { return m_constantRegisters[index - FirstConstantRegisterIndex].get(); }
@@ -934,7 +931,7 @@
{
ASSERT(constants.size() == constantsSourceCodeRepresentation.size());
size_t count = constants.size();
- m_constantRegisters.resize(count);
+ m_constantRegisters.resizeToFit(count);
for (size_t i = 0; i < count; i++)
m_constantRegisters[i].set(*m_vm, ownerExecutable(), constants[i].get());
m_constantsSourceCodeRepresentation = constantsSourceCodeRepresentation;
Modified: trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.cpp (185381 => 185382)
--- trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.cpp 2015-06-09 21:23:03 UTC (rev 185381)
+++ trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.cpp 2015-06-09 21:25:40 UTC (rev 185382)
@@ -80,16 +80,6 @@
return result;
}
-unsigned UnlinkedCodeBlock::addOrFindConstant(JSValue v)
-{
- unsigned numberOfConstants = numberOfConstantRegisters();
- for (unsigned i = 0; i < numberOfConstants; ++i) {
- if (getConstant(FirstConstantRegisterIndex + i) == v)
- return i;
- }
- return addConstant(v);
-}
-
UnlinkedFunctionExecutable::UnlinkedFunctionExecutable(VM* vm, Structure* structure, const SourceCode& source, RefPtr<SourceProvider>&& sourceOverride, FunctionBodyNode* node, UnlinkedFunctionKind kind)
: Base(*vm, structure)
, m_name(node->ident())
Modified: trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.h (185381 => 185382)
--- trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.h 2015-06-09 21:23:03 UTC (rev 185381)
+++ trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.h 2015-06-09 21:25:40 UTC (rev 185382)
@@ -316,7 +316,6 @@
const Identifier& identifier(int index) const { return m_identifiers[index]; }
const Vector<Identifier>& identifiers() const { return m_identifiers; }
- size_t numberOfConstantRegisters() const { return m_constantRegisters.size(); }
unsigned addConstant(JSValue v, SourceCodeRepresentation sourceCodeRepresentation = SourceCodeRepresentation::Other)
{
unsigned result = m_constantRegisters.size();
@@ -342,11 +341,9 @@
ASSERT(index < LinkTimeConstantCount);
return m_linkTimeConstants[index];
}
- unsigned addOrFindConstant(JSValue);
const Vector<WriteBarrier<Unknown>>& constantRegisters() { return m_constantRegisters; }
const WriteBarrier<Unknown>& constantRegister(int index) const { return m_constantRegisters[index - FirstConstantRegisterIndex]; }
ALWAYS_INLINE bool isConstantRegisterIndex(int index) const { return index >= FirstConstantRegisterIndex; }
- ALWAYS_INLINE JSValue getConstant(int index) const { return m_constantRegisters[index - FirstConstantRegisterIndex].get(); }
const Vector<SourceCodeRepresentation>& constantsSourceCodeRepresentation() { return m_constantsSourceCodeRepresentation; }
// Jumps
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes