From 877fe7d55036492a897d0928fe43d5df2bc6e2e5 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 18 Feb 2015 15:07:39 +0100 Subject: Initialize label vector lazily MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- Source/JavaScriptCore/jit/JIT.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Source/JavaScriptCore') 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]; -- cgit v1.2.1 From 650c6ee8e76bb574d3a1bea09e2494992d8f070e Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 6 Mar 2015 11:20:13 +0100 Subject: Fix g++ 5.0 build A non-inline template needs to be explicitly instantiated if used outside the object where it is declared. Patch suggested by Khem Raj. Task-number: QTBUG-44829 Change-Id: Ib0adbd9273bd1cef01e5863bc8aaa9c373022792 Reviewed-by: Andras Becsi --- Source/JavaScriptCore/runtime/JSObject.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Source/JavaScriptCore') diff --git a/Source/JavaScriptCore/runtime/JSObject.cpp b/Source/JavaScriptCore/runtime/JSObject.cpp index 5637e2090..bd5591986 100644 --- a/Source/JavaScriptCore/runtime/JSObject.cpp +++ b/Source/JavaScriptCore/runtime/JSObject.cpp @@ -1909,6 +1909,11 @@ void JSObject::putByIndexBeyondVectorLengthWithoutAttributes(ExecState* exec, un } } +// Used in JSArray.cpp so we must instantiate explicit +template void JSObject::putByIndexBeyondVectorLengthWithoutAttributes(ExecState* exec, unsigned i, JSValue value); +template void JSObject::putByIndexBeyondVectorLengthWithoutAttributes(ExecState* exec, unsigned i, JSValue value); +template void JSObject::putByIndexBeyondVectorLengthWithoutAttributes(ExecState* exec, unsigned i, JSValue value); + void JSObject::putByIndexBeyondVectorLengthWithArrayStorage(ExecState* exec, unsigned i, JSValue value, bool shouldThrow, ArrayStorage* storage) { VM& vm = exec->vm(); -- cgit v1.2.1