summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-02-18 15:07:39 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-02-25 09:33:36 +0000
commit877fe7d55036492a897d0928fe43d5df2bc6e2e5 (patch)
treeec89e1daf1d9e8eb8c299db82bdc54e852bda3c6
parent7d0214d14e1e4770db61f51ee0511c0fafa2bf61 (diff)
Initialize label vector lazily
When parsing JSON temporary JIT objects are created when resolving each id. Each of these get a list of labels initialized to the size of the codeblock being operated on, which can be very long in some cases. This patch delays the initialization of the label vector, until it is actually used which is easy to figure out since the vector is not exported outside the class. Task-number: QTBUG-44475 Change-Id: I4fdbb7de7e7d953fffed39e38feed066edb6742b Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com>
-rw-r--r--Source/JavaScriptCore/jit/JIT.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Source/JavaScriptCore/jit/JIT.cpp b/Source/JavaScriptCore/jit/JIT.cpp
index 8e003c782..9b46d8792 100644
--- a/Source/JavaScriptCore/jit/JIT.cpp
+++ b/Source/JavaScriptCore/jit/JIT.cpp
@@ -74,7 +74,7 @@ JIT::JIT(VM* vm, CodeBlock* codeBlock)
: m_interpreter(vm->interpreter)
, m_vm(vm)
, m_codeBlock(codeBlock)
- , m_labels(codeBlock ? codeBlock->numberOfInstructions() : 0)
+ , m_labels(0)
, m_bytecodeOffset((unsigned)-1)
, m_propertyAccessInstructionIndex(UINT_MAX)
, m_byValInstructionIndex(UINT_MAX)
@@ -96,6 +96,7 @@ JIT::JIT(VM* vm, CodeBlock* codeBlock)
, m_shouldEmitProfiling(false)
#endif
{
+ m_labels.reserveCapacity(codeBlock ? codeBlock->numberOfInstructions() : 0);
}
#if ENABLE(DFG_JIT)
@@ -174,6 +175,7 @@ void JIT::privateCompileMainPass()
m_globalResolveInfoIndex = 0;
m_callLinkInfoIndex = 0;
+ m_labels.resize(instructionCount);
for (m_bytecodeOffset = 0; m_bytecodeOffset < instructionCount; ) {
if (m_disassembler)
@@ -694,6 +696,7 @@ JITCode JIT::privateCompile(CodePtr* functionEntryArityCheck, JITCompilationEffo
if (patchBuffer.didFailToAllocate())
return JITCode();
+ ASSERT(m_labels.size() >= m_codeBlock->instructionCount());
// Translate vPC offsets into addresses in JIT generated code, for switch tables.
for (unsigned i = 0; i < m_switches.size(); ++i) {
SwitchRecord record = m_switches[i];