<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[191404] trunk/Source/JavaScriptCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/191404">191404</a></dd>
<dt>Author</dt> <dd>sbarati@apple.com</dd>
<dt>Date</dt> <dd>2015-10-21 14:49:08 -0700 (Wed, 21 Oct 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>C calls in PolymorphicAccess shouldn't assume that the top of the stack looks like a JSC JIT frame and enable *ByIdFlush in FTL
https://bugs.webkit.org/show_bug.cgi?id=125711
Reviewed by Filip Pizlo.
This patch ensures that anytime we need to make a C call inside
PolymorphicAccess, we ensure there is enough space on the stack to do so.
This patch also enables GetByIdFlush/PutByIdFlush inside the FTL.
Because PolymorphicAccess now spills the necessary registers
before making a JS/C call, any registers that LLVM report as
being in use for the patchpoint will be spilled before making
a call by PolymorphicAccess.
* bytecode/PolymorphicAccess.cpp:
(JSC::AccessGenerationState::restoreScratch):
(JSC::AccessGenerationState::succeed):
(JSC::AccessGenerationState::calculateLiveRegistersForCallAndExceptionHandling):
(JSC::AccessCase::generate):
(JSC::PolymorphicAccess::regenerate):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::DFG::LowerDFGToLLVM::compileNode):
(JSC::FTL::DFG::LowerDFGToLLVM::compileGetById):
(JSC::FTL::DFG::LowerDFGToLLVM::emitStoreBarrier):
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::emitTypeOf):
(JSC::AssemblyHelpers::makeSpaceOnStackForCCall):
(JSC::AssemblyHelpers::reclaimSpaceOnStackForCCall):
* jit/RegisterSet.cpp:
(JSC::RegisterSet::webAssemblyCalleeSaveRegisters):
(JSC::RegisterSet::registersToNotSaveForJSCall):
(JSC::RegisterSet::registersToNotSaveForCCall):
(JSC::RegisterSet::allGPRs):
(JSC::RegisterSet::registersToNotSaveForCall): Deleted.
* jit/RegisterSet.h:
(JSC::RegisterSet::set):
* jit/ScratchRegisterAllocator.cpp:
(JSC::ScratchRegisterAllocator::allocateScratchGPR):
(JSC::ScratchRegisterAllocator::allocateScratchFPR):
(JSC::ScratchRegisterAllocator::preserveReusedRegistersByPushing):
(JSC::ScratchRegisterAllocator::restoreReusedRegistersByPopping):
These methods now take an extra parameter indicating if they
should create space for a C call at the top of the stack if
there are any reused registers to spill.
(JSC::ScratchRegisterAllocator::usedRegistersForCall):
* jit/ScratchRegisterAllocator.h:
(JSC::ScratchRegisterAllocator::usedRegisters):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodePolymorphicAccesscpp">trunk/Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLCapabilitiescpp">trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp">trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitAssemblyHelpersh">trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitRegisterSetcpp">trunk/Source/JavaScriptCore/jit/RegisterSet.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitRegisterSeth">trunk/Source/JavaScriptCore/jit/RegisterSet.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitScratchRegisterAllocatorcpp">trunk/Source/JavaScriptCore/jit/ScratchRegisterAllocator.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitScratchRegisterAllocatorh">trunk/Source/JavaScriptCore/jit/ScratchRegisterAllocator.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (191403 => 191404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-10-21 21:45:26 UTC (rev 191403)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-10-21 21:49:08 UTC (rev 191404)
</span><span class="lines">@@ -1,3 +1,56 @@
</span><ins>+2015-10-21 Saam barati <sbarati@apple.com>
+
+ C calls in PolymorphicAccess shouldn't assume that the top of the stack looks like a JSC JIT frame and enable *ByIdFlush in FTL
+ https://bugs.webkit.org/show_bug.cgi?id=125711
+
+ Reviewed by Filip Pizlo.
+
+ This patch ensures that anytime we need to make a C call inside
+ PolymorphicAccess, we ensure there is enough space on the stack to do so.
+
+ This patch also enables GetByIdFlush/PutByIdFlush inside the FTL.
+ Because PolymorphicAccess now spills the necessary registers
+ before making a JS/C call, any registers that LLVM report as
+ being in use for the patchpoint will be spilled before making
+ a call by PolymorphicAccess.
+
+ * bytecode/PolymorphicAccess.cpp:
+ (JSC::AccessGenerationState::restoreScratch):
+ (JSC::AccessGenerationState::succeed):
+ (JSC::AccessGenerationState::calculateLiveRegistersForCallAndExceptionHandling):
+ (JSC::AccessCase::generate):
+ (JSC::PolymorphicAccess::regenerate):
+ * ftl/FTLCapabilities.cpp:
+ (JSC::FTL::canCompile):
+ * ftl/FTLLowerDFGToLLVM.cpp:
+ (JSC::FTL::DFG::LowerDFGToLLVM::compileNode):
+ (JSC::FTL::DFG::LowerDFGToLLVM::compileGetById):
+ (JSC::FTL::DFG::LowerDFGToLLVM::emitStoreBarrier):
+ * jit/AssemblyHelpers.h:
+ (JSC::AssemblyHelpers::emitTypeOf):
+ (JSC::AssemblyHelpers::makeSpaceOnStackForCCall):
+ (JSC::AssemblyHelpers::reclaimSpaceOnStackForCCall):
+ * jit/RegisterSet.cpp:
+ (JSC::RegisterSet::webAssemblyCalleeSaveRegisters):
+ (JSC::RegisterSet::registersToNotSaveForJSCall):
+ (JSC::RegisterSet::registersToNotSaveForCCall):
+ (JSC::RegisterSet::allGPRs):
+ (JSC::RegisterSet::registersToNotSaveForCall): Deleted.
+ * jit/RegisterSet.h:
+ (JSC::RegisterSet::set):
+ * jit/ScratchRegisterAllocator.cpp:
+ (JSC::ScratchRegisterAllocator::allocateScratchGPR):
+ (JSC::ScratchRegisterAllocator::allocateScratchFPR):
+ (JSC::ScratchRegisterAllocator::preserveReusedRegistersByPushing):
+ (JSC::ScratchRegisterAllocator::restoreReusedRegistersByPopping):
+ These methods now take an extra parameter indicating if they
+ should create space for a C call at the top of the stack if
+ there are any reused registers to spill.
+
+ (JSC::ScratchRegisterAllocator::usedRegistersForCall):
+ * jit/ScratchRegisterAllocator.h:
+ (JSC::ScratchRegisterAllocator::usedRegisters):
+
</ins><span class="cx"> 2015-10-21 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: Array previews with Symbol objects have too few preview values
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodePolymorphicAccesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp (191403 => 191404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp        2015-10-21 21:45:26 UTC (rev 191403)
+++ trunk/Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp        2015-10-21 21:49:08 UTC (rev 191404)
</span><span class="lines">@@ -36,7 +36,6 @@
</span><span class="cx"> #include "JITOperations.h"
</span><span class="cx"> #include "JSCInlines.h"
</span><span class="cx"> #include "LinkBuffer.h"
</span><del>-#include "MaxFrameExtentForSlowPathCall.h"
</del><span class="cx"> #include "ScratchRegisterAllocator.h"
</span><span class="cx"> #include "StructureStubClearingWatchpoint.h"
</span><span class="cx"> #include "StructureStubInfo.h"
</span><span class="lines">@@ -55,7 +54,7 @@
</span><span class="cx">
</span><span class="cx"> void AccessGenerationState::restoreScratch()
</span><span class="cx"> {
</span><del>- allocator->restoreReusedRegistersByPopping(*jit, numberOfBytesUsedToPreserveReusedRegisters);
</del><ins>+ allocator->restoreReusedRegistersByPopping(*jit, numberOfBytesUsedToPreserveReusedRegisters, ScratchRegisterAllocator::ExtraStackSpace::NoExtraSpace);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void AccessGenerationState::succeed()
</span><span class="lines">@@ -75,7 +74,7 @@
</span><span class="cx"> RELEASE_ASSERT(JITCode::isOptimizingJIT(jit->codeBlock()->jitType()));
</span><span class="cx">
</span><span class="cx"> m_liveRegistersForCall = RegisterSet(m_liveRegistersToPreserveAtExceptionHandlingCallSite, allocator->usedRegisters());
</span><del>- m_liveRegistersForCall.exclude(RegisterSet::registersToNotSaveForCall());
</del><ins>+ m_liveRegistersForCall.exclude(RegisterSet::registersToNotSaveForJSCall());
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -744,17 +743,12 @@
</span><span class="cx"> CodeLocationLabel(vm.getCTIStub(linkCallThunkGenerator).code()));
</span><span class="cx"> });
</span><span class="cx"> } else {
</span><del>- unsigned stackOffset = 0;
- // Need to make room for the C call so our spillage isn't overwritten.
- if (state.numberOfStackBytesUsedForRegisterPreservation()) {
- if (maxFrameExtentForSlowPathCall)
- stackOffset = WTF::roundUpToMultipleOf(stackAlignmentBytes(), maxFrameExtentForSlowPathCall);
- }
- if (stackOffset) {
- jit.subPtr(
- CCallHelpers::TrustedImm32(stackOffset),
- CCallHelpers::stackPointerRegister);
- }
</del><ins>+ // Need to make room for the C call so any of our stack spillage isn't overwritten.
+ // We also need to make room because we may be an inline cache in the FTL and not
+ // have a JIT call frame.
+ bool needsToMakeRoomOnStackForCCall = state.numberOfStackBytesUsedForRegisterPreservation() || codeBlock->jitType() == JITCode::FTLJIT;
+ if (needsToMakeRoomOnStackForCCall)
+ jit.makeSpaceOnStackForCCall();
</ins><span class="cx">
</span><span class="cx"> // getter: EncodedJSValue (*GetValueFunc)(ExecState*, JSObject* slotBase, EncodedJSValue thisValue, PropertyName);
</span><span class="cx"> // setter: void (*PutValueFunc)(ExecState*, JSObject* base, EncodedJSValue thisObject, EncodedJSValue value);
</span><span class="lines">@@ -783,13 +777,9 @@
</span><span class="cx"> operationCall = jit.call();
</span><span class="cx"> if (m_type == CustomGetter)
</span><span class="cx"> jit.setupResults(valueRegs);
</span><ins>+ if (needsToMakeRoomOnStackForCCall)
+ jit.reclaimSpaceOnStackForCCall();
</ins><span class="cx">
</span><del>- if (stackOffset) {
- jit.addPtr(
- CCallHelpers::TrustedImm32(stackOffset),
- CCallHelpers::stackPointerRegister);
- }
-
</del><span class="cx"> CCallHelpers::Jump noException =
</span><span class="cx"> jit.emitExceptionCheck(CCallHelpers::InvertedExceptionCheck);
</span><span class="cx">
</span><span class="lines">@@ -893,11 +883,12 @@
</span><span class="cx"> else
</span><span class="cx"> scratchGPR3 = InvalidGPRReg;
</span><span class="cx">
</span><del>- size_t numberOfBytesUsedToPreserveReusedRegisters = allocator.preserveReusedRegistersByPushing(jit);
</del><ins>+ size_t numberOfBytesUsedToPreserveReusedRegisters = allocator.preserveReusedRegistersByPushing(jit, ScratchRegisterAllocator::ExtraStackSpace::SpaceForCCall);
</ins><span class="cx">
</span><span class="cx"> ASSERT(structure()->transitionWatchpointSetHasBeenInvalidated());
</span><span class="cx">
</span><span class="cx"> bool scratchGPRHasStorage = false;
</span><ins>+ bool needsToMakeRoomOnStackForCCall = !numberOfBytesUsedToPreserveReusedRegisters && codeBlock->jitType() == JITCode::FTLJIT;
</ins><span class="cx">
</span><span class="cx"> if (newStructure()->outOfLineCapacity() != structure()->outOfLineCapacity()) {
</span><span class="cx"> size_t newSize = newStructure()->outOfLineCapacity() * sizeof(JSValue);
</span><span class="lines">@@ -1004,8 +995,12 @@
</span><span class="cx"> // barrier slow path was just the normal slow path, below.
</span><span class="cx"> // https://bugs.webkit.org/show_bug.cgi?id=149030
</span><span class="cx"> allocator.preserveUsedRegistersToScratchBufferForCall(jit, scratchBuffer, scratchGPR2);
</span><ins>+ if (needsToMakeRoomOnStackForCCall)
+ jit.makeSpaceOnStackForCCall();
</ins><span class="cx"> jit.setupArgumentsWithExecState(baseGPR);
</span><span class="cx"> callFlushWriteBarrierBuffer = jit.call();
</span><ins>+ if (needsToMakeRoomOnStackForCCall)
+ jit.reclaimSpaceOnStackForCCall();
</ins><span class="cx"> allocator.restoreUsedRegistersFromScratchBufferForCall(
</span><span class="cx"> jit, scratchBuffer, scratchGPR2);
</span><span class="cx">
</span><span class="lines">@@ -1018,13 +1013,15 @@
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><del>- allocator.restoreReusedRegistersByPopping(jit, numberOfBytesUsedToPreserveReusedRegisters);
</del><ins>+ allocator.restoreReusedRegistersByPopping(jit, numberOfBytesUsedToPreserveReusedRegisters, ScratchRegisterAllocator::ExtraStackSpace::SpaceForCCall);
</ins><span class="cx"> state.succeed();
</span><span class="cx">
</span><span class="cx"> if (newStructure()->outOfLineCapacity() != structure()->outOfLineCapacity()) {
</span><span class="cx"> slowPath.link(&jit);
</span><del>- allocator.restoreReusedRegistersByPopping(jit, numberOfBytesUsedToPreserveReusedRegisters);
</del><ins>+ allocator.restoreReusedRegistersByPopping(jit, numberOfBytesUsedToPreserveReusedRegisters, ScratchRegisterAllocator::ExtraStackSpace::SpaceForCCall);
</ins><span class="cx"> allocator.preserveUsedRegistersToScratchBufferForCall(jit, scratchBuffer, scratchGPR);
</span><ins>+ if (needsToMakeRoomOnStackForCCall)
+ jit.makeSpaceOnStackForCCall();
</ins><span class="cx"> #if USE(JSVALUE64)
</span><span class="cx"> jit.setupArgumentsWithExecState(
</span><span class="cx"> baseGPR,
</span><span class="lines">@@ -1039,6 +1036,8 @@
</span><span class="cx"> valueRegs.payloadGPR(), valueRegs.tagGPR());
</span><span class="cx"> #endif
</span><span class="cx"> CCallHelpers::Call operationCall = jit.call();
</span><ins>+ if (needsToMakeRoomOnStackForCCall)
+ jit.reclaimSpaceOnStackForCCall();
</ins><span class="cx"> allocator.restoreUsedRegistersFromScratchBufferForCall(jit, scratchBuffer, scratchGPR);
</span><span class="cx"> state.succeed();
</span><span class="cx">
</span><span class="lines">@@ -1240,7 +1239,7 @@
</span><span class="cx"> CCallHelpers jit(&vm, codeBlock);
</span><span class="cx"> state.jit = &jit;
</span><span class="cx">
</span><del>- state.numberOfBytesUsedToPreserveReusedRegisters = allocator.preserveReusedRegistersByPushing(jit);
</del><ins>+ state.numberOfBytesUsedToPreserveReusedRegisters = allocator.preserveReusedRegistersByPushing(jit, ScratchRegisterAllocator::ExtraStackSpace::NoExtraSpace);
</ins><span class="cx">
</span><span class="cx"> bool allGuardedByStructureCheck = true;
</span><span class="cx"> bool hasJSGetterSetterCall = false;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLCapabilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp (191403 => 191404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp        2015-10-21 21:45:26 UTC (rev 191403)
+++ trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp        2015-10-21 21:49:08 UTC (rev 191404)
</span><span class="lines">@@ -159,6 +159,7 @@
</span><span class="cx"> case MakeRope:
</span><span class="cx"> case NewArrayWithSize:
</span><span class="cx"> case GetById:
</span><ins>+ case GetByIdFlush:
</ins><span class="cx"> case ToThis:
</span><span class="cx"> case MultiGetByOffset:
</span><span class="cx"> case MultiPutByOffset:
</span><span class="lines">@@ -222,6 +223,7 @@
</span><span class="cx"> return CannotCompile;
</span><span class="cx"> case PutByIdDirect:
</span><span class="cx"> case PutById:
</span><ins>+ case PutByIdFlush:
</ins><span class="cx"> if (node->child1().useKind() == CellUse)
</span><span class="cx"> break;
</span><span class="cx"> return CannotCompile;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp (191403 => 191404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2015-10-21 21:45:26 UTC (rev 191403)
+++ trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2015-10-21 21:49:08 UTC (rev 191404)
</span><span class="lines">@@ -554,6 +554,7 @@
</span><span class="cx"> compilePutStructure();
</span><span class="cx"> break;
</span><span class="cx"> case GetById:
</span><ins>+ case GetByIdFlush:
</ins><span class="cx"> compileGetById();
</span><span class="cx"> break;
</span><span class="cx"> case In:
</span><span class="lines">@@ -561,6 +562,7 @@
</span><span class="cx"> break;
</span><span class="cx"> case PutById:
</span><span class="cx"> case PutByIdDirect:
</span><ins>+ case PutByIdFlush:
</ins><span class="cx"> compilePutById();
</span><span class="cx"> break;
</span><span class="cx"> case GetButterfly:
</span><span class="lines">@@ -2212,9 +2214,6 @@
</span><span class="cx">
</span><span class="cx"> void compileGetById()
</span><span class="cx"> {
</span><del>- // Pretty much the only reason why we don't also support GetByIdFlush is because:
- // https://bugs.webkit.org/show_bug.cgi?id=125711
-
</del><span class="cx"> switch (m_node->child1().useKind()) {
</span><span class="cx"> case CellUse: {
</span><span class="cx"> setJSValue(getById(lowCell(m_node->child1())));
</span><span class="lines">@@ -8596,7 +8595,7 @@
</span><span class="cx"> GPRReg scratch2 = scratchRegisterAllocator.allocateScratchGPR();
</span><span class="cx">
</span><span class="cx"> unsigned bytesPushed =
</span><del>- scratchRegisterAllocator.preserveReusedRegistersByPushing(jit);
</del><ins>+ scratchRegisterAllocator.preserveReusedRegistersByPushing(jit, ScratchRegisterAllocator::ExtraStackSpace::SpaceForCCall);
</ins><span class="cx">
</span><span class="cx"> // We've already saved these, so when we make a slow path call, we don't have
</span><span class="cx"> // to save them again.
</span><span class="lines">@@ -8618,7 +8617,7 @@
</span><span class="cx"> scratch1, scratch2, CCallHelpers::ScalePtr,
</span><span class="cx"> static_cast<int32_t>(-sizeof(void*))));
</span><span class="cx">
</span><del>- scratchRegisterAllocator.restoreReusedRegistersByPopping(jit, bytesPushed);
</del><ins>+ scratchRegisterAllocator.restoreReusedRegistersByPopping(jit, bytesPushed, ScratchRegisterAllocator::ExtraStackSpace::SpaceForCCall);
</ins><span class="cx">
</span><span class="cx"> params.doneJumps.append(jit.jump());
</span><span class="cx">
</span><span class="lines">@@ -8627,7 +8626,7 @@
</span><span class="cx"> usedRegisters, jit, params.lazySlowPath->callSiteIndex(),
</span><span class="cx"> params.exceptionJumps, operationFlushWriteBarrierBuffer, InvalidGPRReg,
</span><span class="cx"> baseGPR);
</span><del>- scratchRegisterAllocator.restoreReusedRegistersByPopping(jit, bytesPushed);
</del><ins>+ scratchRegisterAllocator.restoreReusedRegistersByPopping(jit, bytesPushed, ScratchRegisterAllocator::ExtraStackSpace::SpaceForCCall);
</ins><span class="cx"> params.doneJumps.append(jit.jump());
</span><span class="cx"> });
</span><span class="cx"> },
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitAssemblyHelpersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h (191403 => 191404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h        2015-10-21 21:45:26 UTC (rev 191403)
+++ trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h        2015-10-21 21:49:08 UTC (rev 191404)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include "InlineCallFrame.h"
</span><span class="cx"> #include "JITCode.h"
</span><span class="cx"> #include "MacroAssembler.h"
</span><ins>+#include "MaxFrameExtentForSlowPathCall.h"
</ins><span class="cx"> #include "RegisterAtOffsetList.h"
</span><span class="cx"> #include "RegisterSet.h"
</span><span class="cx"> #include "TypeofType.h"
</span><span class="lines">@@ -1322,6 +1323,20 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Vector<BytecodeAndMachineOffset>& decodedCodeMapFor(CodeBlock*);
</span><ins>+
+ void makeSpaceOnStackForCCall()
+ {
+ unsigned stackOffset = WTF::roundUpToMultipleOf(stackAlignmentBytes(), maxFrameExtentForSlowPathCall);
+ if (stackOffset)
+ subPtr(TrustedImm32(stackOffset), stackPointerRegister);
+ }
+
+ void reclaimSpaceOnStackForCCall()
+ {
+ unsigned stackOffset = WTF::roundUpToMultipleOf(stackAlignmentBytes(), maxFrameExtentForSlowPathCall);
+ if (stackOffset)
+ addPtr(TrustedImm32(stackOffset), stackPointerRegister);
+ }
</ins><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> VM* m_vm;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitRegisterSetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/RegisterSet.cpp (191403 => 191404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/RegisterSet.cpp        2015-10-21 21:45:26 UTC (rev 191403)
+++ trunk/Source/JavaScriptCore/jit/RegisterSet.cpp        2015-10-21 21:49:08 UTC (rev 191404)
</span><span class="lines">@@ -307,11 +307,16 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-RegisterSet RegisterSet::registersToNotSaveForCall()
</del><ins>+RegisterSet RegisterSet::registersToNotSaveForJSCall()
</ins><span class="cx"> {
</span><span class="cx"> return RegisterSet(RegisterSet::vmCalleeSaveRegisters(), RegisterSet::stackRegisters(), RegisterSet::reservedHardwareRegisters());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+RegisterSet RegisterSet::registersToNotSaveForCCall()
+{
+ return RegisterSet(RegisterSet::calleeSaveRegisters(), RegisterSet::stackRegisters(), RegisterSet::reservedHardwareRegisters());
+}
+
</ins><span class="cx"> RegisterSet RegisterSet::allGPRs()
</span><span class="cx"> {
</span><span class="cx"> RegisterSet result;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitRegisterSeth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/RegisterSet.h (191403 => 191404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/RegisterSet.h        2015-10-21 21:45:26 UTC (rev 191403)
+++ trunk/Source/JavaScriptCore/jit/RegisterSet.h        2015-10-21 21:49:08 UTC (rev 191404)
</span><span class="lines">@@ -62,7 +62,8 @@
</span><span class="cx"> static RegisterSet allFPRs();
</span><span class="cx"> static RegisterSet allRegisters();
</span><span class="cx">
</span><del>- static RegisterSet registersToNotSaveForCall();
</del><ins>+ static RegisterSet registersToNotSaveForJSCall();
+ static RegisterSet registersToNotSaveForCCall();
</ins><span class="cx">
</span><span class="cx"> void set(Reg reg, bool value = true)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitScratchRegisterAllocatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/ScratchRegisterAllocator.cpp (191403 => 191404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/ScratchRegisterAllocator.cpp        2015-10-21 21:45:26 UTC (rev 191403)
+++ trunk/Source/JavaScriptCore/jit/ScratchRegisterAllocator.cpp        2015-10-21 21:49:08 UTC (rev 191404)
</span><span class="lines">@@ -102,7 +102,7 @@
</span><span class="cx"> GPRReg ScratchRegisterAllocator::allocateScratchGPR() { return allocateScratch<GPRInfo>(); }
</span><span class="cx"> FPRReg ScratchRegisterAllocator::allocateScratchFPR() { return allocateScratch<FPRInfo>(); }
</span><span class="cx">
</span><del>-unsigned ScratchRegisterAllocator::preserveReusedRegistersByPushing(MacroAssembler& jit)
</del><ins>+unsigned ScratchRegisterAllocator::preserveReusedRegistersByPushing(MacroAssembler& jit, ExtraStackSpace extraStackSpace)
</ins><span class="cx"> {
</span><span class="cx"> if (!didReuseRegisters())
</span><span class="cx"> return 0;
</span><span class="lines">@@ -119,13 +119,13 @@
</span><span class="cx"> registersToSpill.set(reg);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- unsigned extraStackBytesAtTopOfStack = maxFrameExtentForSlowPathCall;
</del><ins>+ unsigned extraStackBytesAtTopOfStack = extraStackSpace == ExtraStackSpace::SpaceForCCall ? maxFrameExtentForSlowPathCall : 0;
</ins><span class="cx"> unsigned stackAdjustmentSize = ScratchRegisterAllocator::preserveRegistersToStackForCall(jit, registersToSpill, extraStackBytesAtTopOfStack);
</span><span class="cx">
</span><span class="cx"> return stackAdjustmentSize;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ScratchRegisterAllocator::restoreReusedRegistersByPopping(MacroAssembler& jit, unsigned numberOfBytesUsedToPreserveReusedRegisters)
</del><ins>+void ScratchRegisterAllocator::restoreReusedRegistersByPopping(MacroAssembler& jit, unsigned numberOfBytesUsedToPreserveReusedRegisters, ExtraStackSpace extraStackSpace)
</ins><span class="cx"> {
</span><span class="cx"> if (!didReuseRegisters())
</span><span class="cx"> return;
</span><span class="lines">@@ -142,7 +142,7 @@
</span><span class="cx"> registersToFill.set(reg);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- unsigned extraStackBytesAtTopOfStack = maxFrameExtentForSlowPathCall;
</del><ins>+ unsigned extraStackBytesAtTopOfStack = extraStackSpace == ExtraStackSpace::SpaceForCCall ? maxFrameExtentForSlowPathCall : 0;
</ins><span class="cx"> RegisterSet dontRestore; // Empty set. We want to restore everything.
</span><span class="cx"> ScratchRegisterAllocator::restoreRegistersFromStackForCall(jit, registersToFill, dontRestore, numberOfBytesUsedToPreserveReusedRegisters, extraStackBytesAtTopOfStack);
</span><span class="cx"> }
</span><span class="lines">@@ -150,7 +150,7 @@
</span><span class="cx"> RegisterSet ScratchRegisterAllocator::usedRegistersForCall() const
</span><span class="cx"> {
</span><span class="cx"> RegisterSet result = m_usedRegisters;
</span><del>- result.exclude(RegisterSet::registersToNotSaveForCall());
</del><ins>+ result.exclude(RegisterSet::registersToNotSaveForJSCall());
</ins><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitScratchRegisterAllocatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/ScratchRegisterAllocator.h (191403 => 191404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/ScratchRegisterAllocator.h        2015-10-21 21:45:26 UTC (rev 191403)
+++ trunk/Source/JavaScriptCore/jit/ScratchRegisterAllocator.h        2015-10-21 21:49:08 UTC (rev 191404)
</span><span class="lines">@@ -66,12 +66,9 @@
</span><span class="cx">
</span><span class="cx"> RegisterSet usedRegisters() const { return m_usedRegisters; }
</span><span class="cx">
</span><del>- // preserveReusedRegistersByPushing() returns the number of padding bytes used to keep the stack
- // pointer properly aligned and to reserve room for calling a C helper. This number of padding
- // bytes must be provided to restoreReusedRegistersByPopping() in order to reverse the work done
- // by preserveReusedRegistersByPushing().
- unsigned preserveReusedRegistersByPushing(MacroAssembler& jit);
- void restoreReusedRegistersByPopping(MacroAssembler& jit, unsigned numberOfBytesUsedToPreserveReusedRegisters);
</del><ins>+ enum class ExtraStackSpace { SpaceForCCall, NoExtraSpace };
+ unsigned preserveReusedRegistersByPushing(MacroAssembler& jit, ExtraStackSpace);
+ void restoreReusedRegistersByPopping(MacroAssembler& jit, unsigned numberOfBytesUsedToPreserveReusedRegisters, ExtraStackSpace);
</ins><span class="cx">
</span><span class="cx"> RegisterSet usedRegistersForCall() const;
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>