diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-23 10:25:11 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-23 10:25:11 +0200 |
commit | 5ea819f80c6840c492386bfafbffb059c7e2091f (patch) | |
tree | 42ad0b1d82eff090d14278a088ea0f4840a0f938 /Source/JavaScriptCore/jit/JITStubs.cpp | |
parent | 43a42f108af6bcbd91f2672731c3047c26213af1 (diff) | |
download | qtwebkit-5ea819f80c6840c492386bfafbffb059c7e2091f.tar.gz |
Imported WebKit commit 20434eb8eb95065803473139d8794e98a7672f75 (http://svn.webkit.org/repository/webkit/trunk@132191)
New snapshot that should fix build with latest qtbase and the QPlastiqueStyle removal
Diffstat (limited to 'Source/JavaScriptCore/jit/JITStubs.cpp')
-rw-r--r-- | Source/JavaScriptCore/jit/JITStubs.cpp | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/Source/JavaScriptCore/jit/JITStubs.cpp b/Source/JavaScriptCore/jit/JITStubs.cpp index a16b328ad..ba8c76cfb 100644 --- a/Source/JavaScriptCore/jit/JITStubs.cpp +++ b/Source/JavaScriptCore/jit/JITStubs.cpp @@ -2142,6 +2142,23 @@ DEFINE_STUB_FUNCTION(JSObject*, op_new_func) inline void* jitCompileFor(CallFrame* callFrame, CodeSpecializationKind kind) { + // This function is called by cti_op_call_jitCompile() and + // cti_op_construct_jitCompile() JIT glue trampolines to compile the + // callee function that we want to call. Both cti glue trampolines are + // called by JIT'ed code which has pushed a frame and initialized most of + // the frame content except for the codeBlock. + // + // Normally, the prologue of the callee is supposed to set the frame's cb + // pointer to the cb of the callee. But in this case, the callee code does + // not exist yet until it is compiled below. The compilation process will + // allocate memory which may trigger a GC. The GC, in turn, will scan the + // JSStack, and will expect the frame's cb to either be valid or 0. If + // we don't initialize it, the GC will be accessing invalid memory and may + // crash. + // + // Hence, we should nullify it here before proceeding with the compilation. + callFrame->setCodeBlock(0); + JSFunction* function = jsCast<JSFunction*>(callFrame->callee()); ASSERT(!function->isHostFunction()); FunctionExecutable* executable = function->jsExecutable(); @@ -2222,6 +2239,23 @@ inline void* lazyLinkFor(CallFrame* callFrame, CodeSpecializationKind kind) CodeBlock* codeBlock = 0; CallLinkInfo* callLinkInfo = &callFrame->callerFrame()->codeBlock()->getCallLinkInfo(callFrame->returnPC()); + // This function is called by cti_vm_lazyLinkCall() and + // cti_lazyLinkConstruct JIT glue trampolines to link the callee function + // that we want to call. Both cti glue trampolines are called by JIT'ed + // code which has pushed a frame and initialized most of the frame content + // except for the codeBlock. + // + // Normally, the prologue of the callee is supposed to set the frame's cb + // field to the cb of the callee. But in this case, the callee may not + // exist yet, and if not, it will be generated in the compilation below. + // The compilation will allocate memory which may trigger a GC. The GC, in + // turn, will scan the JSStack, and will expect the frame's cb to be valid + // or 0. If we don't initialize it, the GC will be accessing invalid + // memory and may crash. + // + // Hence, we should nullify it here before proceeding with the compilation. + callFrame->setCodeBlock(0); + if (executable->isHostFunction()) codePtr = executable->generatedJITCodeFor(kind).addressForCall(); else { @@ -2298,7 +2332,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_call_NotJSFunction) EncodedJSValue returnValue; { - SamplingTool::HostCallRecord callRecord(CTI_SAMPLER); + SamplingTool::CallRecord callRecord(CTI_SAMPLER, true); returnValue = callData.native.function(callFrame); } @@ -2424,7 +2458,7 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_construct_NotJSConstruct) EncodedJSValue returnValue; { - SamplingTool::HostCallRecord callRecord(CTI_SAMPLER); + SamplingTool::CallRecord callRecord(CTI_SAMPLER, true); returnValue = constructData.native.function(callFrame); } |