<!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>[199699] 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/199699">199699</a></dd>
<dt>Author</dt> <dd>sbarati@apple.com</dd>
<dt>Date</dt> <dd>2016-04-18 18:38:30 -0700 (Mon, 18 Apr 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>implement dynamic scope accesses in the DFG/FTL
https://bugs.webkit.org/show_bug.cgi?id=156567
Reviewed by Geoffrey Garen.
This patch adds dynamic scope operations to the DFG/FTL.
This patch adds three new DFG nodes: ResolveScope, PutDynamicVar and GetDynamicVar.
When we encounter a Dynamic/UnresolvedProperty/UnresolvedPropertyWithVarInjectionChecks
resolve type, we will compile dynamic scope resolution nodes. When we encounter
a resolve type that needs var injection checks and the var injection
watchpoint has already been fired, we will compile dynamic scope resolution
nodes.
This patch also adds a new value to the InitializationMode enum: ConstInitialization.
There was a subtle bug where we used to never compile the var injection variant of the
resolve type for an eval that injected a var where there was also a global lexical variable with the same name.
For example, the store compiled in this eval("var foo = 20;") wouldn't be compiled
with var injection checks if there was global let/const variable named "foo".
So there was the potential for the injected var to store to the GlobalLexicalObject.
I found this bug because my initial implementation in the DFG/FTL ran into it.
The reason this bug existed is because when we compile a const initialization,
we never need a var injections check. The const initialization always
knows where to store its value. This same logic leaked into the above eval's
"var foo = 20" store. This new enum value allows us to distinguish const
initialization stores from non-const initialization stores.
(I also changed InitializationMode to be an enum class instead of an enum).
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::finishCreation):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::generate):
(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::initializeDefaultParameterValuesAndSetupFunctionScopeStack):
(JSC::BytecodeGenerator::initializeBlockScopedFunctions):
(JSC::BytecodeGenerator::hoistSloppyModeFunctionIfNecessary):
(JSC::BytecodeGenerator::prepareLexicalScopeForNextForLoopIteration):
(JSC::BytecodeGenerator::emitGetFromScope):
(JSC::BytecodeGenerator::initializeVariable):
(JSC::BytecodeGenerator::emitInstanceOf):
(JSC::BytecodeGenerator::emitPushFunctionNameScope):
(JSC::BytecodeGenerator::pushScopedControlFlowContext):
(JSC::BytecodeGenerator::emitPutNewTargetToArrowFunctionContextScope):
(JSC::BytecodeGenerator::emitPutDerivedConstructorToArrowFunctionContextScope):
(JSC::BytecodeGenerator::emitPutThisToArrowFunctionContextScope):
* bytecompiler/NodesCodegen.cpp:
(JSC::PostfixNode::emitResolve):
(JSC::PrefixNode::emitResolve):
(JSC::ReadModifyResolveNode::emitBytecode):
(JSC::initializationModeForAssignmentContext):
(JSC::AssignResolveNode::emitBytecode):
(JSC::EmptyLetExpression::emitBytecode):
(JSC::ForInNode::emitLoopHeader):
(JSC::ForOfNode::emitBytecode):
(JSC::ClassExprNode::emitBytecode):
(JSC::BindingNode::bindValue):
(JSC::AssignmentElementNode::bindValue):
(JSC::RestParameterNode::emit):
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::noticeArgumentsUse):
(JSC::DFG::ByteCodeParser::promoteToConstant):
(JSC::DFG::ByteCodeParser::needsDynamicLookup):
(JSC::DFG::ByteCodeParser::planLoad):
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGCapabilities.cpp:
(JSC::DFG::capabilityLevel):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGNode.h:
(JSC::DFG::Node::hasIdentifier):
(JSC::DFG::Node::identifierNumber):
(JSC::DFG::Node::hasGetPutInfo):
(JSC::DFG::Node::getPutInfo):
(JSC::DFG::Node::hasAccessorAttributes):
* dfg/DFGNodeType.h:
* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
* dfg/DFGPredictionPropagationPhase.cpp:
(JSC::DFG::PredictionPropagationPhase::propagate):
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compilePutGetterSetterById):
(JSC::DFG::SpeculativeJIT::compileResolveScope):
(JSC::DFG::SpeculativeJIT::compileGetDynamicVar):
(JSC::DFG::SpeculativeJIT::compilePutDynamicVar):
(JSC::DFG::SpeculativeJIT::compilePutAccessorByVal):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::callOperation):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compare):
(JSC::FTL::DFG::LowerDFGToB3::compileResolveScope):
(JSC::FTL::DFG::LowerDFGToB3::compileGetDynamicVar):
(JSC::FTL::DFG::LowerDFGToB3::compilePutDynamicVar):
(JSC::FTL::DFG::LowerDFGToB3::compareEqObjectOrOtherToObject):
* jit/CCallHelpers.h:
(JSC::CCallHelpers::setupArgumentsWithExecState):
* jit/JITOperations.cpp:
* jit/JITOperations.h:
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emit_op_put_to_scope):
(JSC::JIT::emitSlow_op_put_to_scope):
* jit/JITPropertyAccess32_64.cpp:
(JSC::JIT::emit_op_put_to_scope):
(JSC::JIT::emitSlow_op_put_to_scope):
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter64.asm:
* runtime/GetPutInfo.h:
(JSC::resolveModeName):
(JSC::initializationModeName):
(JSC::isInitialization):
(JSC::makeType):
(JSC::GetPutInfo::GetPutInfo):
* runtime/JSScope.cpp:
(JSC::abstractAccess):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeCodeBlockcpp">trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorcpp">trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecompilerNodesCodegencpp">trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGAbstractInterpreterInlinesh">trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGByteCodeParsercpp">trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGCapabilitiescpp">trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGClobberizeh">trunk/Source/JavaScriptCore/dfg/DFGClobberize.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGDoesGCcpp">trunk/Source/JavaScriptCore/dfg/DFGDoesGC.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGFixupPhasecpp">trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGNodeh">trunk/Source/JavaScriptCore/dfg/DFGNode.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGNodeTypeh">trunk/Source/JavaScriptCore/dfg/DFGNodeType.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGOperationscpp">trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGOperationsh">trunk/Source/JavaScriptCore/dfg/DFGOperations.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGPredictionPropagationPhasecpp">trunk/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSafeToExecuteh">trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSpeculativeJITcpp">trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSpeculativeJITh">trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSpeculativeJIT32_64cpp">trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSpeculativeJIT64cpp">trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLCapabilitiescpp">trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLLowerDFGToB3cpp">trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitCCallHelpersh">trunk/Source/JavaScriptCore/jit/CCallHelpers.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITOperationscpp">trunk/Source/JavaScriptCore/jit/JITOperations.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITOperationsh">trunk/Source/JavaScriptCore/jit/JITOperations.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITPropertyAccesscpp">trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITPropertyAccess32_64cpp">trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorellintLLIntDatacpp">trunk/Source/JavaScriptCore/llint/LLIntData.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorellintLLIntSlowPathscpp">trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorellintLowLevelInterpreterasm">trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm</a></li>
<li><a href="#trunkSourceJavaScriptCorellintLowLevelInterpreter64asm">trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeGetPutInfoh">trunk/Source/JavaScriptCore/runtime/GetPutInfo.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSScopecpp">trunk/Source/JavaScriptCore/runtime/JSScope.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -1,3 +1,138 @@
</span><ins>+2016-04-18 Saam barati <sbarati@apple.com>
+
+ implement dynamic scope accesses in the DFG/FTL
+ https://bugs.webkit.org/show_bug.cgi?id=156567
+
+ Reviewed by Geoffrey Garen.
+
+ This patch adds dynamic scope operations to the DFG/FTL.
+ This patch adds three new DFG nodes: ResolveScope, PutDynamicVar and GetDynamicVar.
+ When we encounter a Dynamic/UnresolvedProperty/UnresolvedPropertyWithVarInjectionChecks
+ resolve type, we will compile dynamic scope resolution nodes. When we encounter
+ a resolve type that needs var injection checks and the var injection
+ watchpoint has already been fired, we will compile dynamic scope resolution
+ nodes.
+
+ This patch also adds a new value to the InitializationMode enum: ConstInitialization.
+ There was a subtle bug where we used to never compile the var injection variant of the
+ resolve type for an eval that injected a var where there was also a global lexical variable with the same name.
+ For example, the store compiled in this eval("var foo = 20;") wouldn't be compiled
+ with var injection checks if there was global let/const variable named "foo".
+ So there was the potential for the injected var to store to the GlobalLexicalObject.
+ I found this bug because my initial implementation in the DFG/FTL ran into it.
+ The reason this bug existed is because when we compile a const initialization,
+ we never need a var injections check. The const initialization always
+ knows where to store its value. This same logic leaked into the above eval's
+ "var foo = 20" store. This new enum value allows us to distinguish const
+ initialization stores from non-const initialization stores.
+
+ (I also changed InitializationMode to be an enum class instead of an enum).
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::finishCreation):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::generate):
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ (JSC::BytecodeGenerator::initializeDefaultParameterValuesAndSetupFunctionScopeStack):
+ (JSC::BytecodeGenerator::initializeBlockScopedFunctions):
+ (JSC::BytecodeGenerator::hoistSloppyModeFunctionIfNecessary):
+ (JSC::BytecodeGenerator::prepareLexicalScopeForNextForLoopIteration):
+ (JSC::BytecodeGenerator::emitGetFromScope):
+ (JSC::BytecodeGenerator::initializeVariable):
+ (JSC::BytecodeGenerator::emitInstanceOf):
+ (JSC::BytecodeGenerator::emitPushFunctionNameScope):
+ (JSC::BytecodeGenerator::pushScopedControlFlowContext):
+ (JSC::BytecodeGenerator::emitPutNewTargetToArrowFunctionContextScope):
+ (JSC::BytecodeGenerator::emitPutDerivedConstructorToArrowFunctionContextScope):
+ (JSC::BytecodeGenerator::emitPutThisToArrowFunctionContextScope):
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::PostfixNode::emitResolve):
+ (JSC::PrefixNode::emitResolve):
+ (JSC::ReadModifyResolveNode::emitBytecode):
+ (JSC::initializationModeForAssignmentContext):
+ (JSC::AssignResolveNode::emitBytecode):
+ (JSC::EmptyLetExpression::emitBytecode):
+ (JSC::ForInNode::emitLoopHeader):
+ (JSC::ForOfNode::emitBytecode):
+ (JSC::ClassExprNode::emitBytecode):
+ (JSC::BindingNode::bindValue):
+ (JSC::AssignmentElementNode::bindValue):
+ (JSC::RestParameterNode::emit):
+ * dfg/DFGAbstractInterpreterInlines.h:
+ (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::noticeArgumentsUse):
+ (JSC::DFG::ByteCodeParser::promoteToConstant):
+ (JSC::DFG::ByteCodeParser::needsDynamicLookup):
+ (JSC::DFG::ByteCodeParser::planLoad):
+ (JSC::DFG::ByteCodeParser::parseBlock):
+ * dfg/DFGCapabilities.cpp:
+ (JSC::DFG::capabilityLevel):
+ * dfg/DFGClobberize.h:
+ (JSC::DFG::clobberize):
+ * dfg/DFGDoesGC.cpp:
+ (JSC::DFG::doesGC):
+ * dfg/DFGFixupPhase.cpp:
+ (JSC::DFG::FixupPhase::fixupNode):
+ * dfg/DFGNode.h:
+ (JSC::DFG::Node::hasIdentifier):
+ (JSC::DFG::Node::identifierNumber):
+ (JSC::DFG::Node::hasGetPutInfo):
+ (JSC::DFG::Node::getPutInfo):
+ (JSC::DFG::Node::hasAccessorAttributes):
+ * dfg/DFGNodeType.h:
+ * dfg/DFGOperations.cpp:
+ * dfg/DFGOperations.h:
+ * dfg/DFGPredictionPropagationPhase.cpp:
+ (JSC::DFG::PredictionPropagationPhase::propagate):
+ * dfg/DFGSafeToExecute.h:
+ (JSC::DFG::safeToExecute):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compilePutGetterSetterById):
+ (JSC::DFG::SpeculativeJIT::compileResolveScope):
+ (JSC::DFG::SpeculativeJIT::compileGetDynamicVar):
+ (JSC::DFG::SpeculativeJIT::compilePutDynamicVar):
+ (JSC::DFG::SpeculativeJIT::compilePutAccessorByVal):
+ * dfg/DFGSpeculativeJIT.h:
+ (JSC::DFG::SpeculativeJIT::callOperation):
+ * dfg/DFGSpeculativeJIT32_64.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT64.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * ftl/FTLCapabilities.cpp:
+ (JSC::FTL::canCompile):
+ * ftl/FTLLowerDFGToB3.cpp:
+ (JSC::FTL::DFG::LowerDFGToB3::compileNode):
+ (JSC::FTL::DFG::LowerDFGToB3::compare):
+ (JSC::FTL::DFG::LowerDFGToB3::compileResolveScope):
+ (JSC::FTL::DFG::LowerDFGToB3::compileGetDynamicVar):
+ (JSC::FTL::DFG::LowerDFGToB3::compilePutDynamicVar):
+ (JSC::FTL::DFG::LowerDFGToB3::compareEqObjectOrOtherToObject):
+ * jit/CCallHelpers.h:
+ (JSC::CCallHelpers::setupArgumentsWithExecState):
+ * jit/JITOperations.cpp:
+ * jit/JITOperations.h:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emit_op_put_to_scope):
+ (JSC::JIT::emitSlow_op_put_to_scope):
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::emit_op_put_to_scope):
+ (JSC::JIT::emitSlow_op_put_to_scope):
+ * llint/LLIntData.cpp:
+ (JSC::LLInt::Data::performAssertions):
+ * llint/LLIntSlowPaths.cpp:
+ (JSC::LLInt::LLINT_SLOW_PATH_DECL):
+ * llint/LowLevelInterpreter.asm:
+ * llint/LowLevelInterpreter64.asm:
+ * runtime/GetPutInfo.h:
+ (JSC::resolveModeName):
+ (JSC::initializationModeName):
+ (JSC::isInitialization):
+ (JSC::makeType):
+ (JSC::GetPutInfo::GetPutInfo):
+ * runtime/JSScope.cpp:
+ (JSC::abstractAccess):
+
</ins><span class="cx"> 2016-04-18 Filip Pizlo <fpizlo@apple.com>
</span><span class="cx">
</span><span class="cx"> Disable AVX.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCodeBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -2087,7 +2087,7 @@
</span><span class="cx"> RELEASE_ASSERT(type != LocalClosureVar);
</span><span class="cx"> int localScopeDepth = pc[5].u.operand;
</span><span class="cx">
</span><del>- ResolveOp op = JSScope::abstractResolve(m_globalObject->globalExec(), localScopeDepth, scope, ident, Get, type, NotInitialization);
</del><ins>+ ResolveOp op = JSScope::abstractResolve(m_globalObject->globalExec(), localScopeDepth, scope, ident, Get, type, InitializationMode::NotInitialization);
</ins><span class="cx"> instructions[i + 4].u.operand = op.type;
</span><span class="cx"> instructions[i + 5].u.operand = op.depth;
</span><span class="cx"> if (op.lexicalEnvironment) {
</span><span class="lines">@@ -2117,14 +2117,14 @@
</span><span class="cx"> instructions[i + 5].u.pointer = nullptr;
</span><span class="cx">
</span><span class="cx"> GetPutInfo getPutInfo = GetPutInfo(pc[4].u.operand);
</span><del>- ASSERT(getPutInfo.initializationMode() == NotInitialization);
</del><ins>+ ASSERT(!isInitialization(getPutInfo.initializationMode()));
</ins><span class="cx"> if (getPutInfo.resolveType() == LocalClosureVar) {
</span><span class="cx"> instructions[i + 4] = GetPutInfo(getPutInfo.resolveMode(), ClosureVar, getPutInfo.initializationMode()).operand();
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> const Identifier& ident = identifier(pc[3].u.operand);
</span><del>- ResolveOp op = JSScope::abstractResolve(m_globalObject->globalExec(), localScopeDepth, scope, ident, Get, getPutInfo.resolveType(), NotInitialization);
</del><ins>+ ResolveOp op = JSScope::abstractResolve(m_globalObject->globalExec(), localScopeDepth, scope, ident, Get, getPutInfo.resolveType(), InitializationMode::NotInitialization);
</ins><span class="cx">
</span><span class="cx"> instructions[i + 4].u.operand = GetPutInfo(getPutInfo.resolveMode(), op.type, getPutInfo.initializationMode()).operand();
</span><span class="cx"> if (op.type == ModuleVar)
</span><span class="lines">@@ -2193,7 +2193,7 @@
</span><span class="cx"> ResolveType type = static_cast<ResolveType>(pc[5].u.operand);
</span><span class="cx"> // Even though type profiling may be profiling either a Get or a Put, we can always claim a Get because
</span><span class="cx"> // we're abstractly "read"ing from a JSScope.
</span><del>- ResolveOp op = JSScope::abstractResolve(m_globalObject->globalExec(), localScopeDepth, scope, ident, Get, type, NotInitialization);
</del><ins>+ ResolveOp op = JSScope::abstractResolve(m_globalObject->globalExec(), localScopeDepth, scope, ident, Get, type, InitializationMode::NotInitialization);
</ins><span class="cx">
</span><span class="cx"> if (op.type == ClosureVar || op.type == ModuleVar)
</span><span class="cx"> symbolTable = op.lexicalEnvironment->symbolTable();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -90,7 +90,7 @@
</span><span class="cx"> globalScope = newBlockScopeVariable();
</span><span class="cx"> emitMove(globalScope.get(), globalObjectScope.get());
</span><span class="cx"> }
</span><del>- emitPutToScope(globalScope.get(), Variable(metadata->ident()), temp.get(), ThrowIfNotFound, NotInitialization);
</del><ins>+ emitPutToScope(globalScope.get(), Variable(metadata->ident()), temp.get(), ThrowIfNotFound, InitializationMode::NotInitialization);
</ins><span class="cx"> } else
</span><span class="cx"> RELEASE_ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span><span class="lines">@@ -389,7 +389,7 @@
</span><span class="cx"> instructions().append(m_lexicalEnvironmentRegister->index());
</span><span class="cx"> instructions().append(UINT_MAX);
</span><span class="cx"> instructions().append(virtualRegisterForArgument(1 + i).offset());
</span><del>- instructions().append(GetPutInfo(ThrowIfNotFound, LocalClosureVar, NotInitialization).operand());
</del><ins>+ instructions().append(GetPutInfo(ThrowIfNotFound, LocalClosureVar, InitializationMode::NotInitialization).operand());
</ins><span class="cx"> instructions().append(symbolTableConstantIndex);
</span><span class="cx"> instructions().append(offset.offset());
</span><span class="cx"> }
</span><span class="lines">@@ -436,7 +436,7 @@
</span><span class="cx"> instructions().append(m_lexicalEnvironmentRegister->index());
</span><span class="cx"> instructions().append(addConstant(ident));
</span><span class="cx"> instructions().append(virtualRegisterForArgument(1 + i).offset());
</span><del>- instructions().append(GetPutInfo(ThrowIfNotFound, LocalClosureVar, NotInitialization).operand());
</del><ins>+ instructions().append(GetPutInfo(ThrowIfNotFound, LocalClosureVar, InitializationMode::NotInitialization).operand());
</ins><span class="cx"> instructions().append(symbolTableConstantIndex);
</span><span class="cx"> instructions().append(offset.offset());
</span><span class="cx"> }
</span><span class="lines">@@ -868,7 +868,7 @@
</span><span class="cx"> ASSERT(!isSimpleParameterList);
</span><span class="cx"> Variable var = variable(valuesToMoveIntoVars[i].first);
</span><span class="cx"> RegisterID* scope = emitResolveScope(nullptr, var);
</span><del>- emitPutToScope(scope, var, valuesToMoveIntoVars[i].second.get(), DoNotThrowIfNotFound, NotInitialization);
</del><ins>+ emitPutToScope(scope, var, valuesToMoveIntoVars[i].second.get(), DoNotThrowIfNotFound, InitializationMode::NotInitialization);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1933,7 +1933,7 @@
</span><span class="cx"> RELEASE_ASSERT(!entry.isNull());
</span><span class="cx"> emitNewFunctionExpressionCommon(temp.get(), function);
</span><span class="cx"> bool isLexicallyScoped = true;
</span><del>- emitPutToScope(scope, variableForLocalEntry(name, entry, symbolTableIndex, isLexicallyScoped), temp.get(), DoNotThrowIfNotFound, Initialization);
</del><ins>+ emitPutToScope(scope, variableForLocalEntry(name, entry, symbolTableIndex, isLexicallyScoped), temp.get(), DoNotThrowIfNotFound, InitializationMode::Initialization);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1957,7 +1957,7 @@
</span><span class="cx"> SymbolTableEntry entry = varSymbolTable->get(functionName.impl());
</span><span class="cx"> ASSERT(!entry.isNull());
</span><span class="cx"> bool isLexicallyScoped = false;
</span><del>- emitPutToScope(varScope.m_scope, variableForLocalEntry(functionName, entry, varScope.m_symbolTableConstantIndex, isLexicallyScoped), currentValue.get(), DoNotThrowIfNotFound, NotInitialization);
</del><ins>+ emitPutToScope(varScope.m_scope, variableForLocalEntry(functionName, entry, varScope.m_symbolTableConstantIndex, isLexicallyScoped), currentValue.get(), DoNotThrowIfNotFound, InitializationMode::NotInitialization);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2073,7 +2073,7 @@
</span><span class="cx"> SymbolTableEntry entry = symbolTable->get(locker, identifier.impl());
</span><span class="cx"> RELEASE_ASSERT(!entry.isNull());
</span><span class="cx"> RegisterID* transitionValue = pair.first;
</span><del>- emitPutToScope(loopScope, variableForLocalEntry(identifier, entry, loopSymbolTable->index(), true), transitionValue, DoNotThrowIfNotFound, NotInitialization);
</del><ins>+ emitPutToScope(loopScope, variableForLocalEntry(identifier, entry, loopSymbolTable->index(), true), transitionValue, DoNotThrowIfNotFound, InitializationMode::NotInitialization);
</ins><span class="cx"> transitionValue->deref();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2296,7 +2296,7 @@
</span><span class="cx"> instructions().append(kill(dst));
</span><span class="cx"> instructions().append(scope->index());
</span><span class="cx"> instructions().append(addConstant(variable.ident()));
</span><del>- instructions().append(GetPutInfo(resolveMode, variable.offset().isScope() ? LocalClosureVar : resolveType(), NotInitialization).operand());
</del><ins>+ instructions().append(GetPutInfo(resolveMode, variable.offset().isScope() ? LocalClosureVar : resolveType(), InitializationMode::NotInitialization).operand());
</ins><span class="cx"> instructions().append(localScopeDepth());
</span><span class="cx"> instructions().append(variable.offset().isScope() ? variable.offset().scopeOffset().offset() : 0);
</span><span class="cx"> instructions().append(profile);
</span><span class="lines">@@ -2350,7 +2350,7 @@
</span><span class="cx"> {
</span><span class="cx"> RELEASE_ASSERT(variable.offset().kind() != VarKind::Invalid);
</span><span class="cx"> RegisterID* scope = emitResolveScope(nullptr, variable);
</span><del>- return emitPutToScope(scope, variable, value, ThrowIfNotFound, NotInitialization);
</del><ins>+ return emitPutToScope(scope, variable, value, ThrowIfNotFound, InitializationMode::NotInitialization);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RegisterID* BytecodeGenerator::emitInstanceOf(RegisterID* dst, RegisterID* value, RegisterID* basePrototype)
</span><span class="lines">@@ -3739,7 +3739,7 @@
</span><span class="cx"> ASSERT_UNUSED(numVars, m_codeBlock->m_numVars == static_cast<int>(numVars + 1)); // Should have only created one new "var" for the function name scope.
</span><span class="cx"> bool shouldTreatAsLexicalVariable = isStrictMode();
</span><span class="cx"> Variable functionVar = variableForLocalEntry(property, m_symbolTableStack.last().m_symbolTable->get(property.impl()), m_symbolTableStack.last().m_symbolTableConstantIndex, shouldTreatAsLexicalVariable);
</span><del>- emitPutToScope(m_symbolTableStack.last().m_scope, functionVar, callee, ThrowIfNotFound, NotInitialization);
</del><ins>+ emitPutToScope(m_symbolTableStack.last().m_scope, functionVar, callee, ThrowIfNotFound, InitializationMode::NotInitialization);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void BytecodeGenerator::pushScopedControlFlowContext()
</span><span class="lines">@@ -4229,7 +4229,7 @@
</span><span class="cx"> ASSERT(m_arrowFunctionContextLexicalEnvironmentRegister);
</span><span class="cx">
</span><span class="cx"> Variable newTargetVar = variable(propertyNames().newTargetLocalPrivateName);
</span><del>- emitPutToScope(m_arrowFunctionContextLexicalEnvironmentRegister, newTargetVar, newTarget(), DoNotThrowIfNotFound, Initialization);
</del><ins>+ emitPutToScope(m_arrowFunctionContextLexicalEnvironmentRegister, newTargetVar, newTarget(), DoNotThrowIfNotFound, InitializationMode::Initialization);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4240,7 +4240,7 @@
</span><span class="cx"> ASSERT(m_arrowFunctionContextLexicalEnvironmentRegister);
</span><span class="cx">
</span><span class="cx"> Variable protoScope = variable(propertyNames().derivedConstructorPrivateName);
</span><del>- emitPutToScope(m_arrowFunctionContextLexicalEnvironmentRegister, protoScope, &m_calleeRegister, DoNotThrowIfNotFound, Initialization);
</del><ins>+ emitPutToScope(m_arrowFunctionContextLexicalEnvironmentRegister, protoScope, &m_calleeRegister, DoNotThrowIfNotFound, InitializationMode::Initialization);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -4253,7 +4253,7 @@
</span><span class="cx"> Variable thisVar = variable(propertyNames().thisIdentifier, ThisResolutionType::Scoped);
</span><span class="cx"> RegisterID* scope = isDerivedConstructorContext() ? emitLoadArrowFunctionLexicalEnvironment(propertyNames().thisIdentifier) : m_arrowFunctionContextLexicalEnvironmentRegister;
</span><span class="cx">
</span><del>- emitPutToScope(scope, thisVar, thisRegister(), ThrowIfNotFound, NotInitialization);
</del><ins>+ emitPutToScope(scope, thisVar, thisRegister(), ThrowIfNotFound, InitializationMode::NotInitialization);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecompilerNodesCodegencpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -1158,7 +1158,7 @@
</span><span class="cx"> }
</span><span class="cx"> RefPtr<RegisterID> oldValue = emitPostIncOrDec(generator, generator.finalDestination(dst), value.get(), m_operator);
</span><span class="cx"> if (!var.isReadOnly()) {
</span><del>- generator.emitPutToScope(scope.get(), var, value.get(), ThrowIfNotFound, NotInitialization);
</del><ins>+ generator.emitPutToScope(scope.get(), var, value.get(), ThrowIfNotFound, InitializationMode::NotInitialization);
</ins><span class="cx"> generator.emitProfileType(value.get(), var, divotStart(), divotEnd());
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1358,7 +1358,7 @@
</span><span class="cx">
</span><span class="cx"> emitIncOrDec(generator, value.get(), m_operator);
</span><span class="cx"> if (!var.isReadOnly()) {
</span><del>- generator.emitPutToScope(scope.get(), var, value.get(), ThrowIfNotFound, NotInitialization);
</del><ins>+ generator.emitPutToScope(scope.get(), var, value.get(), ThrowIfNotFound, InitializationMode::NotInitialization);
</ins><span class="cx"> generator.emitProfileType(value.get(), var, divotStart(), divotEnd());
</span><span class="cx"> }
</span><span class="cx"> return generator.moveToDestinationIfNeeded(dst, value.get());
</span><span class="lines">@@ -1909,12 +1909,27 @@
</span><span class="cx"> RefPtr<RegisterID> result = emitReadModifyAssignment(generator, generator.finalDestination(dst, value.get()), value.get(), m_right, m_operator, OperandTypes(ResultType::unknownType(), m_right->resultDescriptor()), this);
</span><span class="cx"> RegisterID* returnResult = result.get();
</span><span class="cx"> if (!var.isReadOnly()) {
</span><del>- returnResult = generator.emitPutToScope(scope.get(), var, result.get(), ThrowIfNotFound, NotInitialization);
</del><ins>+ returnResult = generator.emitPutToScope(scope.get(), var, result.get(), ThrowIfNotFound, InitializationMode::NotInitialization);
</ins><span class="cx"> generator.emitProfileType(result.get(), var, divotStart(), divotEnd());
</span><span class="cx"> }
</span><span class="cx"> return returnResult;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static InitializationMode initializationModeForAssignmentContext(AssignmentContext assignmentContext)
+{
+ switch (assignmentContext) {
+ case AssignmentContext::DeclarationStatement:
+ return InitializationMode::Initialization;
+ case AssignmentContext::ConstDeclarationStatement:
+ return InitializationMode::ConstInitialization;
+ case AssignmentContext::AssignmentExpression:
+ return InitializationMode::NotInitialization;
+ }
+
+ ASSERT_NOT_REACHED();
+ return InitializationMode::NotInitialization;
+}
+
</ins><span class="cx"> // ------------------------------ AssignResolveNode -----------------------------------
</span><span class="cx">
</span><span class="cx"> RegisterID* AssignResolveNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
</span><span class="lines">@@ -1966,8 +1981,7 @@
</span><span class="cx"> generator.emitExpressionInfo(divot(), divotStart(), divotEnd());
</span><span class="cx"> RegisterID* returnResult = result.get();
</span><span class="cx"> if (!isReadOnly) {
</span><del>- returnResult = generator.emitPutToScope(scope.get(), var, result.get(), generator.isStrictMode() ? ThrowIfNotFound : DoNotThrowIfNotFound,
- m_assignmentContext == AssignmentContext::ConstDeclarationStatement || m_assignmentContext == AssignmentContext::DeclarationStatement ? Initialization : NotInitialization);
</del><ins>+ returnResult = generator.emitPutToScope(scope.get(), var, result.get(), generator.isStrictMode() ? ThrowIfNotFound : DoNotThrowIfNotFound, initializationModeForAssignmentContext(m_assignmentContext));
</ins><span class="cx"> generator.emitProfileType(result.get(), var, divotStart(), divotEnd());
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2162,7 +2176,7 @@
</span><span class="cx"> } else {
</span><span class="cx"> RefPtr<RegisterID> scope = generator.emitResolveScope(nullptr, var);
</span><span class="cx"> RefPtr<RegisterID> value = generator.emitLoad(nullptr, jsUndefined());
</span><del>- generator.emitPutToScope(scope.get(), var, value.get(), generator.isStrictMode() ? ThrowIfNotFound : DoNotThrowIfNotFound, Initialization);
</del><ins>+ generator.emitPutToScope(scope.get(), var, value.get(), generator.isStrictMode() ? ThrowIfNotFound : DoNotThrowIfNotFound, InitializationMode::Initialization);
</ins><span class="cx"> generator.emitProfileType(value.get(), var, position(), JSTextPosition(-1, position().offset + m_ident.length(), -1));
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2370,7 +2384,7 @@
</span><span class="cx"> generator.emitExpressionInfo(divot(), divotStart(), divotEnd());
</span><span class="cx"> RegisterID* scope = generator.emitResolveScope(nullptr, var);
</span><span class="cx"> generator.emitExpressionInfo(divot(), divotStart(), divotEnd());
</span><del>- generator.emitPutToScope(scope, var, propertyName, generator.isStrictMode() ? ThrowIfNotFound : DoNotThrowIfNotFound, NotInitialization);
</del><ins>+ generator.emitPutToScope(scope, var, propertyName, generator.isStrictMode() ? ThrowIfNotFound : DoNotThrowIfNotFound, InitializationMode::NotInitialization);
</ins><span class="cx"> }
</span><span class="cx"> generator.emitProfileType(propertyName, var, m_lexpr->position(), JSTextPosition(-1, m_lexpr->position().offset + ident.length(), -1));
</span><span class="cx"> return;
</span><span class="lines">@@ -2591,7 +2605,7 @@
</span><span class="cx"> generator.emitExpressionInfo(divot(), divotStart(), divotEnd());
</span><span class="cx"> RegisterID* scope = generator.emitResolveScope(nullptr, var);
</span><span class="cx"> generator.emitExpressionInfo(divot(), divotStart(), divotEnd());
</span><del>- generator.emitPutToScope(scope, var, value, generator.isStrictMode() ? ThrowIfNotFound : DoNotThrowIfNotFound, NotInitialization);
</del><ins>+ generator.emitPutToScope(scope, var, value, generator.isStrictMode() ? ThrowIfNotFound : DoNotThrowIfNotFound, InitializationMode::NotInitialization);
</ins><span class="cx"> }
</span><span class="cx"> generator.emitProfileType(value, var, m_lexpr->position(), JSTextPosition(-1, m_lexpr->position().offset + ident.length(), -1));
</span><span class="cx"> } else if (m_lexpr->isDotAccessorNode()) {
</span><span class="lines">@@ -3311,7 +3325,7 @@
</span><span class="cx"> Variable classNameVar = generator.variable(m_name);
</span><span class="cx"> RELEASE_ASSERT(classNameVar.isResolved());
</span><span class="cx"> RefPtr<RegisterID> scope = generator.emitResolveScope(nullptr, classNameVar);
</span><del>- generator.emitPutToScope(scope.get(), classNameVar, constructor.get(), ThrowIfNotFound, Initialization);
</del><ins>+ generator.emitPutToScope(scope.get(), classNameVar, constructor.get(), ThrowIfNotFound, InitializationMode::Initialization);
</ins><span class="cx"> generator.popLexicalScope(this);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3608,8 +3622,7 @@
</span><span class="cx"> generator.emitReadOnlyExceptionIfNeeded(var);
</span><span class="cx"> return;
</span><span class="cx"> }
</span><del>- generator.emitPutToScope(scope, var, value, generator.isStrictMode() ? ThrowIfNotFound : DoNotThrowIfNotFound,
- m_bindingContext == AssignmentContext::ConstDeclarationStatement || m_bindingContext == AssignmentContext::DeclarationStatement ? Initialization : NotInitialization);
</del><ins>+ generator.emitPutToScope(scope, var, value, generator.isStrictMode() ? ThrowIfNotFound : DoNotThrowIfNotFound, initializationModeForAssignmentContext(m_bindingContext));
</ins><span class="cx"> generator.emitProfileType(value, var, divotStart(), divotEnd());
</span><span class="cx"> if (m_bindingContext == AssignmentContext::DeclarationStatement || m_bindingContext == AssignmentContext::ConstDeclarationStatement)
</span><span class="cx"> generator.liftTDZCheckIfPossible(var);
</span><span class="lines">@@ -3659,7 +3672,7 @@
</span><span class="cx"> }
</span><span class="cx"> generator.emitExpressionInfo(divotEnd(), divotStart(), divotEnd());
</span><span class="cx"> if (!isReadOnly) {
</span><del>- generator.emitPutToScope(scope.get(), var, value, generator.isStrictMode() ? ThrowIfNotFound : DoNotThrowIfNotFound, NotInitialization);
</del><ins>+ generator.emitPutToScope(scope.get(), var, value, generator.isStrictMode() ? ThrowIfNotFound : DoNotThrowIfNotFound, InitializationMode::NotInitialization);
</ins><span class="cx"> generator.emitProfileType(value, var, divotStart(), divotEnd());
</span><span class="cx"> }
</span><span class="cx"> } else if (m_assignmentTarget->isDotAccessorNode()) {
</span><span class="lines">@@ -3710,7 +3723,7 @@
</span><span class="cx"> generator.emitProfileType(restParameterArray.get(), var, m_divotStart, m_divotEnd);
</span><span class="cx"> RefPtr<RegisterID> scope = generator.emitResolveScope(nullptr, var);
</span><span class="cx"> generator.emitExpressionInfo(m_divotEnd, m_divotStart, m_divotEnd);
</span><del>- generator.emitPutToScope(scope.get(), var, restParameterArray.get(), generator.isStrictMode() ? ThrowIfNotFound : DoNotThrowIfNotFound, Initialization);
</del><ins>+ generator.emitPutToScope(scope.get(), var, restParameterArray.get(), generator.isStrictMode() ? ThrowIfNotFound : DoNotThrowIfNotFound, InitializationMode::Initialization);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGAbstractInterpreterInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -2648,9 +2648,24 @@
</span><span class="cx"> case GetGlobalVar:
</span><span class="cx"> forNode(node).makeHeapTop();
</span><span class="cx"> break;
</span><ins>+
</ins><span class="cx"> case GetGlobalLexicalVariable:
</span><span class="cx"> forNode(node).makeBytecodeTop();
</span><span class="cx"> break;
</span><ins>+
+ case GetDynamicVar:
+ clobberWorld(node->origin.semantic, clobberLimit);
+ forNode(node).makeBytecodeTop();
+ break;
+
+ case PutDynamicVar:
+ clobberWorld(node->origin.semantic, clobberLimit);
+ break;
+
+ case ResolveScope:
+ clobberWorld(node->origin.semantic, clobberLimit);
+ forNode(node).setType(m_graph, SpecObject);
+ break;
</ins><span class="cx">
</span><span class="cx"> case VarInjectionWatchpoint:
</span><span class="cx"> case PutGlobalVariable:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGByteCodeParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -968,6 +968,8 @@
</span><span class="cx"> for (ArgumentPosition* argument : m_inlineStackTop->m_argumentPositions)
</span><span class="cx"> argument->mergeShouldNeverUnbox(true);
</span><span class="cx"> }
</span><ins>+
+ bool needsDynamicLookup(ResolveType, OpcodeID);
</ins><span class="cx">
</span><span class="cx"> VM* m_vm;
</span><span class="cx"> CodeBlock* m_codeBlock;
</span><span class="lines">@@ -2640,6 +2642,61 @@
</span><span class="cx"> return method;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool ByteCodeParser::needsDynamicLookup(ResolveType type, OpcodeID opcode)
+{
+ ASSERT(opcode == op_resolve_scope || opcode == op_get_from_scope || opcode == op_put_to_scope);
+
+ JSGlobalObject* globalObject = m_inlineStackTop->m_codeBlock->globalObject();
+ if (needsVarInjectionChecks(type) && globalObject->varInjectionWatchpoint()->hasBeenInvalidated())
+ return true;
+
+ switch (type) {
+ case GlobalProperty:
+ case GlobalVar:
+ case GlobalLexicalVar:
+ case ClosureVar:
+ case LocalClosureVar:
+ case ModuleVar:
+ return false;
+
+ case UnresolvedProperty:
+ case UnresolvedPropertyWithVarInjectionChecks: {
+ // The heuristic for UnresolvedProperty scope accesses is we will ForceOSRExit if we
+ // haven't exited from from this access before to let the baseline JIT try to better
+ // cache the access. If we've already exited from this operation, it's unlikely that
+ // the baseline will come up with a better ResolveType and instead we will compile
+ // this as a dynamic scope access.
+
+ // We only track our heuristic through resolve_scope since resolve_scope will
+ // dominate unresolved gets/puts on that scope.
+ if (opcode != op_resolve_scope)
+ return true;
+
+ if (m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, InadequateCoverage)) {
+ // We've already exited so give up on getting better ResolveType information.
+ return true;
+ }
+
+ // We have not exited yet, so let's have the baseline get better ResolveType information for us.
+ // This type of code is often seen when we tier up in a loop but haven't executed the part
+ // of a function that comes after the loop.
+ return false;
+ }
+
+ case Dynamic:
+ return true;
+
+ case GlobalPropertyWithVarInjectionChecks:
+ case GlobalVarWithVarInjectionChecks:
+ case GlobalLexicalVarWithVarInjectionChecks:
+ case ClosureVarWithVarInjectionChecks:
+ return false;
+ }
+
+ ASSERT_NOT_REACHED();
+ return false;
+}
+
</ins><span class="cx"> GetByOffsetMethod ByteCodeParser::planLoad(const ObjectPropertyCondition& condition)
</span><span class="cx"> {
</span><span class="cx"> if (verbose)
</span><span class="lines">@@ -4284,6 +4341,12 @@
</span><span class="cx"> unsigned depth = currentInstruction[5].u.operand;
</span><span class="cx"> int scope = currentInstruction[2].u.operand;
</span><span class="cx">
</span><ins>+ if (needsDynamicLookup(resolveType, op_resolve_scope)) {
+ unsigned identifierNumber = m_inlineStackTop->m_identifierRemap[currentInstruction[3].u.operand];
+ set(VirtualRegister(dst), addToGraph(ResolveScope, OpInfo(identifierNumber), get(VirtualRegister(scope))));
+ NEXT_OPCODE(op_resolve_scope);
+ }
+
</ins><span class="cx"> // get_from_scope and put_to_scope depend on this watchpoint forcing OSR exit, so they don't add their own watchpoints.
</span><span class="cx"> if (needsVarInjectionChecks(resolveType))
</span><span class="cx"> addToGraph(VarInjectionWatchpoint);
</span><span class="lines">@@ -4370,6 +4433,12 @@
</span><span class="cx"> operand = reinterpret_cast<uintptr_t>(currentInstruction[6].u.pointer);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (needsDynamicLookup(resolveType, op_get_from_scope)) {
+ set(VirtualRegister(dst),
+ addToGraph(GetDynamicVar, OpInfo(identifierNumber), OpInfo(currentInstruction[4].u.operand), get(VirtualRegister(scope))));
+ NEXT_OPCODE(op_get_from_scope);
+ }
+
</ins><span class="cx"> UNUSED_PARAM(watchpoints); // We will use this in the future. For now we set it as a way of documenting the fact that that's what index 5 is in GlobalVar mode.
</span><span class="cx">
</span><span class="cx"> JSGlobalObject* globalObject = m_inlineStackTop->m_codeBlock->globalObject();
</span><span class="lines">@@ -4498,13 +4567,7 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> case UnresolvedProperty:
</span><del>- case UnresolvedPropertyWithVarInjectionChecks: {
- addToGraph(ForceOSRExit);
- Node* scopeNode = get(VirtualRegister(scope));
- addToGraph(Phantom, scopeNode);
- set(VirtualRegister(dst), addToGraph(JSConstant, OpInfo(m_constantUndefined)));
- break;
- }
</del><ins>+ case UnresolvedPropertyWithVarInjectionChecks:
</ins><span class="cx"> case ModuleVar:
</span><span class="cx"> case Dynamic:
</span><span class="cx"> RELEASE_ASSERT_NOT_REACHED();
</span><span class="lines">@@ -4541,6 +4604,12 @@
</span><span class="cx">
</span><span class="cx"> JSGlobalObject* globalObject = m_inlineStackTop->m_codeBlock->globalObject();
</span><span class="cx">
</span><ins>+ if (needsDynamicLookup(resolveType, op_put_to_scope)) {
+ ASSERT(identifierNumber != UINT_MAX);
+ addToGraph(PutDynamicVar, OpInfo(identifierNumber), OpInfo(currentInstruction[4].u.operand), get(VirtualRegister(scope)), get(VirtualRegister(value)));
+ NEXT_OPCODE(op_put_to_scope);
+ }
+
</ins><span class="cx"> switch (resolveType) {
</span><span class="cx"> case GlobalProperty:
</span><span class="cx"> case GlobalPropertyWithVarInjectionChecks: {
</span><span class="lines">@@ -4565,7 +4634,7 @@
</span><span class="cx"> case GlobalLexicalVarWithVarInjectionChecks:
</span><span class="cx"> case GlobalVar:
</span><span class="cx"> case GlobalVarWithVarInjectionChecks: {
</span><del>- if (getPutInfo.initializationMode() != Initialization && (resolveType == GlobalLexicalVar || resolveType == GlobalLexicalVarWithVarInjectionChecks)) {
</del><ins>+ if (!isInitialization(getPutInfo.initializationMode()) && (resolveType == GlobalLexicalVar || resolveType == GlobalLexicalVarWithVarInjectionChecks)) {
</ins><span class="cx"> SpeculatedType prediction = SpecEmpty;
</span><span class="cx"> Node* value = addToGraph(GetGlobalLexicalVariable, OpInfo(operand), OpInfo(prediction));
</span><span class="cx"> addToGraph(CheckNotEmpty, value);
</span><span class="lines">@@ -4601,14 +4670,6 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- case UnresolvedProperty:
- case UnresolvedPropertyWithVarInjectionChecks: {
- addToGraph(ForceOSRExit);
- Node* scopeNode = get(VirtualRegister(scope));
- addToGraph(Phantom, scopeNode);
- break;
- }
-
</del><span class="cx"> case ModuleVar:
</span><span class="cx"> // Need not to keep "scope" and "value" register values here by Phantom because
</span><span class="cx"> // they are not used in LLInt / baseline op_put_to_scope with ModuleVar.
</span><span class="lines">@@ -4616,6 +4677,8 @@
</span><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case Dynamic:
</span><ins>+ case UnresolvedProperty:
+ case UnresolvedPropertyWithVarInjectionChecks:
</ins><span class="cx"> RELEASE_ASSERT_NOT_REACHED();
</span><span class="cx"> break;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGCapabilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -101,6 +101,7 @@
</span><span class="cx"> CapabilityLevel capabilityLevel(OpcodeID opcodeID, CodeBlock* codeBlock, Instruction* pc)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(codeBlock); // This function does some bytecode parsing. Ordinarily bytecode parsing requires the owning CodeBlock. It's sort of strange that we don't use it here right now.
</span><ins>+ UNUSED_PARAM(pc);
</ins><span class="cx">
</span><span class="cx"> switch (opcodeID) {
</span><span class="cx"> case op_enter:
</span><span class="lines">@@ -229,25 +230,10 @@
</span><span class="cx"> case op_get_rest_length:
</span><span class="cx"> case op_log_shadow_chicken_prologue:
</span><span class="cx"> case op_log_shadow_chicken_tail:
</span><ins>+ case op_put_to_scope:
+ case op_resolve_scope:
</ins><span class="cx"> return CanCompileAndInline;
</span><span class="cx">
</span><del>- case op_put_to_scope: {
- ResolveType resolveType = GetPutInfo(pc[4].u.operand).resolveType();
- // If we're writing to a readonly property we emit a Dynamic put that
- // the DFG can't currently handle.
- if (resolveType == Dynamic)
- return CannotCompile;
- return CanCompileAndInline;
- }
-
- case op_resolve_scope: {
- // We don't compile 'catch' or 'with', so there's no point in compiling variable resolution within them.
- ResolveType resolveType = static_cast<ResolveType>(pc[4].u.operand);
- if (resolveType == Dynamic)
- return CannotCompile;
- return CanCompileAndInline;
- }
-
</del><span class="cx"> case op_new_regexp:
</span><span class="cx"> case op_switch_string: // Don't inline because we don't want to copy string tables in the concurrent JIT.
</span><span class="cx"> return CanCompile;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGClobberizeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGClobberize.h (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGClobberize.h        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/dfg/DFGClobberize.h        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -461,6 +461,9 @@
</span><span class="cx"> case In:
</span><span class="cx"> case ValueAdd:
</span><span class="cx"> case SetFunctionName:
</span><ins>+ case GetDynamicVar:
+ case PutDynamicVar:
+ case ResolveScope:
</ins><span class="cx"> read(World);
</span><span class="cx"> write(Heap);
</span><span class="cx"> return;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGDoesGCcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGDoesGC.cpp (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGDoesGC.cpp        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/dfg/DFGDoesGC.cpp        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -241,6 +241,9 @@
</span><span class="cx"> case CopyRest:
</span><span class="cx"> case LogShadowChickenPrologue:
</span><span class="cx"> case LogShadowChickenTail:
</span><ins>+ case GetDynamicVar:
+ case PutDynamicVar:
+ case ResolveScope:
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> case CreateActivation:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGFixupPhasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -1479,6 +1479,13 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ case ResolveScope:
+ case GetDynamicVar:
+ case PutDynamicVar: {
+ fixEdge<KnownCellUse>(node->child1());
+ break;
+ }
+
</ins><span class="cx"> #if !ASSERT_DISABLED
</span><span class="cx"> // Have these no-op cases here to ensure that nobody forgets to add handlers for new opcodes.
</span><span class="cx"> case SetArgument:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGNode.h (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGNode.h        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/dfg/DFGNode.h        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -876,6 +876,9 @@
</span><span class="cx"> case PutSetterById:
</span><span class="cx"> case PutGetterSetterById:
</span><span class="cx"> case DeleteById:
</span><ins>+ case GetDynamicVar:
+ case PutDynamicVar:
+ case ResolveScope:
</ins><span class="cx"> return true;
</span><span class="cx"> default:
</span><span class="cx"> return false;
</span><span class="lines">@@ -888,6 +891,23 @@
</span><span class="cx"> return m_opInfo;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ bool hasGetPutInfo()
+ {
+ switch (op()) {
+ case GetDynamicVar:
+ case PutDynamicVar:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ unsigned getPutInfo()
+ {
+ ASSERT(hasGetPutInfo());
+ return m_opInfo2;
+ }
+
</ins><span class="cx"> bool hasAccessorAttributes()
</span><span class="cx"> {
</span><span class="cx"> switch (op()) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGNodeTypeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGNodeType.h (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGNodeType.h        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/dfg/DFGNodeType.h        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -216,12 +216,15 @@
</span><span class="cx"> macro(GetTypedArrayByteOffset, NodeResultInt32) \
</span><span class="cx"> macro(GetScope, NodeResultJS) \
</span><span class="cx"> macro(SkipScope, NodeResultJS) \
</span><ins>+ macro(ResolveScope, NodeResultJS | NodeMustGenerate) \
</ins><span class="cx"> macro(GetGlobalObject, NodeResultJS) \
</span><span class="cx"> macro(GetClosureVar, NodeResultJS) \
</span><span class="cx"> macro(PutClosureVar, NodeMustGenerate) \
</span><span class="cx"> macro(GetGlobalVar, NodeResultJS) \
</span><span class="cx"> macro(GetGlobalLexicalVariable, NodeResultJS) \
</span><span class="cx"> macro(PutGlobalVariable, NodeMustGenerate) \
</span><ins>+ macro(GetDynamicVar, NodeResultJS | NodeMustGenerate) \
+ macro(PutDynamicVar, NodeMustGenerate) \
</ins><span class="cx"> macro(NotifyWrite, NodeMustGenerate) \
</span><span class="cx"> macro(VarInjectionWatchpoint, NodeMustGenerate) \
</span><span class="cx"> macro(GetRegExpObjectLastIndex, NodeResultJS) \
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGOperationscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -1525,6 +1525,78 @@
</span><span class="cx"> dataLog("\n");
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+JSCell* JIT_OPERATION operationResolveScope(ExecState* exec, JSScope* scope, UniquedStringImpl* impl)
+{
+ VM& vm = exec->vm();
+ NativeCallFrameTracer tracer(&vm, exec);
+
+ JSObject* resolvedScope = JSScope::resolve(exec, scope, Identifier::fromUid(exec, impl));
+ return resolvedScope;
+}
+
+EncodedJSValue JIT_OPERATION operationGetDynamicVar(ExecState* exec, JSObject* scope, UniquedStringImpl* impl, unsigned getPutInfoBits)
+{
+ VM& vm = exec->vm();
+ NativeCallFrameTracer tracer(&vm, exec);
+
+ const Identifier& ident = Identifier::fromUid(exec, impl);
+ GetPutInfo getPutInfo(getPutInfoBits);
+
+ PropertySlot slot(scope, PropertySlot::InternalMethodType::Get);
+ if (!scope->getPropertySlot(exec, ident, slot)) {
+ if (getPutInfo.resolveMode() == ThrowIfNotFound)
+ vm.throwException(exec, createUndefinedVariableError(exec, ident));
+ return JSValue::encode(jsUndefined());
+ }
+
+ if (scope->isGlobalLexicalEnvironment()) {
+ // When we can't statically prove we need a TDZ check, we must perform the check on the slow path.
+ JSValue result = slot.getValue(exec, ident);
+ if (result == jsTDZValue()) {
+ exec->vm().throwException(exec, createTDZError(exec));
+ return JSValue::encode(jsUndefined());
+ }
+ return JSValue::encode(result);
+ }
+
+ return JSValue::encode(slot.getValue(exec, ident));
+}
+
+void JIT_OPERATION operationPutDynamicVar(ExecState* exec, JSObject* scope, EncodedJSValue value, UniquedStringImpl* impl, unsigned getPutInfoBits)
+{
+ VM& vm = exec->vm();
+ NativeCallFrameTracer tracer(&vm, exec);
+
+ const Identifier& ident = Identifier::fromUid(exec, impl);
+ GetPutInfo getPutInfo(getPutInfoBits);
+ bool hasProperty = scope->hasProperty(exec, ident);
+ if (hasProperty
+ && scope->isGlobalLexicalEnvironment()
+ && !isInitialization(getPutInfo.initializationMode())) {
+ // When we can't statically prove we need a TDZ check, we must perform the check on the slow path.
+ PropertySlot slot(scope, PropertySlot::InternalMethodType::Get);
+ JSGlobalLexicalEnvironment::getOwnPropertySlot(scope, exec, ident, slot);
+ if (slot.getValue(exec, ident) == jsTDZValue()) {
+ exec->vm().throwException(exec, createTDZError(exec));
+ return;
+ }
+ }
+
+ if (getPutInfo.resolveMode() == ThrowIfNotFound && !hasProperty) {
+ exec->vm().throwException(exec, createUndefinedVariableError(exec, ident));
+ return;
+ }
+
+ CodeOrigin origin = exec->codeOrigin();
+ bool strictMode;
+ if (origin.inlineCallFrame)
+ strictMode = origin.inlineCallFrame->baselineCodeBlock->isStrictMode();
+ else
+ strictMode = exec->codeBlock()->isStrictMode();
+ PutPropertySlot slot(scope, strictMode, PutPropertySlot::UnknownContext, isInitialization(getPutInfo.initializationMode()));
+ scope->methodTable()->put(scope, exec, ident, JSValue::decode(value), slot);
+}
+
</ins><span class="cx"> extern "C" void JIT_OPERATION triggerReoptimizationNow(CodeBlock* codeBlock, OSRExitBase* exit)
</span><span class="cx"> {
</span><span class="cx"> // It's sort of preferable that we don't GC while in here. Anyways, doing so wouldn't
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGOperationsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGOperations.h (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGOperations.h        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/dfg/DFGOperations.h        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -151,6 +151,10 @@
</span><span class="cx"> int32_t JIT_OPERATION operationSizeOfVarargs(ExecState*, EncodedJSValue arguments, int32_t firstVarArgOffset);
</span><span class="cx"> void JIT_OPERATION operationLoadVarargs(ExecState*, int32_t firstElementDest, EncodedJSValue arguments, int32_t offset, int32_t length, int32_t mandatoryMinimum);
</span><span class="cx">
</span><ins>+JSCell* JIT_OPERATION operationResolveScope(ExecState*, JSScope*, UniquedStringImpl*);
+EncodedJSValue JIT_OPERATION operationGetDynamicVar(ExecState*, JSObject* scope, UniquedStringImpl*, unsigned);
+void JIT_OPERATION operationPutDynamicVar(ExecState*, JSObject* scope, EncodedJSValue, UniquedStringImpl*, unsigned);
+
</ins><span class="cx"> int64_t JIT_OPERATION operationConvertBoxedDoubleToInt52(EncodedJSValue);
</span><span class="cx"> int64_t JIT_OPERATION operationConvertDoubleToInt52(double);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGPredictionPropagationPhasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -204,6 +204,11 @@
</span><span class="cx"> changed |= setPrediction(node->getHeapPrediction());
</span><span class="cx"> break;
</span><span class="cx"> }
</span><ins>+
+ case GetDynamicVar: {
+ changed |= setPrediction(SpecBytecodeTop);
+ break;
+ }
</ins><span class="cx">
</span><span class="cx"> case GetGetterSetterByOffset:
</span><span class="cx"> case GetExecutable: {
</span><span class="lines">@@ -568,6 +573,11 @@
</span><span class="cx"> changed |= setPrediction(SpecObjectOther);
</span><span class="cx"> break;
</span><span class="cx"> }
</span><ins>+
+ case ResolveScope: {
+ changed |= setPrediction(SpecObjectOther);
+ break;
+ }
</ins><span class="cx">
</span><span class="cx"> case CreateThis:
</span><span class="cx"> case NewObject: {
</span><span class="lines">@@ -789,6 +799,7 @@
</span><span class="cx"> case ExitOK:
</span><span class="cx"> case LoadVarargs:
</span><span class="cx"> case CopyRest:
</span><ins>+ case PutDynamicVar:
</ins><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> // This gets ignored because it only pretends to produce a value.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSafeToExecuteh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -344,6 +344,9 @@
</span><span class="cx"> case GetRegExpObjectLastIndex:
</span><span class="cx"> case SetRegExpObjectLastIndex:
</span><span class="cx"> case RecordRegExpCachedResult:
</span><ins>+ case GetDynamicVar:
+ case PutDynamicVar:
+ case ResolveScope:
</ins><span class="cx"> return true;
</span><span class="cx">
</span><span class="cx"> case BottomValue:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJITcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -7807,6 +7807,58 @@
</span><span class="cx"> noResult(node);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void SpeculativeJIT::compileResolveScope(Node* node)
+{
+ SpeculateCellOperand scope(this, node->child1());
+ GPRReg scopeGPR = scope.gpr();
+ GPRFlushedCallResult result(this);
+ GPRReg resultGPR = result.gpr();
+ flushRegisters();
+ callOperation(operationResolveScope, resultGPR, scopeGPR, identifierUID(node->identifierNumber()));
+ m_jit.exceptionCheck();
+ cellResult(resultGPR, node);
+}
+
+void SpeculativeJIT::compileGetDynamicVar(Node* node)
+{
+ SpeculateCellOperand scope(this, node->child1());
+ GPRReg scopeGPR = scope.gpr();
+#if USE(JSVALUE64)
+ flushRegisters();
+ GPRFlushedCallResult result(this);
+ callOperation(operationGetDynamicVar, result.gpr(), scopeGPR, identifierUID(node->identifierNumber()), node->getPutInfo());
+ m_jit.exceptionCheck();
+ jsValueResult(result.gpr(), node);
+#else
+ flushRegisters();
+ GPRFlushedCallResult2 resultTag(this);
+ GPRFlushedCallResult resultPayload(this);
+ callOperation(operationGetDynamicVar, resultTag.gpr(), resultPayload.gpr(), scopeGPR, identifierUID(node->identifierNumber()), node->getPutInfo());
+ m_jit.exceptionCheck();
+ jsValueResult(resultTag.gpr(), resultPayload.gpr(), node);
+#endif
+}
+
+void SpeculativeJIT::compilePutDynamicVar(Node* node)
+{
+ SpeculateCellOperand scope(this, node->child1());
+ GPRReg scopeGPR = scope.gpr();
+ JSValueOperand value(this, node->child2());
+
+#if USE(JSVALUE64)
+ GPRReg valueGPR = value.gpr();
+ flushRegisters();
+ callOperation(operationPutDynamicVar, NoResult, scopeGPR, valueGPR, identifierUID(node->identifierNumber()), node->getPutInfo());
+#else
+ GPRReg tag = value.tagGPR();
+ GPRReg payload = value.payloadGPR();
+ flushRegisters();
+ callOperation(operationPutDynamicVar, NoResult, scopeGPR, tag, payload, identifierUID(node->identifierNumber()), node->getPutInfo());
+#endif
+ m_jit.exceptionCheck();
+ noResult(node);
+}
+
</ins><span class="cx"> void SpeculativeJIT::compilePutAccessorByVal(Node* node)
</span><span class="cx"> {
</span><span class="cx"> SpeculateCellOperand base(this, node->child1());
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJITh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -1250,7 +1250,24 @@
</span><span class="cx"> return appendCall(operation);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ JITCompiler::Call callOperation(C_JITOperation_EJscI operation, GPRReg result, GPRReg arg1, UniquedStringImpl* impl)
+ {
+ m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(impl));
+ return appendCallSetResult(operation, result);
+ }
+
+
</ins><span class="cx"> #if USE(JSVALUE64)
</span><ins>+ JITCompiler::Call callOperation(V_JITOperation_EOJIUi operation, GPRReg arg1, GPRReg arg2, UniquedStringImpl* impl, unsigned value)
+ {
+ m_jit.setupArgumentsWithExecState(arg1, arg2, TrustedImmPtr(impl), TrustedImm32(value));
+ return appendCall(operation);
+ }
+ JITCompiler::Call callOperation(J_JITOperation_EOIUi operation, GPRReg result, GPRReg arg1, UniquedStringImpl* impl, unsigned value)
+ {
+ m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(impl), TrustedImm32(value));
+ return appendCallSetResult(operation, result);
+ }
</ins><span class="cx"> JITCompiler::Call callOperation(J_JITOperation_E operation, GPRReg result)
</span><span class="cx"> {
</span><span class="cx"> m_jit.setupArgumentsExecState();
</span><span class="lines">@@ -1656,6 +1673,16 @@
</span><span class="cx"> #define SH4_32BIT_DUMMY_ARG
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+ JITCompiler::Call callOperation(V_JITOperation_EOJIUi operation, GPRReg arg1, GPRReg arg2Tag, GPRReg arg2Payload, UniquedStringImpl* impl, unsigned value)
+ {
+ m_jit.setupArgumentsWithExecState(arg1, arg2Payload, arg2Tag, TrustedImmPtr(impl), TrustedImm32(value));
+ return appendCall(operation);
+ }
+ JITCompiler::Call callOperation(J_JITOperation_EOIUi operation, GPRReg resultTag, GPRReg resultPayload, GPRReg arg1, UniquedStringImpl* impl, unsigned value)
+ {
+ m_jit.setupArgumentsWithExecState(arg1, TrustedImmPtr(impl), TrustedImm32(value));
+ return appendCallSetResult(operation, resultPayload, resultTag);
+ }
</ins><span class="cx"> JITCompiler::Call callOperation(D_JITOperation_G operation, FPRReg result, JSGlobalObject* globalObject)
</span><span class="cx"> {
</span><span class="cx"> m_jit.setupArguments(TrustedImmPtr(globalObject));
</span><span class="lines">@@ -2477,6 +2504,9 @@
</span><span class="cx"> void compileMaterializeNewObject(Node*);
</span><span class="cx"> void compileRecordRegExpCachedResult(Node*);
</span><span class="cx"> void compileCallObjectConstructor(Node*);
</span><ins>+ void compileResolveScope(Node*);
+ void compileGetDynamicVar(Node*);
+ void compilePutDynamicVar(Node*);
</ins><span class="cx">
</span><span class="cx"> void moveTrueTo(GPRReg);
</span><span class="cx"> void moveFalseTo(GPRReg);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJIT32_64cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -5048,6 +5048,21 @@
</span><span class="cx"> compileMaterializeNewObject(node);
</span><span class="cx"> break;
</span><span class="cx">
</span><ins>+ case PutDynamicVar: {
+ compilePutDynamicVar(node);
+ break;
+ }
+
+ case GetDynamicVar: {
+ compileGetDynamicVar(node);
+ break;
+ }
+
+ case ResolveScope: {
+ compileResolveScope(node);
+ break;
+ }
+
</ins><span class="cx"> case Unreachable:
</span><span class="cx"> RELEASE_ASSERT_NOT_REACHED();
</span><span class="cx"> break;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJIT64cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -4359,6 +4359,21 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ case PutDynamicVar: {
+ compilePutDynamicVar(node);
+ break;
+ }
+
+ case GetDynamicVar: {
+ compileGetDynamicVar(node);
+ break;
+ }
+
+ case ResolveScope: {
+ compileResolveScope(node);
+ break;
+ }
+
</ins><span class="cx"> case NotifyWrite: {
</span><span class="cx"> compileNotifyWrite(node);
</span><span class="cx"> break;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLCapabilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -236,6 +236,9 @@
</span><span class="cx"> case SetFunctionName:
</span><span class="cx"> case LogShadowChickenPrologue:
</span><span class="cx"> case LogShadowChickenTail:
</span><ins>+ case ResolveScope:
+ case GetDynamicVar:
+ case PutDynamicVar:
</ins><span class="cx"> // These are OK.
</span><span class="cx"> break;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLLowerDFGToB3cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -966,6 +966,15 @@
</span><span class="cx"> case RecordRegExpCachedResult:
</span><span class="cx"> compileRecordRegExpCachedResult();
</span><span class="cx"> break;
</span><ins>+ case ResolveScope:
+ compileResolveScope();
+ break;
+ case GetDynamicVar:
+ compileGetDynamicVar();
+ break;
+ case PutDynamicVar:
+ compilePutDynamicVar();
+ break;
</ins><span class="cx">
</span><span class="cx"> case PhantomLocal:
</span><span class="cx"> case LoopHint:
</span><span class="lines">@@ -7525,6 +7534,27 @@
</span><span class="cx">
</span><span class="cx"> DFG_CRASH(m_graph, m_node, "Bad use kinds");
</span><span class="cx"> }
</span><ins>+
+ void compileResolveScope()
+ {
+ UniquedStringImpl* uid = m_graph.identifiers()[m_node->identifierNumber()];
+ setJSValue(vmCall(m_out.intPtr, m_out.operation(operationResolveScope),
+ m_callFrame, lowCell(m_node->child1()), m_out.constIntPtr(uid)));
+ }
+
+ void compileGetDynamicVar()
+ {
+ UniquedStringImpl* uid = m_graph.identifiers()[m_node->identifierNumber()];
+ setJSValue(vmCall(m_out.int64, m_out.operation(operationGetDynamicVar),
+ m_callFrame, lowCell(m_node->child1()), m_out.constIntPtr(uid), m_out.constInt32(m_node->getPutInfo())));
+ }
+
+ void compilePutDynamicVar()
+ {
+ UniquedStringImpl* uid = m_graph.identifiers()[m_node->identifierNumber()];
+ setJSValue(vmCall(Void, m_out.operation(operationPutDynamicVar),
+ m_callFrame, lowCell(m_node->child1()), lowJSValue(m_node->child2()), m_out.constIntPtr(uid), m_out.constInt32(m_node->getPutInfo())));
+ }
</ins><span class="cx">
</span><span class="cx"> void compareEqObjectOrOtherToObject(Edge leftChild, Edge rightChild)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitCCallHelpersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/CCallHelpers.h (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/CCallHelpers.h        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/jit/CCallHelpers.h        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -324,6 +324,16 @@
</span><span class="cx"> addCallArgument(arg4);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImmPtr arg3, TrustedImm32 arg4)
+ {
+ resetCallArguments();
+ addCallArgument(GPRInfo::callFrameRegister);
+ addCallArgument(arg1);
+ addCallArgument(arg2);
+ addCallArgument(arg3);
+ addCallArgument(arg4);
+ }
+
</ins><span class="cx"> ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImm32 arg2, TrustedImmPtr arg3)
</span><span class="cx"> {
</span><span class="cx"> resetCallArguments();
</span><span class="lines">@@ -480,6 +490,26 @@
</span><span class="cx"> addCallArgument(arg5);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, TrustedImm32 arg3)
+ {
+ resetCallArguments();
+ addCallArgument(GPRInfo::callFrameRegister);
+ addCallArgument(arg1);
+ addCallArgument(arg2);
+ addCallArgument(arg3);
+ }
+
+ ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, TrustedImmPtr arg4, TrustedImm32 arg5)
+ {
+ resetCallArguments();
+ addCallArgument(GPRInfo::callFrameRegister);
+ addCallArgument(arg1);
+ addCallArgument(arg2);
+ addCallArgument(arg3);
+ addCallArgument(arg4);
+ addCallArgument(arg5);
+ }
+
</ins><span class="cx"> ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5)
</span><span class="cx"> {
</span><span class="cx"> resetCallArguments();
</span><span class="lines">@@ -1500,6 +1530,12 @@
</span><span class="cx"> setupArgumentsWithExecState(arg1, arg2, arg3);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImmPtr arg3, TrustedImm32 arg4)
+ {
+ poke(arg4, POKE_ARGUMENT_OFFSET);
+ setupArgumentsWithExecState(arg1, arg2, arg3);
+ }
+
</ins><span class="cx"> ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4)
</span><span class="cx"> {
</span><span class="cx"> poke(arg4, POKE_ARGUMENT_OFFSET);
</span><span class="lines">@@ -1736,6 +1772,13 @@
</span><span class="cx"> setupArgumentsWithExecState(arg1, arg2, arg3);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, TrustedImmPtr arg4, TrustedImm32 arg5)
+ {
+ poke(arg5, POKE_ARGUMENT_OFFSET + 1);
+ poke(arg4, POKE_ARGUMENT_OFFSET);
+ setupArgumentsWithExecState(arg1, arg2, arg3);
+ }
+
</ins><span class="cx"> ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImmPtr arg2, GPRReg arg3, GPRReg arg4)
</span><span class="cx"> {
</span><span class="cx"> poke(arg4, POKE_ARGUMENT_OFFSET);
</span><span class="lines">@@ -1963,6 +2006,14 @@
</span><span class="cx"> move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImmPtr arg3, TrustedImm32 arg4)
+ {
+ setupTwoStubArgsGPR<GPRInfo::argumentGPR1, GPRInfo::argumentGPR2>(arg1, arg2);
+ move(arg3, GPRInfo::argumentGPR3);
+ move(arg4, GPRInfo::argumentGPR4);
+ move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
+ }
+
</ins><span class="cx"> ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5)
</span><span class="cx"> {
</span><span class="cx"> setupThreeStubArgsGPR<GPRInfo::argumentGPR1, GPRInfo::argumentGPR4, GPRInfo::argumentGPR5>(arg1, arg4, arg5);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITOperationscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITOperations.cpp (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITOperations.cpp        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/jit/JITOperations.cpp        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -2045,7 +2045,7 @@
</span><span class="cx"> bool hasProperty = scope->hasProperty(exec, ident);
</span><span class="cx"> if (hasProperty
</span><span class="cx"> && scope->isGlobalLexicalEnvironment()
</span><del>- && getPutInfo.initializationMode() != Initialization) {
</del><ins>+ && !isInitialization(getPutInfo.initializationMode())) {
</ins><span class="cx"> // When we can't statically prove we need a TDZ check, we must perform the check on the slow path.
</span><span class="cx"> PropertySlot slot(scope, PropertySlot::InternalMethodType::Get);
</span><span class="cx"> JSGlobalLexicalEnvironment::getOwnPropertySlot(scope, exec, ident, slot);
</span><span class="lines">@@ -2060,7 +2060,7 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- PutPropertySlot slot(scope, codeBlock->isStrictMode(), PutPropertySlot::UnknownContext, getPutInfo.initializationMode() == Initialization);
</del><ins>+ PutPropertySlot slot(scope, codeBlock->isStrictMode(), PutPropertySlot::UnknownContext, isInitialization(getPutInfo.initializationMode()));
</ins><span class="cx"> scope->methodTable()->put(scope, exec, ident, value, slot);
</span><span class="cx">
</span><span class="cx"> if (exec->vm().exception())
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITOperationsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITOperations.h (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITOperations.h        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/jit/JITOperations.h        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -155,6 +155,7 @@
</span><span class="cx"> typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EZIcfZ)(ExecState*, int32_t, InlineCallFrame*, int32_t);
</span><span class="cx"> typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EZZ)(ExecState*, int32_t, int32_t);
</span><span class="cx"> typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EZSymtabJ)(ExecState*, int32_t, SymbolTable*, EncodedJSValue);
</span><ins>+typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EOIUi)(ExecState*, JSObject*, UniquedStringImpl*, uint32_t);
</ins><span class="cx"> typedef JSCell* JIT_OPERATION (*C_JITOperation_E)(ExecState*);
</span><span class="cx"> typedef JSCell* JIT_OPERATION (*C_JITOperation_EZ)(ExecState*, int32_t);
</span><span class="cx"> typedef JSCell* JIT_OPERATION (*C_JITOperation_EC)(ExecState*, JSCell*);
</span><span class="lines">@@ -186,6 +187,7 @@
</span><span class="cx"> typedef JSCell* JIT_OPERATION (*C_JITOperation_EStZ)(ExecState*, Structure*, int32_t);
</span><span class="cx"> typedef JSCell* JIT_OPERATION (*C_JITOperation_EStZZ)(ExecState*, Structure*, int32_t, int32_t);
</span><span class="cx"> typedef JSCell* JIT_OPERATION (*C_JITOperation_EZ)(ExecState*, int32_t);
</span><ins>+typedef JSCell* JIT_OPERATION (*C_JITOperation_EJscI)(ExecState*, JSScope*, UniquedStringImpl*);
</ins><span class="cx"> typedef double JIT_OPERATION (*D_JITOperation_D)(double);
</span><span class="cx"> typedef double JIT_OPERATION (*D_JITOperation_G)(JSGlobalObject*);
</span><span class="cx"> typedef double JIT_OPERATION (*D_JITOperation_DD)(double, double);
</span><span class="lines">@@ -253,6 +255,7 @@
</span><span class="cx"> typedef void JIT_OPERATION (*V_JITOperation_J)(EncodedJSValue);
</span><span class="cx"> typedef void JIT_OPERATION (*V_JITOperation_Z)(int32_t);
</span><span class="cx"> typedef void JIT_OPERATION (*V_JITOperation_ECRUiUi)(ExecState*, JSCell*, Register*, uint32_t, uint32_t);
</span><ins>+typedef void JIT_OPERATION (*V_JITOperation_EOJIUi)(ExecState*, JSObject*, EncodedJSValue, UniquedStringImpl*, uint32_t);
</ins><span class="cx"> typedef char* JIT_OPERATION (*P_JITOperation_E)(ExecState*);
</span><span class="cx"> typedef char* JIT_OPERATION (*P_JITOperation_EC)(ExecState*, JSCell*);
</span><span class="cx"> typedef char* JIT_OPERATION (*P_JITOperation_ECli)(ExecState*, CallLinkInfo*);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITPropertyAccesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -971,7 +971,7 @@
</span><span class="cx"> RELEASE_ASSERT(constantScope);
</span><span class="cx"> emitWriteBarrier(constantScope, value, ShouldFilterValue);
</span><span class="cx"> emitVarInjectionCheck(needsVarInjectionChecks(resolveType));
</span><del>- if (getPutInfo.initializationMode() != Initialization && (resolveType == GlobalLexicalVar || resolveType == GlobalLexicalVarWithVarInjectionChecks)) {
</del><ins>+ if (!isInitialization(getPutInfo.initializationMode()) && (resolveType == GlobalLexicalVar || resolveType == GlobalLexicalVarWithVarInjectionChecks)) {
</ins><span class="cx"> // We need to do a TDZ check here because we can't always prove we need to emit TDZ checks statically.
</span><span class="cx"> if (indirectLoadForOperand)
</span><span class="cx"> emitGetVarFromIndirectPointer(bitwise_cast<JSValue**>(operandSlot), regT0);
</span><span class="lines">@@ -1053,7 +1053,7 @@
</span><span class="cx"> linkCount++;
</span><span class="cx"> if (resolveType == GlobalProperty || resolveType == GlobalPropertyWithVarInjectionChecks)
</span><span class="cx"> linkCount++; // bad structure
</span><del>- if (getPutInfo.initializationMode() != Initialization && (resolveType == GlobalLexicalVar || resolveType == GlobalLexicalVarWithVarInjectionChecks)) // TDZ check.
</del><ins>+ if (!isInitialization(getPutInfo.initializationMode()) && (resolveType == GlobalLexicalVar || resolveType == GlobalLexicalVarWithVarInjectionChecks)) // TDZ check.
</ins><span class="cx"> linkCount++;
</span><span class="cx"> if (resolveType == UnresolvedProperty || resolveType == UnresolvedPropertyWithVarInjectionChecks) {
</span><span class="cx"> // GlobalProperty/GlobalPropertyWithVarInjectionsCheck
</span><span class="lines">@@ -1061,7 +1061,7 @@
</span><span class="cx"> linkCount++; // emitLoadWithStructureCheck
</span><span class="cx">
</span><span class="cx"> // GlobalLexicalVar
</span><del>- bool needsTDZCheck = getPutInfo.initializationMode() != Initialization;
</del><ins>+ bool needsTDZCheck = !isInitialization(getPutInfo.initializationMode());
</ins><span class="cx"> if (needsTDZCheck)
</span><span class="cx"> linkCount++;
</span><span class="cx"> linkCount++; // Notify write check.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITPropertyAccess32_64cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -1019,7 +1019,7 @@
</span><span class="cx"> RELEASE_ASSERT(constantScope);
</span><span class="cx"> emitWriteBarrier(constantScope, value, ShouldFilterValue);
</span><span class="cx"> emitVarInjectionCheck(needsVarInjectionChecks(resolveType));
</span><del>- if (getPutInfo.initializationMode() != Initialization && (resolveType == GlobalLexicalVar || resolveType == GlobalLexicalVarWithVarInjectionChecks)) {
</del><ins>+ if (!isInitialization(getPutInfo.initializationMode()) && (resolveType == GlobalLexicalVar || resolveType == GlobalLexicalVarWithVarInjectionChecks)) {
</ins><span class="cx"> // We need to do a TDZ check here because we can't always prove we need to emit TDZ checks statically.
</span><span class="cx"> if (indirectLoadForOperand)
</span><span class="cx"> emitGetVarFromIndirectPointer(bitwise_cast<JSValue**>(operandSlot), regT1, regT0);
</span><span class="lines">@@ -1097,14 +1097,14 @@
</span><span class="cx"> || resolveType == GlobalLexicalVar || resolveType == GlobalLexicalVarWithVarInjectionChecks)
</span><span class="cx"> && currentInstruction[5].u.watchpointSet->state() != IsInvalidated)
</span><span class="cx"> linkCount++;
</span><del>- if (getPutInfo.initializationMode() != Initialization && (resolveType == GlobalLexicalVar || resolveType == GlobalLexicalVarWithVarInjectionChecks)) // TDZ check.
</del><ins>+ if (!isInitialization(getPutInfo.initializationMode()) && (resolveType == GlobalLexicalVar || resolveType == GlobalLexicalVarWithVarInjectionChecks)) // TDZ check.
</ins><span class="cx"> linkCount++;
</span><span class="cx"> if (resolveType == UnresolvedProperty || resolveType == UnresolvedPropertyWithVarInjectionChecks) {
</span><span class="cx"> // GlobalProperty/GlobalPropertyWithVarInjectionsCheck
</span><span class="cx"> linkCount++; // emitLoadWithStructureCheck
</span><span class="cx">
</span><span class="cx"> // GlobalLexicalVar
</span><del>- bool needsTDZCheck = getPutInfo.initializationMode() != Initialization;
</del><ins>+ bool needsTDZCheck = !isInitialization(getPutInfo.initializationMode());
</ins><span class="cx"> if (needsTDZCheck)
</span><span class="cx"> linkCount++;
</span><span class="cx"> linkCount++; // Notify write check.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLLIntDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LLIntData.cpp (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LLIntData.cpp        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/llint/LLIntData.cpp        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -183,7 +183,7 @@
</span><span class="cx"> static_assert(GlobalLexicalVarWithVarInjectionChecks == 8, "LLInt assumes GlobalLexicalVarWithVarInjectionChecks ResultType is == 8");
</span><span class="cx"> static_assert(ClosureVarWithVarInjectionChecks == 9, "LLInt assumes ClosureVarWithVarInjectionChecks ResultType is == 9");
</span><span class="cx">
</span><del>- static_assert(InitializationMode::Initialization == 0, "LLInt assumes that InitializationMode::Initialization is 0");
</del><ins>+ static_assert(static_cast<unsigned>(InitializationMode::NotInitialization) == 2, "LLInt assumes that InitializationMode::NotInitialization is 0");
</ins><span class="cx">
</span><span class="cx"> STATIC_ASSERT(GetPutInfo::typeBits == 0x3ff);
</span><span class="cx"> STATIC_ASSERT(GetPutInfo::initializationShift == 10);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLLIntSlowPathscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -1483,7 +1483,7 @@
</span><span class="cx"> bool hasProperty = scope->hasProperty(exec, ident);
</span><span class="cx"> if (hasProperty
</span><span class="cx"> && scope->isGlobalLexicalEnvironment()
</span><del>- && getPutInfo.initializationMode() != Initialization) {
</del><ins>+ && !isInitialization(getPutInfo.initializationMode())) {
</ins><span class="cx"> // When we can't statically prove we need a TDZ check, we must perform the check on the slow path.
</span><span class="cx"> PropertySlot slot(scope, PropertySlot::InternalMethodType::Get);
</span><span class="cx"> JSGlobalLexicalEnvironment::getOwnPropertySlot(scope, exec, ident, slot);
</span><span class="lines">@@ -1494,7 +1494,7 @@
</span><span class="cx"> if (getPutInfo.resolveMode() == ThrowIfNotFound && !hasProperty)
</span><span class="cx"> LLINT_THROW(createUndefinedVariableError(exec, ident));
</span><span class="cx">
</span><del>- PutPropertySlot slot(scope, codeBlock->isStrictMode(), PutPropertySlot::UnknownContext, getPutInfo.initializationMode() == Initialization);
</del><ins>+ PutPropertySlot slot(scope, codeBlock->isStrictMode(), PutPropertySlot::UnknownContext, isInitialization(getPutInfo.initializationMode()));
</ins><span class="cx"> scope->methodTable()->put(scope, exec, ident, value, slot);
</span><span class="cx">
</span><span class="cx"> CommonSlowPaths::tryCachePutToScopeGlobal(exec, codeBlock, pc, scope, getPutInfo, slot, ident);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLowLevelInterpreterasm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -367,7 +367,7 @@
</span><span class="cx"> const ResolveTypeMask = 0x3ff
</span><span class="cx"> const InitializationModeMask = 0xffc00
</span><span class="cx"> const InitializationModeShift = 10
</span><del>-const Initialization = 0
</del><ins>+const NotInitialization = 2
</ins><span class="cx">
</span><span class="cx"> const MarkedBlockSize = 16 * 1024
</span><span class="cx"> const MarkedBlockMask = ~(MarkedBlockSize - 1)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLowLevelInterpreter64asm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -2109,7 +2109,7 @@
</span><span class="cx"> loadisFromInstruction(4, t0)
</span><span class="cx"> andi InitializationModeMask, t0
</span><span class="cx"> rshifti InitializationModeShift, t0
</span><del>- bieq t0, Initialization, .noNeedForTDZCheck
</del><ins>+ bineq t0, NotInitialization, .noNeedForTDZCheck
</ins><span class="cx"> loadpFromInstruction(6, t0)
</span><span class="cx"> loadq [t0], t0
</span><span class="cx"> bqeq t0, ValueEmpty, .pDynamic
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeGetPutInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/GetPutInfo.h (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/GetPutInfo.h        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/runtime/GetPutInfo.h        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -65,10 +65,11 @@
</span><span class="cx"> Dynamic
</span><span class="cx"> };
</span><span class="cx">
</span><del>-enum InitializationMode {
- Initialization, // "let x = 20;"
- NotInitialization // "x = 20;"
-};
</del><ins>+enum class InitializationMode : unsigned {
+ Initialization, // "let x = 20;"
+ ConstInitialization, // "const x = 20;"
+ NotInitialization // "x = 20;"
+};
</ins><span class="cx">
</span><span class="cx"> ALWAYS_INLINE const char* resolveModeName(ResolveMode resolveMode)
</span><span class="cx"> {
</span><span class="lines">@@ -103,11 +104,24 @@
</span><span class="cx"> {
</span><span class="cx"> static const char* const names[] = {
</span><span class="cx"> "Initialization",
</span><ins>+ "ConstInitialization",
</ins><span class="cx"> "NotInitialization"
</span><span class="cx"> };
</span><del>- return names[initializationMode];
</del><ins>+ return names[static_cast<unsigned>(initializationMode)];
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ALWAYS_INLINE bool isInitialization(InitializationMode initializationMode)
+{
+ switch (initializationMode) {
+ case InitializationMode::Initialization:
+ case InitializationMode::ConstInitialization:
+ return true;
+ case InitializationMode::NotInitialization:
+ return false;
+ }
+ ASSERT_NOT_REACHED();
+ return false;
+}
</ins><span class="cx">
</span><span class="cx"> ALWAYS_INLINE ResolveType makeType(ResolveType type, bool needsVarInjectionChecks)
</span><span class="cx"> {
</span><span class="lines">@@ -198,7 +212,7 @@
</span><span class="cx"> static_assert((modeBits & initializationBits & typeBits) == 0x0, "There should be no intersection between ResolveMode ResolveType and InitializationMode");
</span><span class="cx">
</span><span class="cx"> GetPutInfo(ResolveMode resolveMode, ResolveType resolveType, InitializationMode initializationMode)
</span><del>- : m_operand((resolveMode << modeShift) | (initializationMode << initializationShift) | resolveType)
</del><ins>+ : m_operand((resolveMode << modeShift) | (static_cast<unsigned>(initializationMode) << initializationShift) | resolveType)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSScopecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSScope.cpp (199698 => 199699)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSScope.cpp        2016-04-19 00:25:12 UTC (rev 199698)
+++ trunk/Source/JavaScriptCore/runtime/JSScope.cpp        2016-04-19 01:38:30 UTC (rev 199699)
</span><span class="lines">@@ -92,13 +92,13 @@
</span><span class="cx"> JSGlobalLexicalEnvironment* globalLexicalEnvironment = jsCast<JSGlobalLexicalEnvironment*>(scope);
</span><span class="cx"> SymbolTableEntry entry = globalLexicalEnvironment->symbolTable()->get(ident.impl());
</span><span class="cx"> if (!entry.isNull()) {
</span><del>- if (getOrPut == Put && entry.isReadOnly() && initializationMode != Initialization) {
</del><ins>+ if (getOrPut == Put && entry.isReadOnly() && !isInitialization(initializationMode)) {
</ins><span class="cx"> // We know the property will be at global lexical environment, but we don't know how to cache it.
</span><span class="cx"> op = ResolveOp(Dynamic, 0, 0, 0, 0, 0);
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // We can try to force const Initialization to always go down the fast path. It is provably impossible to construct
</del><ins>+ // We can force const Initialization to always go down the fast path. It is provably impossible to construct
</ins><span class="cx"> // a program that needs a var injection check here. You can convince yourself of this as follows:
</span><span class="cx"> // Any other let/const/class would be a duplicate of this in the global scope, so we would never get here in that situation.
</span><span class="cx"> // Also, if we had an eval in the global scope that defined a const, it would also be a duplicate of this const, and so it would
</span><span class="lines">@@ -106,7 +106,7 @@
</span><span class="cx"> // we will never have a Dynamic ResolveType here because if we were inside a "with" statement, that would mean the "const" definition
</span><span class="cx"> // isn't a global, it would be a local to the "with" block.
</span><span class="cx"> // We still need to make the slow path correct for when we need to fire a watchpoint.
</span><del>- ResolveType resolveType = initializationMode == Initialization ? GlobalLexicalVar : makeType(GlobalLexicalVar, needsVarInjectionChecks);
</del><ins>+ ResolveType resolveType = initializationMode == InitializationMode::ConstInitialization ? GlobalLexicalVar : makeType(GlobalLexicalVar, needsVarInjectionChecks);
</ins><span class="cx"> op = ResolveOp(
</span><span class="cx"> resolveType, depth, 0, 0, entry.watchpointSet(),
</span><span class="cx"> reinterpret_cast<uintptr_t>(globalLexicalEnvironment->variableAt(entry.scopeOffset()).slot()));
</span></span></pre>
</div>
</div>
</body>
</html>