<!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>[175729] trunk/LayoutTests</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/175729">175729</a></dd>
<dt>Author</dt> <dd>mark.lam@apple.com</dd>
<dt>Date</dt> <dd>2014-11-06 16:49:36 -0800 (Thu, 06 Nov 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Refactor the get-by-pname.js test [follow up].
&lt;https://webkit.org/b/138483&gt;

Reviewed by Michael Saboff.

Used named properties to make the test code more readable.
        
* js/script-tests/get-by-pname.js:
(isTierIteration):
(tierName):
(testExpr): Deleted.
(testExpectedResult): Deleted.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsgetbypnamejs">trunk/LayoutTests/js/script-tests/get-by-pname.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (175728 => 175729)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-11-07 00:34:29 UTC (rev 175728)
+++ trunk/LayoutTests/ChangeLog        2014-11-07 00:49:36 UTC (rev 175729)
</span><span class="lines">@@ -1,5 +1,20 @@
</span><span class="cx"> 2014-11-06  Mark Lam  &lt;mark.lam@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Refactor the get-by-pname.js test [follow up].
+        &lt;https://webkit.org/b/138483&gt;
+
+        Reviewed by Michael Saboff.
+
+        Used named properties to make the test code more readable.
+        
+        * js/script-tests/get-by-pname.js:
+        (isTierIteration):
+        (tierName):
+        (testExpr): Deleted.
+        (testExpectedResult): Deleted.
+
+2014-11-06  Mark Lam  &lt;mark.lam@apple.com&gt;
+
</ins><span class="cx">         slow_path_get_direct_pname() needs to be hardened against a constant baseValue.
</span><span class="cx">         &lt;https://webkit.org/b/138476&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsgetbypnamejs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/script-tests/get-by-pname.js (175728 => 175729)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/get-by-pname.js        2014-11-07 00:34:29 UTC (rev 175728)
+++ trunk/LayoutTests/js/script-tests/get-by-pname.js        2014-11-07 00:49:36 UTC (rev 175729)
</span><span class="lines">@@ -33,70 +33,63 @@
</span><span class="cx"> var o1 = {&quot;1&quot;:1, &quot;2&quot;:3, &quot;3&quot;:7};
</span><span class="cx"> 
</span><span class="cx"> var testCases = [
</span><del>-    [ &quot;foo(o)&quot;, &quot;11&quot; ],
-    [ &quot;foo(p)&quot;, &quot;10&quot; ],
-    [ &quot;foo(q)&quot;, &quot;3467&quot; ],
-    [ &quot;foo(r)&quot;, &quot;113&quot; ],
-    [ &quot;foo(s)&quot;, &quot;182&quot; ],
</del><ins>+    { test: &quot;foo(o)&quot;, result: &quot;11&quot; },
+    { test: &quot;foo(p)&quot;, result: &quot;10&quot; },
+    { test: &quot;foo(q)&quot;, result: &quot;3467&quot; },
+    { test: &quot;foo(r)&quot;, result: &quot;113&quot; },
+    { test: &quot;foo(s)&quot;, result: &quot;182&quot; },
</ins><span class="cx"> 
</span><del>-    [ &quot;getByPnameOnConstant(a)&quot;, &quot;0&quot; ],
-    [ &quot;getByPnameOnVar(a, 100)&quot;, &quot;0&quot; ],
-    [ &quot;getByPnameOnVar(a, 'abc')&quot;, &quot;'0abc'&quot; ],
-    [ &quot;getByPnameOnVar(a, o)&quot;, &quot;0&quot; ],
-    [ &quot;getByPnameOnVar(a, o1)&quot;, &quot;4&quot; ],
-    [ &quot;getByPnameOnVar(a, a)&quot;, &quot;6&quot; ],
</del><ins>+    { test: &quot;getByPnameOnConstant(a)&quot;, result: &quot;0&quot; },
+    { test: &quot;getByPnameOnVar(a, 100)&quot;, result: &quot;0&quot; },
+    { test: &quot;getByPnameOnVar(a, 'abc')&quot;, result: &quot;'0abc'&quot; },
+    { test: &quot;getByPnameOnVar(a, o)&quot;, result: &quot;0&quot; },
+    { test: &quot;getByPnameOnVar(a, o1)&quot;, result: &quot;4&quot; },
+    { test: &quot;getByPnameOnVar(a, a)&quot;, result: &quot;6&quot; },
</ins><span class="cx"> 
</span><del>-    [ &quot;getByPnameOnConstant(o1)&quot;, &quot;0&quot; ],
-    [ &quot;getByPnameOnVar(o1, 100)&quot;, &quot;0&quot; ],
-    [ &quot;getByPnameOnVar(o1, 'abc')&quot;, &quot;'0bc0'&quot; ],
-    [ &quot;getByPnameOnVar(o1, o)&quot;, &quot;0&quot; ],
-    [ &quot;getByPnameOnVar(o1, o1)&quot;, &quot;11&quot; ],
-    [ &quot;getByPnameOnVar(o1, a)&quot;, &quot;5&quot; ],
</del><ins>+    { test: &quot;getByPnameOnConstant(o1)&quot;, result: &quot;0&quot; },
+    { test: &quot;getByPnameOnVar(o1, 100)&quot;, result: &quot;0&quot; },
+    { test: &quot;getByPnameOnVar(o1, 'abc')&quot;, result: &quot;'0bc0'&quot; },
+    { test: &quot;getByPnameOnVar(o1, o)&quot;, result: &quot;0&quot; },
+    { test: &quot;getByPnameOnVar(o1, o1)&quot;, result: &quot;11&quot; },
+    { test: &quot;getByPnameOnVar(o1, a)&quot;, result: &quot;5&quot; },
</ins><span class="cx"> 
</span><del>-    [ &quot;getByPnameOnConstant(o)&quot;, &quot;0&quot; ],
-    [ &quot;getByPnameOnVar(o, 100)&quot;, &quot;0&quot; ],
-    [ &quot;getByPnameOnVar(o, 'abc')&quot;, &quot;0&quot; ],
-    [ &quot;getByPnameOnVar(o, o)&quot;, &quot;11&quot; ],
-    [ &quot;getByPnameOnVar(o, o1)&quot;, &quot;0&quot; ],
-    [ &quot;getByPnameOnVar(o, a)&quot;, &quot;0&quot; ],
</del><ins>+    { test: &quot;getByPnameOnConstant(o)&quot;, result: &quot;0&quot; },
+    { test: &quot;getByPnameOnVar(o, 100)&quot;, result: &quot;0&quot; },
+    { test: &quot;getByPnameOnVar(o, 'abc')&quot;, result: &quot;0&quot; },
+    { test: &quot;getByPnameOnVar(o, o)&quot;, result: &quot;11&quot; },
+    { test: &quot;getByPnameOnVar(o, o1)&quot;, result: &quot;0&quot; },
+    { test: &quot;getByPnameOnVar(o, a)&quot;, result: &quot;0&quot; },
</ins><span class="cx"> 
</span><del>-    [ &quot;getByPnameOnConstant(0)&quot;, &quot;0&quot; ],
-    [ &quot;getByPnameOnVar(0, 100)&quot;, &quot;0&quot; ],
-    [ &quot;getByPnameOnVar(0, 'abc')&quot;, &quot;0&quot; ],
-    [ &quot;getByPnameOnVar(0, o)&quot;, &quot;0&quot; ],
-    [ &quot;getByPnameOnVar(0, o1)&quot;, &quot;0&quot; ],
-    [ &quot;getByPnameOnVar(0, a)&quot;, &quot;0&quot; ],
</del><ins>+    { test: &quot;getByPnameOnConstant(0)&quot;, result: &quot;0&quot; },
+    { test: &quot;getByPnameOnVar(0, 100)&quot;, result: &quot;0&quot; },
+    { test: &quot;getByPnameOnVar(0, 'abc')&quot;, result: &quot;0&quot; },
+    { test: &quot;getByPnameOnVar(0, o)&quot;, result: &quot;0&quot; },
+    { test: &quot;getByPnameOnVar(0, o1)&quot;, result: &quot;0&quot; },
+    { test: &quot;getByPnameOnVar(0, a)&quot;, result: &quot;0&quot; },
</ins><span class="cx"> 
</span><del>-    [ &quot;getByPnameOnConstant('abc')&quot;, &quot;0&quot; ],
-    [ &quot;getByPnameOnVar('abc', 100)&quot;, &quot;0&quot; ],
-    [ &quot;getByPnameOnVar('abc', 'abc')&quot;, &quot;'0abc'&quot; ],
-    [ &quot;getByPnameOnVar('abc', o)&quot;, &quot;0&quot; ],
-    [ &quot;getByPnameOnVar('abc', o1)&quot;, &quot;4&quot; ],
-    [ &quot;getByPnameOnVar('abc', a)&quot;, &quot;6&quot; ],
-    [ &quot;getByPnameOnVar('def', 'abc')&quot;, &quot;'0abc'&quot; ],
</del><ins>+    { test: &quot;getByPnameOnConstant('abc')&quot;, result: &quot;0&quot; },
+    { test: &quot;getByPnameOnVar('abc', 100)&quot;, result: &quot;0&quot; },
+    { test: &quot;getByPnameOnVar('abc', 'abc')&quot;, result: &quot;'0abc'&quot; },
+    { test: &quot;getByPnameOnVar('abc', o)&quot;, result: &quot;0&quot; },
+    { test: &quot;getByPnameOnVar('abc', o1)&quot;, result: &quot;4&quot; },
+    { test: &quot;getByPnameOnVar('abc', a)&quot;, result: &quot;6&quot; },
+    { test: &quot;getByPnameOnVar('def', 'abc')&quot;, result: &quot;'0abc'&quot; },
</ins><span class="cx"> ];
</span><span class="cx"> 
</span><del>-function testExpr(index) {
-    return testCases[index][0];
-}
-function testExpectedResult(index) {
-    return testCases[index][1];
-}
-
</del><span class="cx"> // The tiers should be sorted from lowest iterations to highest.
</span><span class="cx"> var tiers = [
</span><span class="cx">     // name, iterations
</span><del>-    [ &quot;cold&quot;, 0 ],
-    [ &quot;llint&quot;, 10 ],
-    [ &quot;baseline&quot;, 500 ],
-    [ &quot;dfg&quot;, 1000 ],
-    // [ &quot;ftl&quot;, 100000 ],
</del><ins>+    { name: &quot;cold&quot;, iterations: 0 },
+    { name: &quot;llint&quot;, iterations: 10 },
+    { name: &quot;baseline&quot;, iterations: 500 },
+    { name: &quot;dfg&quot;, iterations: 1000 },
+    // { name: &quot;ftl&quot;, iterations: 100000 },
</ins><span class="cx"> ];
</span><del>-var highestIteration = tiers[tiers.length - 1][1];
</del><ins>+var highestIteration = tiers[tiers.length - 1].iterations;
</ins><span class="cx"> 
</span><span class="cx"> function isTierIteration(iteration) {
</span><span class="cx">     for (var i = 0; i &lt; tiers.length; i++) {
</span><del>-        var tierIteration = tiers[i][1];
</del><ins>+        var tierIteration = tiers[i].iterations;
</ins><span class="cx">         if (iteration &lt; tierIteration)
</span><span class="cx">             return false;
</span><span class="cx">         if (iteration == tierIteration)
</span><span class="lines">@@ -106,8 +99,8 @@
</span><span class="cx"> }
</span><span class="cx"> function tierName(iteration) {
</span><span class="cx">     for (var i = 0; i &lt; tiers.length; i++) {
</span><del>-        if (iteration == tiers[i][1])
-            return tiers[i][0];
</del><ins>+        if (iteration == tiers[i].iterations)
+            return tiers[i].name;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -115,11 +108,11 @@
</span><span class="cx">     if (isTierIteration(i)) {
</span><span class="cx">         debug(&quot;Test tier: &quot; + tierName(i));
</span><span class="cx">         for (var j = 0; j &lt; testCases.length; j++)
</span><del>-            shouldBe(testExpr(j), testExpectedResult(j));
</del><ins>+            shouldBe(testCases[j].test, testCases[j].result);
</ins><span class="cx">         debug(&quot;&quot;);
</span><span class="cx">     } else {
</span><span class="cx">         for (var j = 0; j &lt; testCases.length; j++)
</span><del>-            eval(testExpr(j));
</del><ins>+            eval(testCases[j].test);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>