<!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>[179538] 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/179538">179538</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2015-02-02 21:20:59 -0800 (Mon, 02 Feb 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>arguments[-1] should have well-defined behavior
https://bugs.webkit.org/show_bug.cgi?id=141183
Reviewed by Mark Lam.
According to JSC's internal argument numbering, 0 is "this" and 1 is the first argument.
In the "arguments[i]" expression, "this" is not accessible and i = 0 refers to the first
argument. Previously we handled the bounds check in "arguments[i]" - where "arguments" is
statically known to be the current function's arguments object - as follows:
add 1, i
branchAboveOrEqual i, callFrame.ArgumentCount, slowPath
The problem with this is that if i = -1, this passes the test, and we end up accessing
what would be the "this" argument slot. That's wrong, since we should really be bottoming
out in arguments["-1"], which is usually undefined but could be anything. It's even worse
if the function is inlined or if we're in a constructor - in that case the "this" slot
could be garbage.
It turns out that we had this bug in all of our engines.
This fixes the issue by changing the algorithm to:
load32 callFrame.ArgumentCount, tmp
sub 1, tmp
branchAboveOrEqual i, tmp, slowPath
In some engines, we would have used the modified "i" (the one that had 1 added to it) for
the subsequent argument load; since we don't do this anymore I also had to change some of
the offsets on the BaseIndex arguments load.
This also includes tests that are written in such a way as to get coverage on LLInt and
Baseline JIT (get-my-argument-by-val-wrap-around-no-warm-up), DFG and FTL
(get-my-argument-by-val-wrap-around), and DFG when we're being paranoid about the user
overwriting the "arguments" variable (get-my-argument-by-val-safe-wrap-around). This also
includes off-by-1 out-of-bounds tests for each of these cases, since in the process of
writing the patch I broke the arguments[arguments.length] case in the DFG and didn't see
any test failures.
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileGetMyArgumentByVal):
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::offsetOfArguments):
(JSC::AssemblyHelpers::offsetOfArgumentsIncludingThis): Deleted.
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_get_argument_by_val):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_get_argument_by_val):
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* tests/stress/get-my-argument-by-val-out-of-bounds-no-warm-up.js: Added.
(foo):
* tests/stress/get-my-argument-by-val-out-of-bounds.js: Added.
(foo):
* tests/stress/get-my-argument-by-val-safe-out-of-bounds.js: Added.
(foo):
* tests/stress/get-my-argument-by-val-safe-wrap-around.js: Added.
(foo):
* tests/stress/get-my-argument-by-val-wrap-around-no-warm-up.js: Added.
(foo):
* tests/stress/get-my-argument-by-val-wrap-around.js: Added.
(foo):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</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="#trunkSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp">trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitAssemblyHelpersh">trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITOpcodescpp">trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITOpcodes32_64cpp">trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorellintLowLevelInterpreterasm">trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm</a></li>
<li><a href="#trunkSourceJavaScriptCorellintLowLevelInterpreter32_64asm">trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm</a></li>
<li><a href="#trunkSourceJavaScriptCorellintLowLevelInterpreter64asm">trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoretestsstressgetmyargumentbyvaloutofboundsnowarmupjs">trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-out-of-bounds-no-warm-up.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressgetmyargumentbyvaloutofboundsjs">trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-out-of-bounds.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressgetmyargumentbyvalsafeoutofboundsjs">trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-safe-out-of-bounds.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressgetmyargumentbyvalsafewraparoundjs">trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-safe-wrap-around.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressgetmyargumentbyvalwraparoundnowarmupjs">trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-wrap-around-no-warm-up.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressgetmyargumentbyvalwraparoundjs">trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-wrap-around.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (179537 => 179538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-02-03 05:06:45 UTC (rev 179537)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-02-03 05:20:59 UTC (rev 179538)
</span><span class="lines">@@ -1,5 +1,75 @@
</span><span class="cx"> 2015-02-02 Filip Pizlo <fpizlo@apple.com>
</span><span class="cx">
</span><ins>+ arguments[-1] should have well-defined behavior
+ https://bugs.webkit.org/show_bug.cgi?id=141183
+
+ Reviewed by Mark Lam.
+
+ According to JSC's internal argument numbering, 0 is "this" and 1 is the first argument.
+ In the "arguments[i]" expression, "this" is not accessible and i = 0 refers to the first
+ argument. Previously we handled the bounds check in "arguments[i]" - where "arguments" is
+ statically known to be the current function's arguments object - as follows:
+
+ add 1, i
+ branchAboveOrEqual i, callFrame.ArgumentCount, slowPath
+
+ The problem with this is that if i = -1, this passes the test, and we end up accessing
+ what would be the "this" argument slot. That's wrong, since we should really be bottoming
+ out in arguments["-1"], which is usually undefined but could be anything. It's even worse
+ if the function is inlined or if we're in a constructor - in that case the "this" slot
+ could be garbage.
+
+ It turns out that we had this bug in all of our engines.
+
+ This fixes the issue by changing the algorithm to:
+
+ load32 callFrame.ArgumentCount, tmp
+ sub 1, tmp
+ branchAboveOrEqual i, tmp, slowPath
+
+ In some engines, we would have used the modified "i" (the one that had 1 added to it) for
+ the subsequent argument load; since we don't do this anymore I also had to change some of
+ the offsets on the BaseIndex arguments load.
+
+ This also includes tests that are written in such a way as to get coverage on LLInt and
+ Baseline JIT (get-my-argument-by-val-wrap-around-no-warm-up), DFG and FTL
+ (get-my-argument-by-val-wrap-around), and DFG when we're being paranoid about the user
+ overwriting the "arguments" variable (get-my-argument-by-val-safe-wrap-around). This also
+ includes off-by-1 out-of-bounds tests for each of these cases, since in the process of
+ writing the patch I broke the arguments[arguments.length] case in the DFG and didn't see
+ any test failures.
+
+ * dfg/DFGSpeculativeJIT32_64.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * dfg/DFGSpeculativeJIT64.cpp:
+ (JSC::DFG::SpeculativeJIT::compile):
+ * ftl/FTLLowerDFGToLLVM.cpp:
+ (JSC::FTL::LowerDFGToLLVM::compileGetMyArgumentByVal):
+ * jit/AssemblyHelpers.h:
+ (JSC::AssemblyHelpers::offsetOfArguments):
+ (JSC::AssemblyHelpers::offsetOfArgumentsIncludingThis): Deleted.
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::emit_op_get_argument_by_val):
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::emit_op_get_argument_by_val):
+ * llint/LowLevelInterpreter.asm:
+ * llint/LowLevelInterpreter32_64.asm:
+ * llint/LowLevelInterpreter64.asm:
+ * tests/stress/get-my-argument-by-val-out-of-bounds-no-warm-up.js: Added.
+ (foo):
+ * tests/stress/get-my-argument-by-val-out-of-bounds.js: Added.
+ (foo):
+ * tests/stress/get-my-argument-by-val-safe-out-of-bounds.js: Added.
+ (foo):
+ * tests/stress/get-my-argument-by-val-safe-wrap-around.js: Added.
+ (foo):
+ * tests/stress/get-my-argument-by-val-wrap-around-no-warm-up.js: Added.
+ (foo):
+ * tests/stress/get-my-argument-by-val-wrap-around.js: Added.
+ (foo):
+
+2015-02-02 Filip Pizlo <fpizlo@apple.com>
+
</ins><span class="cx"> MultiGetByOffset should be marked NodeMustGenerate
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=140137
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJIT32_64cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp (179537 => 179538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp        2015-02-03 05:06:45 UTC (rev 179537)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp        2015-02-03 05:20:59 UTC (rev 179538)
</span><span class="lines">@@ -4347,22 +4347,19 @@
</span><span class="cx"> TrustedImm32(JSValue::EmptyValueTag)));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- m_jit.add32(TrustedImm32(1), indexGPR, resultPayloadGPR);
-
</del><span class="cx"> if (node->origin.semantic.inlineCallFrame) {
</span><span class="cx"> speculationCheck(
</span><span class="cx"> Uncountable, JSValueRegs(), 0,
</span><span class="cx"> m_jit.branch32(
</span><span class="cx"> JITCompiler::AboveOrEqual,
</span><del>- resultPayloadGPR,
- Imm32(node->origin.semantic.inlineCallFrame->arguments.size())));
</del><ins>+ indexGPR,
+ Imm32(node->origin.semantic.inlineCallFrame->arguments.size() - 1)));
</ins><span class="cx"> } else {
</span><ins>+ m_jit.load32(JITCompiler::payloadFor(JSStack::ArgumentCount), resultPayloadGPR);
+ m_jit.sub32(TrustedImm32(1), resultPayloadGPR);
</ins><span class="cx"> speculationCheck(
</span><span class="cx"> Uncountable, JSValueRegs(), 0,
</span><del>- m_jit.branch32(
- JITCompiler::AboveOrEqual,
- resultPayloadGPR,
- JITCompiler::payloadFor(JSStack::ArgumentCount)));
</del><ins>+ m_jit.branch32(JITCompiler::AboveOrEqual, indexGPR, resultPayloadGPR));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> JITCompiler::JumpList slowArgument;
</span><span class="lines">@@ -4399,13 +4396,13 @@
</span><span class="cx">
</span><span class="cx"> m_jit.load32(
</span><span class="cx"> JITCompiler::BaseIndex(
</span><del>- GPRInfo::callFrameRegister, resultPayloadGPR, JITCompiler::TimesEight,
- m_jit.offsetOfArgumentsIncludingThis(node->origin.semantic) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag)),
</del><ins>+ GPRInfo::callFrameRegister, indexGPR, JITCompiler::TimesEight,
+ m_jit.offsetOfArguments(node->origin.semantic) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag)),
</ins><span class="cx"> resultTagGPR);
</span><span class="cx"> m_jit.load32(
</span><span class="cx"> JITCompiler::BaseIndex(
</span><del>- GPRInfo::callFrameRegister, resultPayloadGPR, JITCompiler::TimesEight,
- m_jit.offsetOfArgumentsIncludingThis(node->origin.semantic) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload)),
</del><ins>+ GPRInfo::callFrameRegister, indexGPR, JITCompiler::TimesEight,
+ m_jit.offsetOfArguments(node->origin.semantic) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload)),
</ins><span class="cx"> resultPayloadGPR);
</span><span class="cx">
</span><span class="cx"> slowArgument.link(&m_jit);
</span><span class="lines">@@ -4427,19 +4424,17 @@
</span><span class="cx"> JITCompiler::tagFor(m_jit.graph().machineArgumentsRegisterFor(node->origin.semantic)),
</span><span class="cx"> TrustedImm32(JSValue::EmptyValueTag)));
</span><span class="cx">
</span><del>- m_jit.add32(TrustedImm32(1), indexGPR, resultPayloadGPR);
</del><span class="cx"> if (node->origin.semantic.inlineCallFrame) {
</span><span class="cx"> slowPath.append(
</span><span class="cx"> m_jit.branch32(
</span><span class="cx"> JITCompiler::AboveOrEqual,
</span><del>- resultPayloadGPR,
- Imm32(node->origin.semantic.inlineCallFrame->arguments.size())));
</del><ins>+ indexGPR,
+ Imm32(node->origin.semantic.inlineCallFrame->arguments.size() - 1)));
</ins><span class="cx"> } else {
</span><ins>+ m_jit.load32(JITCompiler::payloadFor(JSStack::ArgumentCount), resultPayloadGPR);
+ m_jit.sub32(TrustedImm32(1), resultPayloadGPR);
</ins><span class="cx"> slowPath.append(
</span><del>- m_jit.branch32(
- JITCompiler::AboveOrEqual,
- resultPayloadGPR,
- JITCompiler::payloadFor(JSStack::ArgumentCount)));
</del><ins>+ m_jit.branch32(JITCompiler::AboveOrEqual, indexGPR, resultPayloadGPR));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> JITCompiler::JumpList slowArgument;
</span><span class="lines">@@ -4475,13 +4470,13 @@
</span><span class="cx">
</span><span class="cx"> m_jit.load32(
</span><span class="cx"> JITCompiler::BaseIndex(
</span><del>- GPRInfo::callFrameRegister, resultPayloadGPR, JITCompiler::TimesEight,
- m_jit.offsetOfArgumentsIncludingThis(node->origin.semantic) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag)),
</del><ins>+ GPRInfo::callFrameRegister, indexGPR, JITCompiler::TimesEight,
+ m_jit.offsetOfArguments(node->origin.semantic) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag)),
</ins><span class="cx"> resultTagGPR);
</span><span class="cx"> m_jit.load32(
</span><span class="cx"> JITCompiler::BaseIndex(
</span><del>- GPRInfo::callFrameRegister, resultPayloadGPR, JITCompiler::TimesEight,
- m_jit.offsetOfArgumentsIncludingThis(node->origin.semantic) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload)),
</del><ins>+ GPRInfo::callFrameRegister, indexGPR, JITCompiler::TimesEight,
+ m_jit.offsetOfArguments(node->origin.semantic) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload)),
</ins><span class="cx"> resultPayloadGPR);
</span><span class="cx">
</span><span class="cx"> if (node->origin.semantic.inlineCallFrame) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJIT64cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp (179537 => 179538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp        2015-02-03 05:06:45 UTC (rev 179537)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp        2015-02-03 05:20:59 UTC (rev 179538)
</span><span class="lines">@@ -4394,21 +4394,19 @@
</span><span class="cx"> m_jit.graph().machineArgumentsRegisterFor(node->origin.semantic))));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- m_jit.add32(TrustedImm32(1), indexGPR, resultGPR);
</del><span class="cx"> if (node->origin.semantic.inlineCallFrame) {
</span><span class="cx"> speculationCheck(
</span><span class="cx"> Uncountable, JSValueRegs(), 0,
</span><span class="cx"> m_jit.branch32(
</span><span class="cx"> JITCompiler::AboveOrEqual,
</span><del>- resultGPR,
- Imm32(node->origin.semantic.inlineCallFrame->arguments.size())));
</del><ins>+ indexGPR,
+ Imm32(node->origin.semantic.inlineCallFrame->arguments.size() - 1)));
</ins><span class="cx"> } else {
</span><ins>+ m_jit.load32(JITCompiler::payloadFor(JSStack::ArgumentCount), resultGPR);
+ m_jit.sub32(TrustedImm32(1), resultGPR);
</ins><span class="cx"> speculationCheck(
</span><span class="cx"> Uncountable, JSValueRegs(), 0,
</span><del>- m_jit.branch32(
- JITCompiler::AboveOrEqual,
- resultGPR,
- JITCompiler::payloadFor(JSStack::ArgumentCount)));
</del><ins>+ m_jit.branch32(JITCompiler::AboveOrEqual, indexGPR, resultGPR));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> JITCompiler::JumpList slowArgument;
</span><span class="lines">@@ -4438,11 +4436,9 @@
</span><span class="cx"> }
</span><span class="cx"> slowArgumentOutOfBounds.link(&m_jit);
</span><span class="cx">
</span><del>- m_jit.signExtend32ToPtr(resultGPR, resultGPR);
-
</del><span class="cx"> m_jit.load64(
</span><span class="cx"> JITCompiler::BaseIndex(
</span><del>- GPRInfo::callFrameRegister, resultGPR, JITCompiler::TimesEight, m_jit.offsetOfArgumentsIncludingThis(node->origin.semantic)),
</del><ins>+ GPRInfo::callFrameRegister, indexGPR, JITCompiler::TimesEight, m_jit.offsetOfArguments(node->origin.semantic)),
</ins><span class="cx"> resultGPR);
</span><span class="cx">
</span><span class="cx"> slowArgument.link(&m_jit);
</span><span class="lines">@@ -4463,19 +4459,17 @@
</span><span class="cx"> JITCompiler::addressFor(
</span><span class="cx"> m_jit.graph().machineArgumentsRegisterFor(node->origin.semantic))));
</span><span class="cx">
</span><del>- m_jit.add32(TrustedImm32(1), indexGPR, resultGPR);
</del><span class="cx"> if (node->origin.semantic.inlineCallFrame) {
</span><span class="cx"> slowPath.append(
</span><span class="cx"> m_jit.branch32(
</span><span class="cx"> JITCompiler::AboveOrEqual,
</span><span class="cx"> resultGPR,
</span><del>- Imm32(node->origin.semantic.inlineCallFrame->arguments.size())));
</del><ins>+ Imm32(node->origin.semantic.inlineCallFrame->arguments.size() - 1)));
</ins><span class="cx"> } else {
</span><ins>+ m_jit.load32(JITCompiler::payloadFor(JSStack::ArgumentCount), resultGPR);
+ m_jit.sub32(TrustedImm32(1), resultGPR);
</ins><span class="cx"> slowPath.append(
</span><del>- m_jit.branch32(
- JITCompiler::AboveOrEqual,
- resultGPR,
- JITCompiler::payloadFor(JSStack::ArgumentCount)));
</del><ins>+ m_jit.branch32(JITCompiler::AboveOrEqual, indexGPR, resultGPR));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> JITCompiler::JumpList slowArgument;
</span><span class="lines">@@ -4505,11 +4499,9 @@
</span><span class="cx"> }
</span><span class="cx"> slowArgumentOutOfBounds.link(&m_jit);
</span><span class="cx">
</span><del>- m_jit.signExtend32ToPtr(resultGPR, resultGPR);
-
</del><span class="cx"> m_jit.load64(
</span><span class="cx"> JITCompiler::BaseIndex(
</span><del>- GPRInfo::callFrameRegister, resultGPR, JITCompiler::TimesEight, m_jit.offsetOfArgumentsIncludingThis(node->origin.semantic)),
</del><ins>+ GPRInfo::callFrameRegister, indexGPR, JITCompiler::TimesEight, m_jit.offsetOfArguments(node->origin.semantic)),
</ins><span class="cx"> resultGPR);
</span><span class="cx">
</span><span class="cx"> if (node->origin.semantic.inlineCallFrame) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp (179537 => 179538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2015-02-03 05:06:45 UTC (rev 179537)
+++ trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2015-02-03 05:20:59 UTC (rev 179538)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -1997,16 +1997,15 @@
</span><span class="cx">
</span><span class="cx"> CodeOrigin codeOrigin = m_node->origin.semantic;
</span><span class="cx">
</span><del>- LValue zeroBasedIndex = lowInt32(m_node->child1());
- LValue oneBasedIndex = m_out.add(zeroBasedIndex, m_out.int32One);
</del><ins>+ LValue index = lowInt32(m_node->child1());
</ins><span class="cx">
</span><span class="cx"> LValue limit;
</span><span class="cx"> if (codeOrigin.inlineCallFrame)
</span><del>- limit = m_out.constInt32(codeOrigin.inlineCallFrame->arguments.size());
</del><ins>+ limit = m_out.constInt32(codeOrigin.inlineCallFrame->arguments.size() - 1);
</ins><span class="cx"> else
</span><del>- limit = m_out.load32(payloadFor(JSStack::ArgumentCount));
</del><ins>+ limit = m_out.sub(m_out.load32(payloadFor(JSStack::ArgumentCount)), m_out.int32One);
</ins><span class="cx">
</span><del>- speculate(Uncountable, noValue(), 0, m_out.aboveOrEqual(oneBasedIndex, limit));
</del><ins>+ speculate(Uncountable, noValue(), 0, m_out.aboveOrEqual(index, limit));
</ins><span class="cx">
</span><span class="cx"> SymbolTable* symbolTable = m_graph.baselineCodeBlockFor(codeOrigin)->symbolTable();
</span><span class="cx"> if (symbolTable->slowArguments()) {
</span><span class="lines">@@ -2032,7 +2031,7 @@
</span><span class="cx"> base = addressFor(virtualRegisterForArgument(1));
</span><span class="cx">
</span><span class="cx"> LValue pointer = m_out.baseIndex(
</span><del>- base.value(), m_out.zeroExt(zeroBasedIndex, m_out.intPtr), ScaleEight);
</del><ins>+ base.value(), m_out.zeroExt(index, m_out.intPtr), ScaleEight);
</ins><span class="cx"> setJSValue(m_out.load64(TypedPointer(m_heaps.variables.atAnyIndex(), pointer)));
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitAssemblyHelpersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h (179537 => 179538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h        2015-02-03 05:06:45 UTC (rev 179537)
+++ trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h        2015-02-03 05:20:59 UTC (rev 179538)
</span><span class="lines">@@ -603,22 +603,22 @@
</span><span class="cx"> return codeOrigin.inlineCallFrame->stackOffset * sizeof(Register);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- int offsetOfArgumentsIncludingThis(InlineCallFrame* inlineCallFrame)
</del><ins>+ int offsetOfArguments(InlineCallFrame* inlineCallFrame)
</ins><span class="cx"> {
</span><span class="cx"> if (!inlineCallFrame)
</span><del>- return CallFrame::argumentOffsetIncludingThis(0) * sizeof(Register);
</del><ins>+ return CallFrame::argumentOffset(0) * sizeof(Register);
</ins><span class="cx"> if (inlineCallFrame->arguments.size() <= 1)
</span><span class="cx"> return 0;
</span><span class="cx"> ValueRecovery recovery = inlineCallFrame->arguments[1];
</span><span class="cx"> RELEASE_ASSERT(recovery.technique() == DisplacedInJSStack);
</span><del>- return (recovery.virtualRegister().offset() - 1) * sizeof(Register);
</del><ins>+ return recovery.virtualRegister().offset() * sizeof(Register);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- int offsetOfArgumentsIncludingThis(const CodeOrigin& codeOrigin)
</del><ins>+ int offsetOfArguments(const CodeOrigin& codeOrigin)
</ins><span class="cx"> {
</span><del>- return offsetOfArgumentsIncludingThis(codeOrigin.inlineCallFrame);
</del><ins>+ return offsetOfArguments(codeOrigin.inlineCallFrame);
</ins><span class="cx"> }
</span><del>-
</del><ins>+
</ins><span class="cx"> void emitLoadStructure(RegisterID source, RegisterID dest, RegisterID scratch)
</span><span class="cx"> {
</span><span class="cx"> #if USE(JSVALUE64)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITOpcodescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp (179537 => 179538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp        2015-02-03 05:06:45 UTC (rev 179537)
+++ trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp        2015-02-03 05:20:59 UTC (rev 179538)
</span><span class="lines">@@ -920,13 +920,12 @@
</span><span class="cx"> addSlowCase(branchTest64(NonZero, addressFor(argumentsRegister)));
</span><span class="cx"> emitGetVirtualRegister(property, regT1);
</span><span class="cx"> addSlowCase(emitJumpIfNotImmediateInteger(regT1));
</span><del>- add32(TrustedImm32(1), regT1);
- // regT1 now contains the integer index of the argument we want, including this
</del><span class="cx"> emitGetFromCallFrameHeader32(JSStack::ArgumentCount, regT2);
</span><ins>+ sub32(TrustedImm32(1), regT2);
</ins><span class="cx"> addSlowCase(branch32(AboveOrEqual, regT1, regT2));
</span><span class="cx">
</span><span class="cx"> signExtend32ToPtr(regT1, regT1);
</span><del>- load64(BaseIndex(callFrameRegister, regT1, TimesEight, CallFrame::thisArgumentOffset() * static_cast<int>(sizeof(Register))), regT0);
</del><ins>+ load64(BaseIndex(callFrameRegister, regT1, TimesEight, CallFrame::argumentOffset(0) * static_cast<int>(sizeof(Register))), regT0);
</ins><span class="cx"> emitValueProfilingSite();
</span><span class="cx"> emitPutVirtualRegister(dst, regT0);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITOpcodes32_64cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp (179537 => 179538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp        2015-02-03 05:06:45 UTC (rev 179537)
+++ trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp        2015-02-03 05:20:59 UTC (rev 179538)
</span><span class="lines">@@ -1044,13 +1044,13 @@
</span><span class="cx"> addSlowCase(branch32(NotEqual, tagFor(argumentsRegister), TrustedImm32(JSValue::EmptyValueTag)));
</span><span class="cx"> emitLoad(property, regT1, regT2);
</span><span class="cx"> addSlowCase(branch32(NotEqual, regT1, TrustedImm32(JSValue::Int32Tag)));
</span><del>- add32(TrustedImm32(1), regT2);
</del><span class="cx"> // regT2 now contains the integer index of the argument we want, including this
</span><span class="cx"> load32(payloadFor(JSStack::ArgumentCount), regT3);
</span><ins>+ sub32(TrustedImm32(1), regT3);
</ins><span class="cx"> addSlowCase(branch32(AboveOrEqual, regT2, regT3));
</span><span class="cx">
</span><del>- loadPtr(BaseIndex(callFrameRegister, regT2, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.payload) + CallFrame::thisArgumentOffset() * static_cast<int>(sizeof(Register))), regT0);
- loadPtr(BaseIndex(callFrameRegister, regT2, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.tag) + CallFrame::thisArgumentOffset() * static_cast<int>(sizeof(Register))), regT1);
</del><ins>+ loadPtr(BaseIndex(callFrameRegister, regT2, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.payload) + CallFrame::argumentOffset(0) * static_cast<int>(sizeof(Register))), regT0);
+ loadPtr(BaseIndex(callFrameRegister, regT2, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.tag) + CallFrame::argumentOffset(0) * static_cast<int>(sizeof(Register))), regT1);
</ins><span class="cx"> emitValueProfilingSite();
</span><span class="cx"> emitStore(dst, regT1, regT0);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLowLevelInterpreterasm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm (179537 => 179538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm        2015-02-03 05:06:45 UTC (rev 179537)
+++ trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm        2015-02-03 05:20:59 UTC (rev 179538)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-# Copyright (C) 2011, 2012, 2013, 2014 Apple Inc. All rights reserved.
</del><ins>+# Copyright (C) 2011-2015 Apple Inc. All rights reserved.
</ins><span class="cx"> #
</span><span class="cx"> # Redistribution and use in source and binary forms, with or without
</span><span class="cx"> # modification, are permitted provided that the following conditions
</span><span class="lines">@@ -53,6 +53,7 @@
</span><span class="cx"> const Callee = CodeBlock + SlotSize
</span><span class="cx"> const ArgumentCount = Callee + SlotSize
</span><span class="cx"> const ThisArgumentOffset = ArgumentCount + SlotSize
</span><ins>+const FirstArgumentOffset = ThisArgumentOffset + SlotSize
</ins><span class="cx"> const CallFrameHeaderSize = ThisArgumentOffset
</span><span class="cx">
</span><span class="cx"> # Some value representation constants.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLowLevelInterpreter32_64asm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm (179537 => 179538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm        2015-02-03 05:06:45 UTC (rev 179537)
+++ trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm        2015-02-03 05:20:59 UTC (rev 179538)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-# Copyright (C) 2011, 2012, 2013, 2014 Apple Inc. All rights reserved.
</del><ins>+# Copyright (C) 2011-2015 Apple Inc. All rights reserved.
</ins><span class="cx"> #
</span><span class="cx"> # Redistribution and use in source and binary forms, with or without
</span><span class="cx"> # modification, are permitted provided that the following conditions
</span><span class="lines">@@ -1613,12 +1613,12 @@
</span><span class="cx"> loadi 12[PC], t1
</span><span class="cx"> bineq TagOffset[cfr, t0, 8], EmptyValueTag, .opGetArgumentByValSlow
</span><span class="cx"> loadConstantOrVariablePayload(t1, Int32Tag, t2, .opGetArgumentByValSlow)
</span><del>- addi 1, t2
</del><span class="cx"> loadi ArgumentCount + PayloadOffset[cfr], t1
</span><ins>+ subi 1, t1
</ins><span class="cx"> biaeq t2, t1, .opGetArgumentByValSlow
</span><span class="cx"> loadi 4[PC], t3
</span><del>- loadi ThisArgumentOffset + TagOffset[cfr, t2, 8], t0
- loadi ThisArgumentOffset + PayloadOffset[cfr, t2, 8], t1
</del><ins>+ loadi FirstArgumentOffset + TagOffset[cfr, t2, 8], t0
+ loadi FirstArgumentOffset + PayloadOffset[cfr, t2, 8], t1
</ins><span class="cx"> storei t0, TagOffset[cfr, t3, 8]
</span><span class="cx"> storei t1, PayloadOffset[cfr, t3, 8]
</span><span class="cx"> valueProfile(t0, t1, 24, t2)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLowLevelInterpreter64asm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm (179537 => 179538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm        2015-02-03 05:06:45 UTC (rev 179537)
+++ trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm        2015-02-03 05:20:59 UTC (rev 179538)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-# Copyright (C) 2011, 2012, 2013, 2014 Apple Inc. All rights reserved.
</del><ins>+# Copyright (C) 2011-2015 Apple Inc. All rights reserved.
</ins><span class="cx"> #
</span><span class="cx"> # Redistribution and use in source and binary forms, with or without
</span><span class="cx"> # modification, are permitted provided that the following conditions
</span><span class="lines">@@ -1471,12 +1471,13 @@
</span><span class="cx"> loadisFromInstruction(3, t1)
</span><span class="cx"> btqnz [cfr, t0, 8], .opGetArgumentByValSlow
</span><span class="cx"> loadConstantOrVariableInt32(t1, t2, .opGetArgumentByValSlow)
</span><del>- addi 1, t2
</del><span class="cx"> loadi ArgumentCount + PayloadOffset[cfr], t1
</span><ins>+ sxi2q t2, t2
+ subi 1, t1
</ins><span class="cx"> biaeq t2, t1, .opGetArgumentByValSlow
</span><span class="cx"> loadisFromInstruction(1, t3)
</span><span class="cx"> loadpFromInstruction(6, t1)
</span><del>- loadq ThisArgumentOffset[cfr, t2, 8], t0
</del><ins>+ loadq FirstArgumentOffset[cfr, t2, 8], t0
</ins><span class="cx"> storeq t0, [cfr, t3, 8]
</span><span class="cx"> valueProfile(t0, 6, t1)
</span><span class="cx"> dispatch(7)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressgetmyargumentbyvaloutofboundsnowarmupjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-out-of-bounds-no-warm-up.js (0 => 179538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-out-of-bounds-no-warm-up.js         (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-out-of-bounds-no-warm-up.js        2015-02-03 05:20:59 UTC (rev 179538)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+function foo(index) {
+ return arguments[index];
+}
+
+noInline(foo);
+
+var result = foo(1);
+if (result !== void 0)
+ throw "Error: bad result at end: " + result;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressgetmyargumentbyvaloutofboundsjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-out-of-bounds.js (0 => 179538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-out-of-bounds.js         (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-out-of-bounds.js        2015-02-03 05:20:59 UTC (rev 179538)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+function foo(index) {
+ return arguments[index];
+}
+
+noInline(foo);
+
+for (var i = 0; i < 100000; ++i) {
+ var result = foo(1, 42);
+ if (result != 42)
+ throw "Error: bad result in loop: " + result;
+}
+
+var result = foo(1);
+if (result !== void 0)
+ throw "Error: bad result at end: " + result;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressgetmyargumentbyvalsafeoutofboundsjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-safe-out-of-bounds.js (0 => 179538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-safe-out-of-bounds.js         (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-safe-out-of-bounds.js        2015-02-03 05:20:59 UTC (rev 179538)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+function foo(index) {
+ if (index > 1000)
+ arguments = [1, 2, 3];
+ return arguments[index];
+}
+
+noInline(foo);
+
+for (var i = 0; i < 100000; ++i) {
+ var result = foo(1, 42);
+ if (result != 42)
+ throw "Error: bad result in loop: " + result;
+}
+
+var result = foo(1);
+if (result !== void 0)
+ throw "Error: bad result at end: " + result;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressgetmyargumentbyvalsafewraparoundjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-safe-wrap-around.js (0 => 179538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-safe-wrap-around.js         (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-safe-wrap-around.js        2015-02-03 05:20:59 UTC (rev 179538)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+function foo(index) {
+ if (index > 1000)
+ arguments = [1, 2, 3];
+ return arguments[index];
+}
+
+noInline(foo);
+
+for (var i = 0; i < 100000; ++i) {
+ var result = foo(1, 42);
+ if (result != 42)
+ throw "Error: bad result in loop: " + result;
+}
+
+var result = foo(-1);
+if (result !== void 0)
+ throw "Error: bad result at end: " + result;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressgetmyargumentbyvalwraparoundnowarmupjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-wrap-around-no-warm-up.js (0 => 179538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-wrap-around-no-warm-up.js         (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-wrap-around-no-warm-up.js        2015-02-03 05:20:59 UTC (rev 179538)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+function foo(index) {
+ return arguments[index];
+}
+
+noInline(foo);
+
+var result = foo(-1);
+if (result !== void 0)
+ throw "Error: bad result at end: " + result;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressgetmyargumentbyvalwraparoundjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-wrap-around.js (0 => 179538)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-wrap-around.js         (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/get-my-argument-by-val-wrap-around.js        2015-02-03 05:20:59 UTC (rev 179538)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+function foo(index) {
+ return arguments[index];
+}
+
+noInline(foo);
+
+for (var i = 0; i < 100000; ++i) {
+ var result = foo(1, 42);
+ if (result != 42)
+ throw "Error: bad result in loop: " + result;
+}
+
+var result = foo(-1);
+if (result !== void 0)
+ throw "Error: bad result at end: " + result;
</ins></span></pre>
</div>
</div>
</body>
</html>