<!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>[190673] 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/190673">190673</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2015-10-07 11:04:54 -0700 (Wed, 07 Oct 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>JIT::compileGetDirectOffset is useless
https://bugs.webkit.org/show_bug.cgi?id=149878
Reviewed by Mark Lam.
Two of the overloads of this method were never called. The other was called only from one
place, in a manner that rendered most of its code dead. This change removes the dead code and
folds the method into its one caller.
* jit/JIT.h:
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emitSlow_op_get_by_val):
(JSC::JIT::emit_op_put_by_val):
(JSC::JIT::compilePutDirectOffset):
(JSC::JIT::emitVarInjectionCheck):
(JSC::JIT::emitGetGlobalProperty):
(JSC::JIT::emitGetVarFromPointer):
(JSC::JIT::compileGetDirectOffset): Deleted.
* jit/JITPropertyAccess32_64.cpp:
(JSC::JIT::compilePutDirectOffset):
(JSC::JIT::emitVarInjectionCheck):
(JSC::JIT::emitGetGlobalProperty):
(JSC::JIT::emitGetVarFromPointer):
(JSC::JIT::compileGetDirectOffset): Deleted.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITh">trunk/Source/JavaScriptCore/jit/JIT.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>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (190672 => 190673)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-10-07 17:28:38 UTC (rev 190672)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-10-07 18:04:54 UTC (rev 190673)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2015-10-07 Filip Pizlo <fpizlo@apple.com>
+
+ JIT::compileGetDirectOffset is useless
+ https://bugs.webkit.org/show_bug.cgi?id=149878
+
+ Reviewed by Mark Lam.
+
+ Two of the overloads of this method were never called. The other was called only from one
+ place, in a manner that rendered most of its code dead. This change removes the dead code and
+ folds the method into its one caller.
+
+ * jit/JIT.h:
+ * jit/JITPropertyAccess.cpp:
+ (JSC::JIT::emitSlow_op_get_by_val):
+ (JSC::JIT::emit_op_put_by_val):
+ (JSC::JIT::compilePutDirectOffset):
+ (JSC::JIT::emitVarInjectionCheck):
+ (JSC::JIT::emitGetGlobalProperty):
+ (JSC::JIT::emitGetVarFromPointer):
+ (JSC::JIT::compileGetDirectOffset): Deleted.
+ * jit/JITPropertyAccess32_64.cpp:
+ (JSC::JIT::compilePutDirectOffset):
+ (JSC::JIT::emitVarInjectionCheck):
+ (JSC::JIT::emitGetGlobalProperty):
+ (JSC::JIT::emitGetVarFromPointer):
+ (JSC::JIT::compileGetDirectOffset): Deleted.
+
</ins><span class="cx"> 2015-10-06 Filip Pizlo <fpizlo@apple.com>
</span><span class="cx">
</span><span class="cx"> Inline caches should handle out-of-line offsets out-of-line
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JIT.h (190672 => 190673)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JIT.h        2015-10-07 17:28:38 UTC (rev 190672)
+++ trunk/Source/JavaScriptCore/jit/JIT.h        2015-10-07 18:04:54 UTC (rev 190673)
</span><span class="lines">@@ -425,10 +425,6 @@
</span><span class="cx"> void emitJumpSlowCaseIfNotJSCell(int virtualRegisterIndex, RegisterID tag);
</span><span class="cx">
</span><span class="cx"> void compileGetByIdHotPath(const Identifier*);
</span><del>- void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, PropertyOffset cachedOffset);
- void compileGetDirectOffset(JSObject* base, RegisterID resultTag, RegisterID resultPayload, PropertyOffset cachedOffset);
- void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, RegisterID offset, FinalObjectMode = MayBeFinal);
- void compilePutDirectOffset(RegisterID base, RegisterID valueTag, RegisterID valuePayload, PropertyOffset cachedOffset);
</del><span class="cx">
</span><span class="cx"> // Arithmetic opcode helpers
</span><span class="cx"> void emitAdd32Constant(int dst, int op, int32_t constant, ResultType opType);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITPropertyAccesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp (190672 => 190673)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp        2015-10-07 17:28:38 UTC (rev 190672)
+++ trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp        2015-10-07 18:04:54 UTC (rev 190673)
</span><span class="lines">@@ -267,31 +267,6 @@
</span><span class="cx"> emitValueProfilingSite();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void JIT::compileGetDirectOffset(RegisterID base, RegisterID result, RegisterID offset, RegisterID scratch, FinalObjectMode finalObjectMode)
-{
- ASSERT(sizeof(JSValue) == 8);
-
- if (finalObjectMode == MayBeFinal) {
- Jump isInline = branch32(LessThan, offset, TrustedImm32(firstOutOfLineOffset));
- loadPtr(Address(base, JSObject::butterflyOffset()), scratch);
- neg32(offset);
- Jump done = jump();
- isInline.link(this);
- addPtr(TrustedImm32(JSObject::offsetOfInlineStorage() - (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue)), base, scratch);
- done.link(this);
- } else {
- if (!ASSERT_DISABLED) {
- Jump isOutOfLine = branch32(GreaterThanOrEqual, offset, TrustedImm32(firstOutOfLineOffset));
- abortWithReason(JITOffsetIsNotOutOfLine);
- isOutOfLine.link(this);
- }
- loadPtr(Address(base, JSObject::butterflyOffset()), scratch);
- neg32(offset);
- }
- signExtend32ToPtr(offset, offset);
- load64(BaseIndex(scratch, offset, TimesEight, (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue)), result);
-}
-
</del><span class="cx"> void JIT::emit_op_put_by_val(Instruction* currentInstruction)
</span><span class="cx"> {
</span><span class="cx"> int base = currentInstruction[1].u.operand;
</span><span class="lines">@@ -661,29 +636,6 @@
</span><span class="cx"> store64(value, Address(base, sizeof(JSValue) * offsetInButterfly(cachedOffset)));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// Compile a load from an object's property storage. May overwrite base.
-void JIT::compileGetDirectOffset(RegisterID base, RegisterID result, PropertyOffset cachedOffset)
-{
- if (isInlineOffset(cachedOffset)) {
- load64(Address(base, JSObject::offsetOfInlineStorage() + sizeof(JSValue) * offsetInInlineStorage(cachedOffset)), result);
- return;
- }
-
- loadPtr(Address(base, JSObject::butterflyOffset()), result);
- load64(Address(result, sizeof(JSValue) * offsetInButterfly(cachedOffset)), result);
-}
-
-void JIT::compileGetDirectOffset(JSObject* base, RegisterID result, PropertyOffset cachedOffset)
-{
- if (isInlineOffset(cachedOffset)) {
- load64(base->locationForOffset(cachedOffset), result);
- return;
- }
-
- loadPtr(base->butterflyAddress(), result);
- load64(Address(result, offsetInButterfly(cachedOffset) * sizeof(WriteBarrier<Unknown>)), result);
-}
-
</del><span class="cx"> void JIT::emitVarInjectionCheck(bool needsVarInjectionChecks)
</span><span class="cx"> {
</span><span class="cx"> if (!needsVarInjectionChecks)
</span><span class="lines">@@ -804,8 +756,21 @@
</span><span class="cx">
</span><span class="cx"> void JIT::emitGetGlobalProperty(uintptr_t* operandSlot)
</span><span class="cx"> {
</span><del>- load32(operandSlot, regT1);
- compileGetDirectOffset(regT0, regT0, regT1, regT2, KnownNotFinal);
</del><ins>+ GPRReg base = regT0;
+ GPRReg result = regT0;
+ GPRReg offset = regT1;
+ GPRReg scratch = regT2;
+
+ load32(operandSlot, offset);
+ if (!ASSERT_DISABLED) {
+ Jump isOutOfLine = branch32(GreaterThanOrEqual, offset, TrustedImm32(firstOutOfLineOffset));
+ abortWithReason(JITOffsetIsNotOutOfLine);
+ isOutOfLine.link(this);
+ }
+ loadPtr(Address(base, JSObject::butterflyOffset()), scratch);
+ neg32(offset);
+ signExtend32ToPtr(offset, offset);
+ load64(BaseIndex(scratch, offset, TimesEight, (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue)), result);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void JIT::emitGetVarFromPointer(JSValue* operand, GPRReg reg)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITPropertyAccess32_64cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp (190672 => 190673)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp        2015-10-07 17:28:38 UTC (rev 190672)
+++ trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp        2015-10-07 18:04:54 UTC (rev 190673)
</span><span class="lines">@@ -663,66 +663,6 @@
</span><span class="cx"> gen.reportSlowPathCall(coldPathBegin, call);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// Compile a store into an object's property storage. May overwrite base.
-void JIT::compilePutDirectOffset(RegisterID base, RegisterID valueTag, RegisterID valuePayload, PropertyOffset cachedOffset)
-{
- if (isOutOfLineOffset(cachedOffset))
- loadPtr(Address(base, JSObject::butterflyOffset()), base);
- emitStore(indexRelativeToBase(cachedOffset), valueTag, valuePayload, base);
-}
-
-// Compile a load from an object's property storage. May overwrite base.
-void JIT::compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, PropertyOffset cachedOffset)
-{
- if (isInlineOffset(cachedOffset)) {
- emitLoad(indexRelativeToBase(cachedOffset), resultTag, resultPayload, base);
- return;
- }
-
- RegisterID temp = resultPayload;
- loadPtr(Address(base, JSObject::butterflyOffset()), temp);
- emitLoad(indexRelativeToBase(cachedOffset), resultTag, resultPayload, temp);
-}
-
-void JIT::compileGetDirectOffset(JSObject* base, RegisterID resultTag, RegisterID resultPayload, PropertyOffset cachedOffset)
-{
- if (isInlineOffset(cachedOffset)) {
- move(TrustedImmPtr(base->locationForOffset(cachedOffset)), resultTag);
- load32(Address(resultTag, OBJECT_OFFSETOF(JSValue, u.asBits.payload)), resultPayload);
- load32(Address(resultTag, OBJECT_OFFSETOF(JSValue, u.asBits.tag)), resultTag);
- return;
- }
-
- loadPtr(base->butterflyAddress(), resultTag);
- load32(Address(resultTag, offsetInButterfly(cachedOffset) * sizeof(WriteBarrier<Unknown>) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), resultPayload);
- load32(Address(resultTag, offsetInButterfly(cachedOffset) * sizeof(WriteBarrier<Unknown>) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), resultTag);
-}
-
-void JIT::compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, RegisterID offset, FinalObjectMode finalObjectMode)
-{
- ASSERT(sizeof(JSValue) == 8);
-
- if (finalObjectMode == MayBeFinal) {
- Jump isInline = branch32(LessThan, offset, TrustedImm32(firstOutOfLineOffset));
- loadPtr(Address(base, JSObject::butterflyOffset()), base);
- neg32(offset);
- Jump done = jump();
- isInline.link(this);
- addPtr(TrustedImmPtr(JSObject::offsetOfInlineStorage() - (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue)), base);
- done.link(this);
- } else {
- if (!ASSERT_DISABLED) {
- Jump isOutOfLine = branch32(GreaterThanOrEqual, offset, TrustedImm32(firstOutOfLineOffset));
- abortWithReason(JITOffsetIsNotOutOfLine);
- isOutOfLine.link(this);
- }
- loadPtr(Address(base, JSObject::butterflyOffset()), base);
- neg32(offset);
- }
- load32(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.payload) + (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue)), resultPayload);
- load32(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.tag) + (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue)), resultTag);
-}
-
</del><span class="cx"> void JIT::emitVarInjectionCheck(bool needsVarInjectionChecks)
</span><span class="cx"> {
</span><span class="cx"> if (!needsVarInjectionChecks)
</span><span class="lines">@@ -842,9 +782,22 @@
</span><span class="cx">
</span><span class="cx"> void JIT::emitGetGlobalProperty(uintptr_t* operandSlot)
</span><span class="cx"> {
</span><del>- move(regT0, regT2);
- load32(operandSlot, regT3);
- compileGetDirectOffset(regT2, regT1, regT0, regT3, KnownNotFinal);
</del><ins>+ GPRReg base = regT2;
+ GPRReg resultTag = regT1;
+ GPRReg resultPayload = regT0;
+ GPRReg offset = regT3;
+
+ move(regT0, base);
+ load32(operandSlot, offset);
+ if (!ASSERT_DISABLED) {
+ Jump isOutOfLine = branch32(GreaterThanOrEqual, offset, TrustedImm32(firstOutOfLineOffset));
+ abortWithReason(JITOffsetIsNotOutOfLine);
+ isOutOfLine.link(this);
+ }
+ loadPtr(Address(base, JSObject::butterflyOffset()), base);
+ neg32(offset);
+ load32(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.payload) + (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue)), resultPayload);
+ load32(BaseIndex(base, offset, TimesEight, OBJECT_OFFSETOF(JSValue, u.asBits.tag) + (firstOutOfLineOffset - 2) * sizeof(EncodedJSValue)), resultTag);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void JIT::emitGetVarFromPointer(JSValue* operand, GPRReg tag, GPRReg payload)
</span></span></pre>
</div>
</div>
</body>
</html>