<!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>[175846] trunk</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/175846">175846</a></dd>
<dt>Author</dt> <dd>akling@apple.com</dd>
<dt>Date</dt> <dd>2014-11-10 19:10:13 -0800 (Mon, 10 Nov 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>The JIT should cache property lookup misses.
&lt;https://webkit.org/b/135578&gt;

Source/JavaScriptCore:

Add support for inline caching of missed property lookups.
Previously this would banish us to C++ slow path.

It's implemented as a simple GetById cache that returns jsUndefined()
as long as the Structure chain check passes. There's no DFG exploitation
of this knowledge in this patch.

Test: js/regress/undefined-property-access.js (~5.5x speedup)

Reviewed by Filip Pizlo.

* bytecode/PolymorphicGetByIdList.h:
* bytecode/GetByIdStatus.cpp:
(JSC::GetByIdStatus::computeForStubInfo):

    Add GetByIdAccess::SimpleMiss so we can communicate to the DFG that
    the access has been cached.

* jit/Repatch.cpp:
(JSC::toString):
(JSC::kindFor):
(JSC::generateByIdStub):
(JSC::tryCacheGetByID):
(JSC::tryBuildGetByIDList):

    Added a GetUndefined stub kind, just a simple &quot;store jsUndefined()&quot; snippet.
    Use this to cache missed lookups, piggybacking mostly on the GetValue kind.

* runtime/PropertySlot.h:
(JSC::PropertySlot::isUnset):

    Exposed the unset state so PropertySlot can communicate that lookup failed.

LayoutTests:

Add a JSRegress test for caching of property lookup misses.
There are three subtests:

    1. Pure speed test.
    2. Test for when a property previously cached as missing suddenly
       appears on the object.
    3. Same as (2), but it appears on the prototype.

The test runs ~5.5x faster with the optimization.

Reviewed by Filip Pizlo.

* js/regress/script-tests/undefined-property-access.js: Added.
(foo):
(bar):
(baz):
* js/regress/undefined-property-access-expected.txt: Added.
* js/regress/undefined-property-access.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeGetByIdStatuscpp">trunk/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodePolymorphicGetByIdListh">trunk/Source/JavaScriptCore/bytecode/PolymorphicGetByIdList.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitRepatchcpp">trunk/Source/JavaScriptCore/jit/Repatch.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimePropertySloth">trunk/Source/JavaScriptCore/runtime/PropertySlot.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsjsregressscripttestsundefinedpropertyaccessjs">trunk/LayoutTests/js/regress/script-tests/undefined-property-access.js</a></li>
<li><a href="#trunkLayoutTestsjsregressundefinedpropertyaccessexpectedtxt">trunk/LayoutTests/js/regress/undefined-property-access-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsregressundefinedpropertyaccesshtml">trunk/LayoutTests/js/regress/undefined-property-access.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (175845 => 175846)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-11-11 03:05:25 UTC (rev 175845)
+++ trunk/LayoutTests/ChangeLog        2014-11-11 03:10:13 UTC (rev 175846)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2014-11-10  Andreas Kling  &lt;akling@apple.com&gt;
+
+        The JIT should cache property lookup misses.
+        &lt;https://webkit.org/b/135578&gt;
+
+        Add a JSRegress test for caching of property lookup misses.
+        There are three subtests:
+
+            1. Pure speed test.
+            2. Test for when a property previously cached as missing suddenly
+               appears on the object.
+            3. Same as (2), but it appears on the prototype.
+
+        The test runs ~5.5x faster with the optimization.
+
+        Reviewed by Filip Pizlo.
+
+        * js/regress/script-tests/undefined-property-access.js: Added.
+        (foo):
+        (bar):
+        (baz):
+        * js/regress/undefined-property-access-expected.txt: Added.
+        * js/regress/undefined-property-access.html: Added.
+
</ins><span class="cx"> 2014-11-10  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Test that complext and fast text codepaths measure the same width
</span></span></pre></div>
<a id="trunkLayoutTestsjsregressscripttestsundefinedpropertyaccessjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/regress/script-tests/undefined-property-access.js (0 => 175846)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regress/script-tests/undefined-property-access.js                                (rev 0)
+++ trunk/LayoutTests/js/regress/script-tests/undefined-property-access.js        2014-11-11 03:10:13 UTC (rev 175846)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+var someGlobal;
+
+// This is a simple speed test. It should go fast.
+
+function foo() {
+    var myObject = {};
+    for (var i = 0; i &lt; 10000000; ++i) {
+        someGlobal = myObject.undefinedProperty;
+    }
+    return someGlobal;
+}
+result = foo();
+if (result != undefined)
+    throw &quot;Bad result: &quot; + result;
+
+// This test checks that a cached property lookup miss doesn't continue to fire when the property suddenly appears on the object.
+
+function bar() {
+    var myObject = {};
+    for (var i = 0; i &lt; 100000000; ++i) {
+        someGlobal = myObject.someProperty;
+        if (i == 50000000)
+            myObject.someProperty = 1;
+    }
+    return someGlobal;
+}
+var result = bar();
+if (result != 1)
+    throw &quot;Bad result: &quot; + result;
+someGlobal = undefined;
+
+// This test checks that a cached property lookup miss doesn't continue to fire when the property suddenly appears on the object's prototype.
+
+function baz() {
+    var myPrototype = {}
+    var myObject = {};
+    myObject.__proto__ = myPrototype;
+    for (var i = 0; i &lt; 100000000; ++i) {
+        someGlobal = myObject.someProperty;
+        if (i == 50000000)
+            myPrototype.someProperty = 2;
+    }
+    return someGlobal;
+}
+var result = baz();
+if (result != 2)
+    throw &quot;Bad result: &quot; + result;
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsregressundefinedpropertyaccessexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/regress/undefined-property-access-expected.txt (0 => 175846)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regress/undefined-property-access-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/regress/undefined-property-access-expected.txt        2014-11-11 03:10:13 UTC (rev 175846)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+JSRegress/undefined-property-access
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS no exception thrown
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsregressundefinedpropertyaccesshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/regress/undefined-property-access.html (0 => 175846)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regress/undefined-property-access.html                                (rev 0)
+++ trunk/LayoutTests/js/regress/undefined-property-access.html        2014-11-11 03:10:13 UTC (rev 175846)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../resources/regress-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;script-tests/undefined-property-access.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../resources/regress-post.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (175845 => 175846)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2014-11-11 03:05:25 UTC (rev 175845)
+++ trunk/Source/JavaScriptCore/ChangeLog        2014-11-11 03:10:13 UTC (rev 175846)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2014-11-10  Andreas Kling  &lt;akling@apple.com&gt;
+
+        The JIT should cache property lookup misses.
+        &lt;https://webkit.org/b/135578&gt;
+
+        Add support for inline caching of missed property lookups.
+        Previously this would banish us to C++ slow path.
+
+        It's implemented as a simple GetById cache that returns jsUndefined()
+        as long as the Structure chain check passes. There's no DFG exploitation
+        of this knowledge in this patch.
+
+        Test: js/regress/undefined-property-access.js (~5.5x speedup)
+
+        Reviewed by Filip Pizlo.
+
+        * bytecode/PolymorphicGetByIdList.h:
+        * bytecode/GetByIdStatus.cpp:
+        (JSC::GetByIdStatus::computeForStubInfo):
+
+            Add GetByIdAccess::SimpleMiss so we can communicate to the DFG that
+            the access has been cached.
+
+        * jit/Repatch.cpp:
+        (JSC::toString):
+        (JSC::kindFor):
+        (JSC::generateByIdStub):
+        (JSC::tryCacheGetByID):
+        (JSC::tryBuildGetByIDList):
+
+            Added a GetUndefined stub kind, just a simple &quot;store jsUndefined()&quot; snippet.
+            Use this to cache missed lookups, piggybacking mostly on the GetValue kind.
+
+        * runtime/PropertySlot.h:
+        (JSC::PropertySlot::isUnset):
+
+            Exposed the unset state so PropertySlot can communicate that lookup failed.
+
</ins><span class="cx"> 2014-11-10  Michael Saboff  &lt;msaboff@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add scope operand to op_create_lexical_environment
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeGetByIdStatuscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp (175845 => 175846)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp        2014-11-11 03:05:25 UTC (rev 175845)
+++ trunk/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp        2014-11-11 03:10:13 UTC (rev 175846)
</span><span class="lines">@@ -189,6 +189,7 @@
</span><span class="cx">                             locker, profiledBlock, *stub-&gt;m_callLinkInfo, callExitSiteData));
</span><span class="cx">                     break;
</span><span class="cx">                 }
</span><ins>+                case GetByIdAccess::SimpleMiss:
</ins><span class="cx">                 case GetByIdAccess::CustomGetter:
</span><span class="cx">                 case GetByIdAccess::WatchedStub:{
</span><span class="cx">                     // FIXME: It would be totally sweet to support this at some point in the future.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodePolymorphicGetByIdListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/PolymorphicGetByIdList.h (175845 => 175846)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/PolymorphicGetByIdList.h        2014-11-11 03:05:25 UTC (rev 175845)
+++ trunk/Source/JavaScriptCore/bytecode/PolymorphicGetByIdList.h        2014-11-11 03:10:13 UTC (rev 175846)
</span><span class="lines">@@ -47,7 +47,8 @@
</span><span class="cx">         SimpleStub, // This is a stub.
</span><span class="cx">         WatchedStub,
</span><span class="cx">         Getter,
</span><del>-        CustomGetter
</del><ins>+        CustomGetter,
+        SimpleMiss,
</ins><span class="cx">     };
</span><span class="cx">     
</span><span class="cx">     GetByIdAccess()
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitRepatchcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/Repatch.cpp (175845 => 175846)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/Repatch.cpp        2014-11-11 03:05:25 UTC (rev 175845)
+++ trunk/Source/JavaScriptCore/jit/Repatch.cpp        2014-11-11 03:10:13 UTC (rev 175846)
</span><span class="lines">@@ -228,6 +228,7 @@
</span><span class="cx"> 
</span><span class="cx"> enum ByIdStubKind {
</span><span class="cx">     GetValue,
</span><ins>+    GetUndefined,
</ins><span class="cx">     CallGetter,
</span><span class="cx">     CallCustomGetter,
</span><span class="cx">     CallSetter,
</span><span class="lines">@@ -239,6 +240,8 @@
</span><span class="cx">     switch (kind) {
</span><span class="cx">     case GetValue:
</span><span class="cx">         return &quot;GetValue&quot;;
</span><ins>+    case GetUndefined:
+        return &quot;GetUndefined&quot;;
</ins><span class="cx">     case CallGetter:
</span><span class="cx">         return &quot;CallGetter&quot;;
</span><span class="cx">     case CallCustomGetter:
</span><span class="lines">@@ -257,6 +260,8 @@
</span><span class="cx"> {
</span><span class="cx">     if (slot.isCacheableValue())
</span><span class="cx">         return GetValue;
</span><ins>+    if (slot.isUnset())
+        return GetUndefined;
</ins><span class="cx">     if (slot.isCacheableCustom())
</span><span class="cx">         return CallCustomGetter;
</span><span class="cx">     RELEASE_ASSERT(slot.isCacheableGetter());
</span><span class="lines">@@ -301,7 +306,7 @@
</span><span class="cx">         static_cast&lt;GPRReg&gt;(stubInfo.patch.valueGPR));
</span><span class="cx">     GPRReg scratchGPR = TempRegisterSet(stubInfo.patch.usedRegisters).getFreeGPR();
</span><span class="cx">     bool needToRestoreScratch = scratchGPR == InvalidGPRReg;
</span><del>-    RELEASE_ASSERT(!needToRestoreScratch || kind == GetValue);
</del><ins>+    RELEASE_ASSERT(!needToRestoreScratch || (kind == GetValue || kind == GetUndefined));
</ins><span class="cx">     
</span><span class="cx">     CCallHelpers stubJit(&amp;exec-&gt;vm(), exec-&gt;codeBlock());
</span><span class="cx">     if (needToRestoreScratch) {
</span><span class="lines">@@ -361,24 +366,28 @@
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     currStructure-&gt;startWatchingPropertyForReplacements(*vm, offset);
</span><del>-    GPRReg baseForAccessGPR;
-    if (chain) {
-        // We could have clobbered scratchGPR earlier, so we have to reload from baseGPR to get the target.
-        if (loadTargetFromProxy)
-            stubJit.loadPtr(MacroAssembler::Address(baseGPR, JSProxy::targetOffset()), baseForGetGPR);
-        stubJit.move(MacroAssembler::TrustedImmPtr(protoObject), scratchGPR);
-        baseForAccessGPR = scratchGPR;
-    } else {
-        // For proxy objects, we need to do all the Structure checks before moving the baseGPR into 
-        // baseForGetGPR because if we fail any of the checks then we would have the wrong value in baseGPR
-        // on the slow path.
-        if (loadTargetFromProxy)
-            stubJit.move(scratchGPR, baseForGetGPR);
-        baseForAccessGPR = baseForGetGPR;
</del><ins>+    GPRReg baseForAccessGPR = InvalidGPRReg;
+    if (kind != GetUndefined) {
+        if (chain) {
+            // We could have clobbered scratchGPR earlier, so we have to reload from baseGPR to get the target.
+            if (loadTargetFromProxy)
+                stubJit.loadPtr(MacroAssembler::Address(baseGPR, JSProxy::targetOffset()), baseForGetGPR);
+            stubJit.move(MacroAssembler::TrustedImmPtr(protoObject), scratchGPR);
+            baseForAccessGPR = scratchGPR;
+        } else {
+            // For proxy objects, we need to do all the Structure checks before moving the baseGPR into
+            // baseForGetGPR because if we fail any of the checks then we would have the wrong value in baseGPR
+            // on the slow path.
+            if (loadTargetFromProxy)
+                stubJit.move(scratchGPR, baseForGetGPR);
+            baseForAccessGPR = baseForGetGPR;
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     GPRReg loadedValueGPR = InvalidGPRReg;
</span><del>-    if (kind != CallCustomGetter &amp;&amp; kind != CallCustomSetter) {
</del><ins>+    if (kind == GetUndefined)
+        stubJit.moveTrustedValue(jsUndefined(), valueRegs);
+    else if (kind != CallCustomGetter &amp;&amp; kind != CallCustomSetter) {
</ins><span class="cx">         if (kind == GetValue)
</span><span class="cx">             loadedValueGPR = valueRegs.payloadGPR();
</span><span class="cx">         else
</span><span class="lines">@@ -412,7 +421,7 @@
</span><span class="cx">     std::unique_ptr&lt;CallLinkInfo&gt; callLinkInfo;
</span><span class="cx"> 
</span><span class="cx">     MacroAssembler::Jump success, fail;
</span><del>-    if (kind != GetValue) {
</del><ins>+    if (kind != GetValue &amp;&amp; kind != GetUndefined) {
</ins><span class="cx">         // Need to make sure that whenever this call is made in the future, we remember the
</span><span class="cx">         // place that we made it from. It just so happens to be the place that we are at
</span><span class="cx">         // right now!
</span><span class="lines">@@ -733,10 +742,12 @@
</span><span class="cx">     // FIXME: Cache property access for immediates.
</span><span class="cx">     if (!baseValue.isCell())
</span><span class="cx">         return GiveUpOnCache;
</span><ins>+
+    if (!slot.isCacheable() &amp;&amp; !slot.isUnset())
+        return GiveUpOnCache;
+
</ins><span class="cx">     JSCell* baseCell = baseValue.asCell();
</span><span class="cx">     Structure* structure = baseCell-&gt;structure();
</span><del>-    if (!slot.isCacheable())
-        return GiveUpOnCache;
</del><span class="cx"> 
</span><span class="cx">     InlineCacheAction action = actionForCell(*vm, baseCell);
</span><span class="cx">     if (action != AttemptToCache)
</span><span class="lines">@@ -783,7 +794,7 @@
</span><span class="cx"> static InlineCacheAction tryBuildGetByIDList(ExecState* exec, JSValue baseValue, const Identifier&amp; ident, const PropertySlot&amp; slot, StructureStubInfo&amp; stubInfo)
</span><span class="cx"> {
</span><span class="cx">     if (!baseValue.isCell()
</span><del>-        || !slot.isCacheable())
</del><ins>+        || (!slot.isCacheable() &amp;&amp; !slot.isUnset()))
</ins><span class="cx">         return GiveUpOnCache;
</span><span class="cx"> 
</span><span class="cx">     JSCell* baseCell = baseValue.asCell();
</span><span class="lines">@@ -808,20 +819,23 @@
</span><span class="cx">         // We cannot do as much inline caching if the registers were not flushed prior to this GetById. In particular,
</span><span class="cx">         // non-Value cached properties require planting calls, which requires registers to have been flushed. Thus,
</span><span class="cx">         // if registers were not flushed, don't do non-Value caching.
</span><del>-        if (!slot.isCacheableValue())
</del><ins>+        if (!slot.isCacheableValue() &amp;&amp; !slot.isUnset())
</ins><span class="cx">             return GiveUpOnCache;
</span><span class="cx">     }
</span><del>-    
-    PropertyOffset offset = slot.cachedOffset();
</del><ins>+
+    PropertyOffset offset = slot.isUnset() ? invalidOffset : slot.cachedOffset();
</ins><span class="cx">     StructureChain* prototypeChain = 0;
</span><span class="cx">     size_t count = 0;
</span><span class="cx">     
</span><del>-    if (slot.slotBase() != baseValue) {
</del><ins>+    if (slot.isUnset() || slot.slotBase() != baseValue) {
</ins><span class="cx">         if (typeInfo.prohibitsPropertyCaching() || structure-&gt;isDictionary())
</span><span class="cx">             return GiveUpOnCache;
</span><del>-        
-        count = normalizePrototypeChainForChainAccess(
-            exec, baseValue, slot.slotBase(), ident, offset);
</del><ins>+
+        if (slot.isUnset())
+            count = normalizePrototypeChain(exec, baseCell);
+        else
+            count = normalizePrototypeChainForChainAccess(
+                exec, baseValue, slot.slotBase(), ident, offset);
</ins><span class="cx">         if (count == InvalidPrototypeChain)
</span><span class="cx">             return GiveUpOnCache;
</span><span class="cx">         prototypeChain = structure-&gt;prototypeChain(exec);
</span><span class="lines">@@ -843,6 +857,8 @@
</span><span class="cx">     GetByIdAccess::AccessType accessType;
</span><span class="cx">     if (slot.isCacheableValue())
</span><span class="cx">         accessType = slot.watchpointSet() ? GetByIdAccess::WatchedStub : GetByIdAccess::SimpleStub;
</span><ins>+    else if (slot.isUnset())
+        accessType = GetByIdAccess::SimpleMiss;
</ins><span class="cx">     else if (slot.isCacheableGetter())
</span><span class="cx">         accessType = GetByIdAccess::Getter;
</span><span class="cx">     else
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimePropertySloth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/PropertySlot.h (175845 => 175846)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/PropertySlot.h        2014-11-11 03:05:25 UTC (rev 175845)
+++ trunk/Source/JavaScriptCore/runtime/PropertySlot.h        2014-11-11 03:10:13 UTC (rev 175846)
</span><span class="lines">@@ -78,6 +78,7 @@
</span><span class="cx">     JSValue getValue(ExecState*, unsigned propertyName) const;
</span><span class="cx"> 
</span><span class="cx">     bool isCacheable() const { return m_cacheability == CachingAllowed &amp;&amp; m_offset != invalidOffset; }
</span><ins>+    bool isUnset() const { return m_propertyType == TypeUnset; }
</ins><span class="cx">     bool isValue() const { return m_propertyType == TypeValue; }
</span><span class="cx">     bool isAccessor() const { return m_propertyType == TypeGetter; }
</span><span class="cx">     bool isCustom() const { return m_propertyType == TypeCustom; }
</span></span></pre>
</div>
</div>

</body>
</html>