<!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>[37712] trunk/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/37712">37712</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2008-10-19 22:58:02 -0700 (Sun, 19 Oct 2008)</dd>
</dl>

<h3>Log Message</h3>
<pre>2008-10-19  Darin Adler  &lt;darin@apple.com&gt;

        Reviewed by Cameron Zwarich.

        - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
          improve performance by eliminating JSValue as a base class for JSCell

        Change JSValuePtr from a typedef into a class. This allows us to support
        conversion from JSCell* to JSValuePtr even if JSCell isn't derived from
        JSValue.

        * JavaScriptCore.exp: Updated symbols that involve JSValuePtr, since
        it's now a distinct type.

        * API/APICast.h:
        (toRef): Extract the JSValuePtr payload explicitly since we can't just
        cast any more.
        * VM/CTI.cpp:
        (JSC::CTI::asInteger): Ditto.

        * VM/CodeGenerator.cpp:
        (JSC::CodeGenerator::addConstant): Get at the payload directly.
        (JSC::CodeGenerator::emitLoad): Added an overload of JSCell* because
        otherwise classes derived from JSValue end up calling the bool
        overload instead of JSValuePtr.
        * VM/CodeGenerator.h: Ditto. Also update traits to use JSValue*
        and the payload functions.

        * VM/Register.h: Added a JSCell* overload and use of payload functions.

        * kjs/JSCell.h:
        (JSC::asCell): Use payload function.
        (JSC::JSValue::asCell): Use JSValue* instead of JSValuePtr.
        (JSC::JSValuePtr::JSValuePtr): Added. Constructor that takes JSCell*
        and creates a JSValuePtr.

        * kjs/JSImmediate.h: Added JSValuePtr class. Also updated makeValue
        and makeInt to work with JSValue* and the payload function.

        * kjs/JSValue.h: Added == and != operators for JSValuePtr. Put them
        here because eventually all the JSValue functions should go here
        except what's needed by JSImmediate. Also fix asValue to use
        JSValue* instead of JSValuePtr.

        * kjs/PropertySlot.h: Change constructor to take JSValuePtr.

        * kjs/protect.h: Update gcProtect functions to work with JSCell*
        as well as JSValuePtr. Also updated the ProtectedPtr&lt;JSValuePtr&gt;
        specialization to work more directly. Also changed all the call
        sites to use gcProtectNullTolerant.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJavaScriptCoreAPIAPICasth">trunk/JavaScriptCore/API/APICast.h</a></li>
<li><a href="#trunkJavaScriptCoreChangeLog">trunk/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkJavaScriptCoreJavaScriptCoreexp">trunk/JavaScriptCore/JavaScriptCore.exp</a></li>
<li><a href="#trunkJavaScriptCoreVMCTIcpp">trunk/JavaScriptCore/VM/CTI.cpp</a></li>
<li><a href="#trunkJavaScriptCoreVMCodeGeneratorcpp">trunk/JavaScriptCore/VM/CodeGenerator.cpp</a></li>
<li><a href="#trunkJavaScriptCoreVMCodeGeneratorh">trunk/JavaScriptCore/VM/CodeGenerator.h</a></li>
<li><a href="#trunkJavaScriptCoreVMRegisterh">trunk/JavaScriptCore/VM/Register.h</a></li>
<li><a href="#trunkJavaScriptCorekjsJSCellh">trunk/JavaScriptCore/kjs/JSCell.h</a></li>
<li><a href="#trunkJavaScriptCorekjsJSImmediateh">trunk/JavaScriptCore/kjs/JSImmediate.h</a></li>
<li><a href="#trunkJavaScriptCorekjsJSValueh">trunk/JavaScriptCore/kjs/JSValue.h</a></li>
<li><a href="#trunkJavaScriptCorekjsPropertySloth">trunk/JavaScriptCore/kjs/PropertySlot.h</a></li>
<li><a href="#trunkJavaScriptCorekjsprotecth">trunk/JavaScriptCore/kjs/protect.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJavaScriptCoreAPIAPICasth"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/API/APICast.h (37711 => 37712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/API/APICast.h        2008-10-20 03:49:58 UTC (rev 37711)
+++ trunk/JavaScriptCore/API/APICast.h        2008-10-20 05:58:02 UTC (rev 37712)
</span><span class="lines">@@ -70,12 +70,12 @@
</span><span class="cx"> 
</span><span class="cx"> inline JSValueRef toRef(JSC::JSValuePtr v)
</span><span class="cx"> {
</span><del>-    return reinterpret_cast&lt;JSValueRef&gt;(v);
</del><ins>+    return reinterpret_cast&lt;JSValueRef&gt;(v.payload());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline JSValueRef* toRef(JSC::JSValuePtr* v)
</span><span class="cx"> {
</span><del>-    return reinterpret_cast&lt;JSValueRef*&gt;(const_cast&lt;const JSC::JSValue**&gt;(v));
</del><ins>+    return reinterpret_cast&lt;JSValueRef*&gt;(const_cast&lt;const JSC::JSValue**&gt;(v-&gt;payloadPtr()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline JSObjectRef toRef(JSC::JSObject* o)
</span></span></pre></div>
<a id="trunkJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/ChangeLog (37711 => 37712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/ChangeLog        2008-10-20 03:49:58 UTC (rev 37711)
+++ trunk/JavaScriptCore/ChangeLog        2008-10-20 05:58:02 UTC (rev 37712)
</span><span class="lines">@@ -1,5 +1,56 @@
</span><span class="cx"> 2008-10-19  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Reviewed by Cameron Zwarich.
+
+        - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
+          improve performance by eliminating JSValue as a base class for JSCell
+
+        Change JSValuePtr from a typedef into a class. This allows us to support
+        conversion from JSCell* to JSValuePtr even if JSCell isn't derived from
+        JSValue.
+
+        * JavaScriptCore.exp: Updated symbols that involve JSValuePtr, since
+        it's now a distinct type.
+
+        * API/APICast.h:
+        (toRef): Extract the JSValuePtr payload explicitly since we can't just
+        cast any more.
+        * VM/CTI.cpp:
+        (JSC::CTI::asInteger): Ditto.
+
+        * VM/CodeGenerator.cpp:
+        (JSC::CodeGenerator::addConstant): Get at the payload directly.
+        (JSC::CodeGenerator::emitLoad): Added an overload of JSCell* because
+        otherwise classes derived from JSValue end up calling the bool
+        overload instead of JSValuePtr.
+        * VM/CodeGenerator.h: Ditto. Also update traits to use JSValue*
+        and the payload functions.
+
+        * VM/Register.h: Added a JSCell* overload and use of payload functions.
+
+        * kjs/JSCell.h:
+        (JSC::asCell): Use payload function.
+        (JSC::JSValue::asCell): Use JSValue* instead of JSValuePtr.
+        (JSC::JSValuePtr::JSValuePtr): Added. Constructor that takes JSCell*
+        and creates a JSValuePtr.
+
+        * kjs/JSImmediate.h: Added JSValuePtr class. Also updated makeValue
+        and makeInt to work with JSValue* and the payload function.
+
+        * kjs/JSValue.h: Added == and != operators for JSValuePtr. Put them
+        here because eventually all the JSValue functions should go here
+        except what's needed by JSImmediate. Also fix asValue to use
+        JSValue* instead of JSValuePtr.
+
+        * kjs/PropertySlot.h: Change constructor to take JSValuePtr.
+
+        * kjs/protect.h: Update gcProtect functions to work with JSCell*
+        as well as JSValuePtr. Also updated the ProtectedPtr&lt;JSValuePtr&gt;
+        specialization to work more directly. Also changed all the call
+        sites to use gcProtectNullTolerant.
+
+2008-10-19  Darin Adler  &lt;darin@apple.com&gt;
+
</ins><span class="cx">         Reviewed by Oliver Hunt.
</span><span class="cx"> 
</span><span class="cx">         - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
</span></span></pre></div>
<a id="trunkJavaScriptCoreJavaScriptCoreexp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/JavaScriptCore.exp (37711 => 37712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/JavaScriptCore.exp        2008-10-20 03:49:58 UTC (rev 37711)
+++ trunk/JavaScriptCore/JavaScriptCore.exp        2008-10-20 05:58:02 UTC (rev 37712)
</span><span class="lines">@@ -102,11 +102,11 @@
</span><span class="cx"> __ZN3JSC11Interpreter11checkSyntaxEPNS_9ExecStateERKNS_10SourceCodeE
</span><span class="cx"> __ZN3JSC11Interpreter21shouldPrintExceptionsEv
</span><span class="cx"> __ZN3JSC11Interpreter24setShouldPrintExceptionsEb
</span><del>-__ZN3JSC11Interpreter8evaluateEPNS_9ExecStateERNS_10ScopeChainERKNS_10SourceCodeEPNS_7JSValueE
</del><ins>+__ZN3JSC11Interpreter8evaluateEPNS_9ExecStateERNS_10ScopeChainERKNS_10SourceCodeENS_10JSValuePtrE
</ins><span class="cx"> __ZN3JSC11JSImmediate12nonInlineNaNEv
</span><del>-__ZN3JSC11JSImmediate8toObjectEPNS_7JSValueEPNS_9ExecStateE
-__ZN3JSC11JSImmediate8toStringEPNS_7JSValueE
-__ZN3JSC11JSImmediate9prototypeEPNS_7JSValueEPNS_9ExecStateE
</del><ins>+__ZN3JSC11JSImmediate8toObjectENS_10JSValuePtrEPNS_9ExecStateE
+__ZN3JSC11JSImmediate8toStringENS_10JSValuePtrE
+__ZN3JSC11JSImmediate9prototypeENS_10JSValuePtrEPNS_9ExecStateE
</ins><span class="cx"> __ZN3JSC11ProfileNode4sortEPFbRKN3WTF6RefPtrIS0_EES5_E
</span><span class="cx"> __ZN3JSC11ProgramNode6createEPNS_12JSGlobalDataEPNS_14SourceElementsEPN3WTF6VectorISt4pairINS_10IdentifierEjELm16EEEPNS6_INS5_6RefPtrINS_12FuncDeclNodeEEELm16EEERKNS_10SourceCodeEji
</span><span class="cx"> __ZN3JSC11PropertyMap3getERKNS_10IdentifierERj
</span><span class="lines">@@ -115,9 +115,9 @@
</span><span class="cx"> __ZN3JSC11StructureID21addPropertyTransitionEPS0_RKNS_10IdentifierEjRm
</span><span class="cx"> __ZN3JSC11StructureID21clearEnumerationCacheEv
</span><span class="cx"> __ZN3JSC11StructureID24fromDictionaryTransitionEPS0_
</span><del>-__ZN3JSC11StructureID25changePrototypeTransitionEPS0_PNS_7JSValueE
</del><ins>+__ZN3JSC11StructureID25changePrototypeTransitionEPS0_NS_10JSValuePtrE
</ins><span class="cx"> __ZN3JSC11StructureID27growPropertyStorageCapacityEv
</span><del>-__ZN3JSC11StructureIDC1EPNS_7JSValueERKNS_8TypeInfoE
</del><ins>+__ZN3JSC11StructureIDC1ENS_10JSValuePtrERKNS_8TypeInfoE
</ins><span class="cx"> __ZN3JSC11StructureIDD1Ev
</span><span class="cx"> __ZN3JSC12DateInstance4infoE
</span><span class="cx"> __ZN3JSC12JSGlobalData10ClientDataD2Ev
</span><span class="lines">@@ -133,7 +133,7 @@
</span><span class="cx"> __ZN3JSC12StringObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
</span><span class="cx"> __ZN3JSC12StringObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
</span><span class="cx"> __ZN3JSC12StringObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
</span><del>-__ZN3JSC12StringObject3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueERNS_15PutPropertySlotE
</del><ins>+__ZN3JSC12StringObject3putEPNS_9ExecStateERKNS_10IdentifierENS_10JSValuePtrERNS_15PutPropertySlotE
</ins><span class="cx"> __ZN3JSC12StringObject4infoE
</span><span class="cx"> __ZN3JSC12StringObjectC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_11StructureIDEEERKNS_7UStringE
</span><span class="cx"> __ZN3JSC12jsNumberCellEPNS_9ExecStateEd
</span><span class="lines">@@ -145,10 +145,10 @@
</span><span class="cx"> __ZN3JSC14JSGlobalObject12defineSetterEPNS_9ExecStateERKNS_10IdentifierEPNS_8JSObjectE
</span><span class="cx"> __ZN3JSC14JSGlobalObject14setTimeoutTimeEj
</span><span class="cx"> __ZN3JSC14JSGlobalObject16stopTimeoutCheckEv
</span><del>-__ZN3JSC14JSGlobalObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueEj
</del><ins>+__ZN3JSC14JSGlobalObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_10JSValuePtrEj
</ins><span class="cx"> __ZN3JSC14JSGlobalObject17startTimeoutCheckEv
</span><span class="cx"> __ZN3JSC14JSGlobalObject29markCrossHeapDependentObjectsEv
</span><del>-__ZN3JSC14JSGlobalObject3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueERNS_15PutPropertySlotE
</del><ins>+__ZN3JSC14JSGlobalObject3putEPNS_9ExecStateERKNS_10IdentifierENS_10JSValuePtrERNS_15PutPropertySlotE
</ins><span class="cx"> __ZN3JSC14JSGlobalObject4initEPNS_8JSObjectE
</span><span class="cx"> __ZN3JSC14JSGlobalObject4markEv
</span><span class="cx"> __ZN3JSC14JSGlobalObjectD2Ev
</span><span class="lines">@@ -165,13 +165,13 @@
</span><span class="cx"> __ZN3JSC16ParserRefCounted3refEv
</span><span class="cx"> __ZN3JSC16ParserRefCounted5derefEv
</span><span class="cx"> __ZN3JSC17PropertyNameArray3addEPNS_7UString3RepE
</span><del>-__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEN3WTF10PassRefPtrINS_11StructureIDEEEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectESB_RKNS_7ArgListEE
-__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectES7_RKNS_7ArgListEE
</del><ins>+__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEN3WTF10PassRefPtrINS_11StructureIDEEEiRKNS_10IdentifierEPFNS_10JSValuePtrES2_PNS_8JSObjectESA_RKNS_7ArgListEE
+__ZN3JSC17PrototypeFunctionC1EPNS_9ExecStateEiRKNS_10IdentifierEPFNS_10JSValuePtrES2_PNS_8JSObjectES6_RKNS_7ArgListEE
</ins><span class="cx"> __ZN3JSC17constructFunctionEPNS_9ExecStateERKNS_7ArgListERKNS_10IdentifierERKNS_7UStringEi
</span><span class="cx"> __ZN3JSC19constructEmptyArrayEPNS_9ExecStateE
</span><span class="cx"> __ZN3JSC19initializeThreadingEv
</span><span class="cx"> __ZN3JSC20constructEmptyObjectEPNS_9ExecStateE
</span><del>-__ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectEPNS_7JSValueERKNS_7ArgListE
</del><ins>+__ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_10JSValuePtrERKNS_7ArgListE
</ins><span class="cx"> __ZN3JSC23setUpStaticFunctionSlotEPNS_9ExecStateEPKNS_9HashEntryEPNS_8JSObjectERKNS_10IdentifierERNS_12PropertySlotE
</span><span class="cx"> __ZN3JSC4Heap14allocateNumberEm
</span><span class="cx"> __ZN3JSC4Heap14primaryHeapEndEv
</span><span class="lines">@@ -182,13 +182,13 @@
</span><span class="cx"> __ZN3JSC4Heap24setGCProtectNeedsLockingEv
</span><span class="cx"> __ZN3JSC4Heap25protectedObjectTypeCountsEv
</span><span class="cx"> __ZN3JSC4Heap26protectedGlobalObjectCountEv
</span><del>-__ZN3JSC4Heap4heapEPNS_7JSValueE
</del><ins>+__ZN3JSC4Heap4heapENS_10JSValuePtrE
</ins><span class="cx"> __ZN3JSC4Heap4sizeEv
</span><span class="cx"> __ZN3JSC4Heap7collectEv
</span><del>-__ZN3JSC4Heap7protectEPNS_7JSValueE
</del><ins>+__ZN3JSC4Heap7protectENS_10JSValuePtrE
</ins><span class="cx"> __ZN3JSC4Heap8allocateEm
</span><del>-__ZN3JSC4Heap9unprotectEPNS_7JSValueE
-__ZN3JSC4callEPNS_9ExecStateEPNS_7JSValueENS_8CallTypeERKNS_8CallDataES3_RKNS_7ArgListE
</del><ins>+__ZN3JSC4Heap9unprotectENS_10JSValuePtrE
+__ZN3JSC4callEPNS_9ExecStateENS_10JSValuePtrENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListE
</ins><span class="cx"> __ZN3JSC5equalEPKNS_7UString3RepES3_
</span><span class="cx"> __ZN3JSC6JSCell11getCallDataERNS_8CallDataE
</span><span class="cx"> __ZN3JSC6JSCell11getJSNumberEv
</span><span class="lines">@@ -198,8 +198,8 @@
</span><span class="cx"> __ZN3JSC6JSCell16getConstructDataERNS_13ConstructDataE
</span><span class="cx"> __ZN3JSC6JSCell18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
</span><span class="cx"> __ZN3JSC6JSCell18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
</span><del>-__ZN3JSC6JSCell3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueERNS_15PutPropertySlotE
-__ZN3JSC6JSCell3putEPNS_9ExecStateEjPNS_7JSValueE
</del><ins>+__ZN3JSC6JSCell3putEPNS_9ExecStateERKNS_10IdentifierENS_10JSValuePtrERNS_15PutPropertySlotE
+__ZN3JSC6JSCell3putEPNS_9ExecStateEjNS_10JSValuePtrE
</ins><span class="cx"> __ZN3JSC6JSCell9getObjectEv
</span><span class="cx"> __ZN3JSC6JSCellnwEmPNS_9ExecStateE
</span><span class="cx"> __ZN3JSC6JSLock12DropAllLocksC1EPNS_9ExecStateE
</span><span class="lines">@@ -211,7 +211,7 @@
</span><span class="cx"> __ZN3JSC6JSLockC1EPNS_9ExecStateE
</span><span class="cx"> __ZN3JSC6Parser5parseEPNS_12JSGlobalDataEPiPNS_7UStringE
</span><span class="cx"> __ZN3JSC6strtodEPKcPPc
</span><del>-__ZN3JSC7ArgList10slowAppendEPNS_7JSValueE
</del><ins>+__ZN3JSC7ArgList10slowAppendENS_10JSValuePtrE
</ins><span class="cx"> __ZN3JSC7CStringD1Ev
</span><span class="cx"> __ZN3JSC7CStringaSERKS0_
</span><span class="cx"> __ZN3JSC7JSArray4infoE
</span><span class="lines">@@ -233,7 +233,7 @@
</span><span class="cx"> __ZN3JSC8Debugger6detachEPNS_14JSGlobalObjectE
</span><span class="cx"> __ZN3JSC8DebuggerC2Ev
</span><span class="cx"> __ZN3JSC8DebuggerD2Ev
</span><del>-__ZN3JSC8JSObject11hasInstanceEPNS_9ExecStateEPNS_7JSValueES4_
</del><ins>+__ZN3JSC8JSObject11hasInstanceEPNS_9ExecStateENS_10JSValuePtrES3_
</ins><span class="cx"> __ZN3JSC8JSObject12defineGetterEPNS_9ExecStateERKNS_10IdentifierEPS0_
</span><span class="cx"> __ZN3JSC8JSObject12defineSetterEPNS_9ExecStateERKNS_10IdentifierEPS0_
</span><span class="cx"> __ZN3JSC8JSObject12lookupGetterEPNS_9ExecStateERKNS_10IdentifierE
</span><span class="lines">@@ -243,14 +243,14 @@
</span><span class="cx"> __ZN3JSC8JSObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
</span><span class="cx"> __ZN3JSC8JSObject17createInheritorIDEv
</span><span class="cx"> __ZN3JSC8JSObject17putDirectFunctionEPNS_9ExecStateEPNS_16InternalFunctionEj
</span><del>-__ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueEj
-__ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateEjPNS_7JSValueEj
</del><ins>+__ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_10JSValuePtrEj
+__ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateEjNS_10JSValuePtrEj
</ins><span class="cx"> __ZN3JSC8JSObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
</span><del>-__ZN3JSC8JSObject18getPrimitiveNumberEPNS_9ExecStateERdRPNS_7JSValueE
-__ZN3JSC8JSObject22fillGetterPropertySlotERNS_12PropertySlotEPPNS_7JSValueE
</del><ins>+__ZN3JSC8JSObject18getPrimitiveNumberEPNS_9ExecStateERdRNS_10JSValuePtrE
+__ZN3JSC8JSObject22fillGetterPropertySlotERNS_12PropertySlotEPNS_10JSValuePtrE
</ins><span class="cx"> __ZN3JSC8JSObject23allocatePropertyStorageEmm
</span><del>-__ZN3JSC8JSObject3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueERNS_15PutPropertySlotE
-__ZN3JSC8JSObject3putEPNS_9ExecStateEjPNS_7JSValueE
</del><ins>+__ZN3JSC8JSObject3putEPNS_9ExecStateERKNS_10IdentifierENS_10JSValuePtrERNS_15PutPropertySlotE
+__ZN3JSC8JSObject3putEPNS_9ExecStateEjNS_10JSValuePtrE
</ins><span class="cx"> __ZN3JSC8JSObject4markEv
</span><span class="cx"> __ZN3JSC8Profiler13stopProfilingEPNS_9ExecStateERKNS_7UStringE
</span><span class="cx"> __ZN3JSC8Profiler14startProfilingEPNS_9ExecStateERKNS_7UStringE
</span><span class="lines">@@ -258,7 +258,7 @@
</span><span class="cx"> __ZN3JSC8jsStringEPNS_12JSGlobalDataERKNS_7UStringE
</span><span class="cx"> __ZN3JSC9CodeBlockD1Ev
</span><span class="cx"> __ZN3JSC9CodeBlockD2Ev
</span><del>-__ZN3JSC9constructEPNS_9ExecStateEPNS_7JSValueENS_13ConstructTypeERKNS_13ConstructDataERKNS_7ArgListE
</del><ins>+__ZN3JSC9constructEPNS_9ExecStateENS_10JSValuePtrENS_13ConstructTypeERKNS_13ConstructDataERKNS_7ArgListE
</ins><span class="cx"> __ZN3JSCeqERKNS_7UStringEPKc
</span><span class="cx"> __ZN3JSCgtERKNS_7UStringES2_
</span><span class="cx"> __ZN3JSCltERKNS_7UStringES2_
</span><span class="lines">@@ -309,7 +309,7 @@
</span><span class="cx"> __ZNK3JSC17DebuggerCallFrame10thisObjectEv
</span><span class="cx"> __ZNK3JSC17DebuggerCallFrame12functionNameEv
</span><span class="cx"> __ZNK3JSC17DebuggerCallFrame4typeEv
</span><del>-__ZNK3JSC17DebuggerCallFrame8evaluateERKNS_7UStringERPNS_7JSValueE
</del><ins>+__ZNK3JSC17DebuggerCallFrame8evaluateERKNS_7UStringERNS_10JSValuePtrE
</ins><span class="cx"> __ZNK3JSC4Node8toStringEv
</span><span class="cx"> __ZNK3JSC6JSCell12toThisObjectEPNS_9ExecStateE
</span><span class="cx"> __ZNK3JSC6JSCell12toThisStringEPNS_9ExecStateE
</span><span class="lines">@@ -327,7 +327,7 @@
</span><span class="cx"> __ZNK3JSC7JSValue7toFloatEPNS_9ExecStateE
</span><span class="cx"> __ZNK3JSC7JSValue9toIntegerEPNS_9ExecStateE
</span><span class="cx"> __ZNK3JSC7Machine14retrieveCallerEPNS_9ExecStateEPNS_16InternalFunctionE
</span><del>-__ZNK3JSC7Machine18retrieveLastCallerEPNS_9ExecStateERiRlRNS_7UStringERPNS_7JSValueE
</del><ins>+__ZNK3JSC7Machine18retrieveLastCallerEPNS_9ExecStateERiRlRNS_7UStringERNS_10JSValuePtrE
</ins><span class="cx"> __ZNK3JSC7UString10UTF8StringEb
</span><span class="cx"> __ZNK3JSC7UString14toStrictUInt32EPb
</span><span class="cx"> __ZNK3JSC7UString5asciiEv
</span></span></pre></div>
<a id="trunkJavaScriptCoreVMCTIcpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/VM/CTI.cpp (37711 => 37712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/VM/CTI.cpp        2008-10-20 03:49:58 UTC (rev 37711)
+++ trunk/JavaScriptCore/VM/CTI.cpp        2008-10-20 05:58:02 UTC (rev 37712)
</span><span class="lines">@@ -179,7 +179,7 @@
</span><span class="cx"> 
</span><span class="cx"> inline uintptr_t CTI::asInteger(JSValuePtr value)
</span><span class="cx"> {
</span><del>-    return reinterpret_cast&lt;uintptr_t&gt;(value);
</del><ins>+    return reinterpret_cast&lt;uintptr_t&gt;(value.payload());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // get arg puts an arg from the SF register array into a h/w register
</span></span></pre></div>
<a id="trunkJavaScriptCoreVMCodeGeneratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/VM/CodeGenerator.cpp (37711 => 37712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/VM/CodeGenerator.cpp        2008-10-20 03:49:58 UTC (rev 37711)
+++ trunk/JavaScriptCore/VM/CodeGenerator.cpp        2008-10-20 05:58:02 UTC (rev 37712)
</span><span class="lines">@@ -619,7 +619,7 @@
</span><span class="cx"> 
</span><span class="cx"> RegisterID* CodeGenerator::addConstant(JSValuePtr v)
</span><span class="cx"> {
</span><del>-    pair&lt;JSValueMap::iterator, bool&gt; result = m_jsValueMap.add(v, m_nextConstant);
</del><ins>+    pair&lt;JSValueMap::iterator, bool&gt; result = m_jsValueMap.add(v.payload(), m_nextConstant);
</ins><span class="cx">     if (result.second) {
</span><span class="cx">         RegisterID&amp; constant = m_calleeRegisters[m_nextConstant];
</span><span class="cx">         
</span><span class="lines">@@ -805,6 +805,12 @@
</span><span class="cx">     return constantID;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+RegisterID* CodeGenerator::emitLoad(RegisterID* dst, JSCell* cell)
+{
+    JSValuePtr value = cell;
+    return emitLoad(dst, value);
+}
+
</ins><span class="cx"> RegisterID* CodeGenerator::emitUnexpectedLoad(RegisterID* dst, bool b)
</span><span class="cx"> {
</span><span class="cx">     emitOpcode(op_unexpected_load);
</span></span></pre></div>
<a id="trunkJavaScriptCoreVMCodeGeneratorh"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/VM/CodeGenerator.h (37711 => 37712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/VM/CodeGenerator.h        2008-10-20 03:49:58 UTC (rev 37711)
+++ trunk/JavaScriptCore/VM/CodeGenerator.h        2008-10-20 05:58:02 UTC (rev 37712)
</span><span class="lines">@@ -229,6 +229,7 @@
</span><span class="cx">         RegisterID* emitLoad(RegisterID* dst, double);
</span><span class="cx">         RegisterID* emitLoad(RegisterID* dst, const Identifier&amp;);
</span><span class="cx">         RegisterID* emitLoad(RegisterID* dst, JSValuePtr);
</span><ins>+        RegisterID* emitLoad(RegisterID* dst, JSCell*);
</ins><span class="cx">         RegisterID* emitUnexpectedLoad(RegisterID* dst, bool);
</span><span class="cx">         RegisterID* emitUnexpectedLoad(RegisterID* dst, double);
</span><span class="cx"> 
</span><span class="lines">@@ -329,12 +330,12 @@
</span><span class="cx"> 
</span><span class="cx">         PassRefPtr&lt;LabelID&gt; emitComplexJumpScopes(LabelID* target, ControlFlowContext* topScope, ControlFlowContext* bottomScope);
</span><span class="cx"> 
</span><del>-        struct JSValueHashTraits : HashTraits&lt;JSValuePtr&gt; {
-            static void constructDeletedValue(JSValuePtr&amp; slot) { slot = JSImmediate::impossibleValue(); }
-            static bool isDeletedValue(JSValuePtr value) { return value == JSImmediate::impossibleValue(); }
</del><ins>+        struct JSValueHashTraits : HashTraits&lt;JSValue*&gt; {
+            static void constructDeletedValue(JSValue*&amp; slot) { slot = JSImmediate::impossibleValue().payload(); }
+            static bool isDeletedValue(JSValue* value) { return value == JSImmediate::impossibleValue().payload(); }
</ins><span class="cx">         };
</span><span class="cx"> 
</span><del>-        typedef HashMap&lt;JSValuePtr, unsigned, PtrHash&lt;JSValuePtr&gt;, JSValueHashTraits&gt; JSValueMap;
</del><ins>+        typedef HashMap&lt;JSValue*, unsigned, PtrHash&lt;JSValue*&gt;, JSValueHashTraits&gt; JSValueMap;
</ins><span class="cx"> 
</span><span class="cx">         struct IdentifierMapIndexHashTraits {
</span><span class="cx">             typedef int TraitType;
</span><span class="lines">@@ -398,7 +399,7 @@
</span><span class="cx">         unsigned addConstant(const Identifier&amp;);
</span><span class="cx">         RegisterID* addConstant(JSValuePtr);
</span><span class="cx">         unsigned addUnexpectedConstant(JSValuePtr);
</span><del>-        unsigned addRegExp(RegExp* r);
</del><ins>+        unsigned addRegExp(RegExp*);
</ins><span class="cx">         StructureID* addStructureID();
</span><span class="cx"> 
</span><span class="cx">         Vector&lt;Instruction&gt;&amp; instructions() { return m_codeBlock-&gt;instructions; }
</span></span></pre></div>
<a id="trunkJavaScriptCoreVMRegisterh"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/VM/Register.h (37711 => 37712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/VM/Register.h        2008-10-20 03:49:58 UTC (rev 37711)
+++ trunk/JavaScriptCore/VM/Register.h        2008-10-20 05:58:02 UTC (rev 37712)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx">     public:
</span><span class="cx">         Register();
</span><span class="cx">         Register(JSValuePtr);
</span><ins>+        Register(JSCell*);
</ins><span class="cx"> 
</span><span class="cx">         JSValuePtr jsValue(CallFrame*) const;
</span><span class="cx">         JSValuePtr getJSValue() const;
</span><span class="lines">@@ -89,7 +90,7 @@
</span><span class="cx">         union {
</span><span class="cx">             intptr_t i;
</span><span class="cx">             void* v;
</span><del>-            JSValuePtr value;
</del><ins>+            JSValue* value;
</ins><span class="cx"> 
</span><span class="cx">             JSActivation* activation;
</span><span class="cx">             Arguments* arguments;
</span><span class="lines">@@ -142,9 +143,15 @@
</span><span class="cx">     ALWAYS_INLINE Register::Register(JSValuePtr v)
</span><span class="cx">     {
</span><span class="cx">         SET_TYPE(ValueType);
</span><del>-        u.value = v;
</del><ins>+        u.value = v.payload();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    ALWAYS_INLINE Register::Register(JSCell* v)
+    {
+        SET_TYPE(ValueType);
+        u.value = JSValuePtr(v).payload();
+    }
+
</ins><span class="cx">     // This function is scaffolding for legacy clients. It will eventually go away.
</span><span class="cx">     ALWAYS_INLINE JSValuePtr Register::jsValue(CallFrame*) const
</span><span class="cx">     {
</span></span></pre></div>
<a id="trunkJavaScriptCorekjsJSCellh"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/kjs/JSCell.h (37711 => 37712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/kjs/JSCell.h        2008-10-20 03:49:58 UTC (rev 37711)
+++ trunk/JavaScriptCore/kjs/JSCell.h        2008-10-20 05:58:02 UTC (rev 37712)
</span><span class="lines">@@ -110,7 +110,7 @@
</span><span class="cx">     inline JSCell* asCell(JSValuePtr value)
</span><span class="cx">     {
</span><span class="cx">         ASSERT(!JSImmediate::isImmediate(value));
</span><del>-        return static_cast&lt;JSCell*&gt;(value);
</del><ins>+        return static_cast&lt;JSCell*&gt;(value.payload());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     inline JSCell::JSCell(StructureID* structureID)
</span><span class="lines">@@ -155,7 +155,7 @@
</span><span class="cx">     ALWAYS_INLINE JSCell* JSValue::asCell() const
</span><span class="cx">     {
</span><span class="cx">         ASSERT(!JSImmediate::isImmediate(asValue()));
</span><del>-        return reinterpret_cast&lt;JSCell*&gt;(const_cast&lt;JSValuePtr&gt;(this));
</del><ins>+        return reinterpret_cast&lt;JSCell*&gt;(const_cast&lt;JSValue*&gt;(this));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     inline void* JSCell::operator new(size_t size, JSGlobalData* globalData)
</span><span class="lines">@@ -167,6 +167,13 @@
</span><span class="cx"> #endif
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // --- JSValuePtr inlines ----------------------------
+
+    inline JSValuePtr::JSValuePtr(const JSCell* cell)
+        : m_payload(reinterpret_cast&lt;JSValue*&gt;(const_cast&lt;JSCell*&gt;(cell)))
+    {
+    }
+
</ins><span class="cx">     // --- JSValue inlines ----------------------------
</span><span class="cx"> 
</span><span class="cx">     inline bool JSValue::isNumber() const
</span></span></pre></div>
<a id="trunkJavaScriptCorekjsJSImmediateh"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/kjs/JSImmediate.h (37711 => 37712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/kjs/JSImmediate.h        2008-10-20 03:49:58 UTC (rev 37711)
+++ trunk/JavaScriptCore/kjs/JSImmediate.h        2008-10-20 05:58:02 UTC (rev 37712)
</span><span class="lines">@@ -34,15 +34,35 @@
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="cx">     class ExecState;
</span><ins>+    class JSCell;
</ins><span class="cx">     class JSObject;
</span><span class="cx">     class JSValue;
</span><span class="cx">     class UString;
</span><span class="cx"> 
</span><del>-    typedef JSValue* JSValuePtr;
</del><ins>+    class JSValuePtr {
+    public:
+        JSValuePtr() { } // uninitialized (not zero)
+        JSValuePtr(const JSValue* payload) : m_payload(const_cast&lt;JSValue*&gt;(payload)) { }
+        JSValuePtr(const JSCell*);
</ins><span class="cx"> 
</span><del>-    inline JSValuePtr noValue() { return 0; }
-    inline void* asPointer(JSValuePtr value) { return value; }
</del><ins>+        JSValue* payload() const { return m_payload; }
+        JSValue** payloadPtr() { return &amp;m_payload; }
</ins><span class="cx"> 
</span><ins>+        bool operator!() const { return !payload(); }
+    
+        // This conversion operator allows implicit conversion to bool but not to other integer types.
+        typedef JSValue* JSValuePtr::*UnspecifiedBoolType;
+        operator UnspecifiedBoolType() const { return payload() ? &amp;JSValuePtr::m_payload : 0; }
+
+        JSValue* operator-&gt;() const { return payload(); }
+
+    private:
+        JSValue* m_payload;
+    };
+
+    inline JSValuePtr noValue() { return static_cast&lt;JSValue*&gt;(0); }
+    inline void* asPointer(JSValuePtr value) { return value.payload(); }
+
</ins><span class="cx">     /*
</span><span class="cx">      * A JSValuePtr is either a pointer to a cell (a heap-allocated object) or an immediate (a type-tagged 
</span><span class="cx">      * value masquerading as a pointer). The low two bits in a JSValuePtr are available for type tagging
</span><span class="lines">@@ -261,7 +281,7 @@
</span><span class="cx"> 
</span><span class="cx">         static ALWAYS_INLINE JSValuePtr makeValue(uintptr_t integer)
</span><span class="cx">         {
</span><del>-            return reinterpret_cast&lt;JSValuePtr&gt;(integer);
</del><ins>+            return reinterpret_cast&lt;JSValue*&gt;(integer);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         static ALWAYS_INLINE JSValuePtr makeInt(int32_t value)
</span><span class="lines">@@ -301,7 +321,7 @@
</span><span class="cx">         
</span><span class="cx">         static ALWAYS_INLINE uintptr_t rawValue(JSValuePtr v)
</span><span class="cx">         {
</span><del>-            return reinterpret_cast&lt;uintptr_t&gt;(v);
</del><ins>+            return reinterpret_cast&lt;uintptr_t&gt;(v.payload());
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         static double nonInlineNaN();
</span></span></pre></div>
<a id="trunkJavaScriptCorekjsJSValueh"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/kjs/JSValue.h (37711 => 37712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/kjs/JSValue.h        2008-10-20 03:49:58 UTC (rev 37711)
+++ trunk/JavaScriptCore/kjs/JSValue.h        2008-10-20 05:58:02 UTC (rev 37712)
</span><span class="lines">@@ -150,6 +150,9 @@
</span><span class="cx">         uint32_t toUInt32SlowCase(ExecState*, bool&amp; ok) const;
</span><span class="cx">     };
</span><span class="cx"> 
</span><ins>+    bool operator==(JSValuePtr, JSValuePtr);
+    bool operator!=(JSValuePtr, JSValuePtr);
+
</ins><span class="cx">     // These are identical logic to the JSValue functions above, and faster than jsNumber(number)-&gt;toInt32().
</span><span class="cx">     int32_t toInt32(double);
</span><span class="cx">     uint32_t toUInt32(double);
</span><span class="lines">@@ -166,7 +169,7 @@
</span><span class="cx"> 
</span><span class="cx">     inline JSValuePtr JSValue::asValue() const
</span><span class="cx">     {
</span><del>-        return const_cast&lt;JSValuePtr&gt;(this);
</del><ins>+        return const_cast&lt;JSValue*&gt;(this);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     inline bool JSValue::isUndefined() const
</span><span class="lines">@@ -260,6 +263,16 @@
</span><span class="cx">         return toUInt32SlowCase(exec, ok);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    inline bool operator==(JSValuePtr a, JSValuePtr b)
+    {
+        return a.payload() == b.payload();
+    }
+
+    inline bool operator!=(JSValuePtr a, JSValuePtr b)
+    {
+        return a.payload() != b.payload();
+    }
+
</ins><span class="cx"> } // namespace JSC
</span><span class="cx"> 
</span><span class="cx"> #endif // JSValue_h
</span></span></pre></div>
<a id="trunkJavaScriptCorekjsPropertySloth"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/kjs/PropertySlot.h (37711 => 37712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/kjs/PropertySlot.h        2008-10-20 03:49:58 UTC (rev 37711)
+++ trunk/JavaScriptCore/kjs/PropertySlot.h        2008-10-20 05:58:02 UTC (rev 37712)
</span><span class="lines">@@ -44,8 +44,8 @@
</span><span class="cx">             clearValue();
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        explicit PropertySlot(const JSValue* base)
-            : m_slotBase(const_cast&lt;JSValuePtr&gt;(base))
</del><ins>+        explicit PropertySlot(JSValuePtr base)
+            : m_slotBase(base)
</ins><span class="cx">             , m_offset(WTF::notFound)
</span><span class="cx">         {
</span><span class="cx">             clearValue();
</span></span></pre></div>
<a id="trunkJavaScriptCorekjsprotecth"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/kjs/protect.h (37711 => 37712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/kjs/protect.h        2008-10-20 03:49:58 UTC (rev 37711)
+++ trunk/JavaScriptCore/kjs/protect.h        2008-10-20 05:58:02 UTC (rev 37712)
</span><span class="lines">@@ -22,37 +22,61 @@
</span><span class="cx"> #ifndef protect_h
</span><span class="cx"> #define protect_h
</span><span class="cx"> 
</span><del>-#include &quot;JSValue.h&quot;
</del><ins>+#include &quot;JSCell.h&quot;
</ins><span class="cx"> #include &quot;collector.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><del>-    inline void gcProtect(JSValuePtr val) 
</del><ins>+    inline void gcProtect(JSCell* val) 
</ins><span class="cx">     {
</span><del>-        Heap* heap = Heap::heap(val);
-        if (heap)
-            heap-&gt;protect(val);
</del><ins>+        Heap::heap(val)-&gt;protect(val);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    inline void gcUnprotect(JSValuePtr val)
</del><ins>+    inline void gcUnprotect(JSCell* val)
</ins><span class="cx">     {
</span><del>-        Heap* heap = Heap::heap(val);
-        if (heap)
-            heap-&gt;unprotect(val);
</del><ins>+        Heap::heap(val)-&gt;unprotect(val);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    inline void gcProtectNullTolerant(JSValuePtr val) 
</del><ins>+    inline void gcProtectNullTolerant(JSCell* val) 
</ins><span class="cx">     {
</span><span class="cx">         if (val) 
</span><span class="cx">             gcProtect(val);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    inline void gcUnprotectNullTolerant(JSValuePtr val) 
</del><ins>+    inline void gcUnprotectNullTolerant(JSCell* val) 
</ins><span class="cx">     {
</span><span class="cx">         if (val) 
</span><span class="cx">             gcUnprotect(val);
</span><span class="cx">     }
</span><span class="cx">     
</span><ins>+    inline void gcProtect(JSValuePtr value)
+    {
+        if (JSImmediate::isImmediate(value))
+            return;
+        gcProtect(asCell(value));
+    }
+
+    inline void gcUnprotect(JSValuePtr value)
+    {
+        if (JSImmediate::isImmediate(value))
+            return;
+        gcUnprotect(asCell(value));
+    }
+
+    inline void gcProtectNullTolerant(JSValuePtr value)
+    {
+        if (!value || JSImmediate::isImmediate(value))
+            return;
+        gcProtect(asCell(value));
+    }
+
+    inline void gcUnprotectNullTolerant(JSValuePtr value)
+    {
+        if (!value || JSImmediate::isImmediate(value))
+            return;
+        gcUnprotect(asCell(value));
+    }
+
</ins><span class="cx">     // FIXME: Share more code with RefPtr template? The only differences are the ref/deref operation
</span><span class="cx">     // and the implicit conversion to raw pointer
</span><span class="cx">     template &lt;class T&gt; class ProtectedPtr {
</span><span class="lines">@@ -65,6 +89,7 @@
</span><span class="cx">         template &lt;class U&gt; ProtectedPtr(const ProtectedPtr&lt;U&gt;&amp;);
</span><span class="cx">         
</span><span class="cx">         T* get() const { return m_ptr; }
</span><ins>+        operator JSValuePtr() const { return m_ptr; }
</ins><span class="cx">         operator T*() const { return m_ptr; }
</span><span class="cx">         T* operator-&gt;() const { return m_ptr; }
</span><span class="cx">         
</span><span class="lines">@@ -79,46 +104,48 @@
</span><span class="cx"> 
</span><span class="cx">     template &lt;&gt; class ProtectedPtr&lt;JSValuePtr&gt; {
</span><span class="cx">     public:
</span><del>-        ProtectedPtr() { }
-        ProtectedPtr(JSValuePtr ptr) : m_ptr(ptr) { }
</del><ins>+        ProtectedPtr() : m_ptr(0) { }
+        ProtectedPtr(JSValuePtr);
+        ProtectedPtr(const ProtectedPtr&amp;);
+        ~ProtectedPtr();
</ins><span class="cx"> 
</span><del>-        template &lt;class U&gt; ProtectedPtr(const ProtectedPtr&lt;U&gt;&amp; ptr) : m_ptr(ptr) { }
</del><ins>+        template &lt;class U&gt; ProtectedPtr(const ProtectedPtr&lt;U&gt;&amp;);
</ins><span class="cx">         
</span><del>-        JSValuePtr get() const { return m_ptr; }
</del><ins>+        JSValue* get() const { return m_ptr; }
</ins><span class="cx">         operator JSValuePtr() const { return m_ptr; }
</span><ins>+        operator JSValue*() const { return m_ptr; }
</ins><span class="cx">         JSValue* operator-&gt;() const { return m_ptr; }
</span><span class="cx">         
</span><span class="cx">         bool operator!() const { return !m_ptr; }
</span><ins>+
+        ProtectedPtr&amp; operator=(JSValuePtr);
+        ProtectedPtr&amp; operator=(const ProtectedPtr&amp;);
</ins><span class="cx">         
</span><span class="cx">     private:
</span><del>-        ProtectedPtr&lt;JSValue&gt; m_ptr;
</del><ins>+        JSValue* m_ptr;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     template &lt;class T&gt; ProtectedPtr&lt;T&gt;::ProtectedPtr(T* ptr)
</span><span class="cx">         : m_ptr(ptr)
</span><span class="cx">     {
</span><del>-        if (ptr)
-            gcProtect(ptr);
</del><ins>+        gcProtectNullTolerant(m_ptr);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template &lt;class T&gt; ProtectedPtr&lt;T&gt;::ProtectedPtr(const ProtectedPtr&amp; o)
</span><span class="cx">         : m_ptr(o.get())
</span><span class="cx">     {
</span><del>-        if (T* ptr = m_ptr)
-            gcProtect(ptr);
</del><ins>+        gcProtectNullTolerant(m_ptr);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template &lt;class T&gt; ProtectedPtr&lt;T&gt;::~ProtectedPtr()
</span><span class="cx">     {
</span><del>-        if (T* ptr = m_ptr)
-            gcUnprotect(ptr);
</del><ins>+        gcUnprotectNullTolerant(m_ptr);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template &lt;class T&gt; template &lt;class U&gt; ProtectedPtr&lt;T&gt;::ProtectedPtr(const ProtectedPtr&lt;U&gt;&amp; o)
</span><span class="cx">         : m_ptr(o.get())
</span><span class="cx">     {
</span><del>-        if (T* ptr = m_ptr)
-            gcProtect(ptr);
</del><ins>+        gcProtectNullTolerant(m_ptr);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template &lt;class T&gt; ProtectedPtr&lt;T&gt;&amp; ProtectedPtr&lt;T&gt;::operator=(const ProtectedPtr&lt;T&gt;&amp; o) 
</span><span class="lines">@@ -127,7 +154,7 @@
</span><span class="cx">         gcProtectNullTolerant(optr);
</span><span class="cx">         gcUnprotectNullTolerant(m_ptr);
</span><span class="cx">         m_ptr = optr;
</span><del>-            return *this;
</del><ins>+        return *this;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template &lt;class T&gt; inline ProtectedPtr&lt;T&gt;&amp; ProtectedPtr&lt;T&gt;::operator=(T* optr)
</span><span class="lines">@@ -138,6 +165,40 @@
</span><span class="cx">         return *this;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    inline ProtectedPtr&lt;JSValuePtr&gt;::ProtectedPtr(JSValuePtr ptr)
+        : m_ptr(ptr.payload())
+    {
+        gcProtectNullTolerant(m_ptr);
+    }
+
+    inline ProtectedPtr&lt;JSValuePtr&gt;::ProtectedPtr(const ProtectedPtr&amp; o)
+        : m_ptr(o.m_ptr)
+    {
+        gcProtectNullTolerant(m_ptr);
+    }
+
+    inline ProtectedPtr&lt;JSValuePtr&gt;::~ProtectedPtr()
+    {
+        gcUnprotectNullTolerant(m_ptr);
+    }
+
+    inline ProtectedPtr&lt;JSValuePtr&gt;&amp; ProtectedPtr&lt;JSValuePtr&gt;::operator=(const ProtectedPtr&amp; o) 
+    {
+        JSValuePtr optr = o.m_ptr;
+        gcProtectNullTolerant(optr);
+        gcUnprotectNullTolerant(m_ptr);
+        m_ptr = optr.payload();
+        return *this;
+    }
+
+    inline ProtectedPtr&lt;JSValuePtr&gt;&amp; ProtectedPtr&lt;JSValuePtr&gt;::operator=(JSValuePtr ptr) 
+    {
+        gcProtectNullTolerant(ptr);
+        gcUnprotectNullTolerant(m_ptr);
+        m_ptr = ptr.payload();
+        return *this;
+    }
+
</ins><span class="cx">     template &lt;class T&gt; inline bool operator==(const ProtectedPtr&lt;T&gt;&amp; a, const ProtectedPtr&lt;T&gt;&amp; b) { return a.get() == b.get(); }
</span><span class="cx">     template &lt;class T&gt; inline bool operator==(const ProtectedPtr&lt;T&gt;&amp; a, const T* b) { return a.get() == b; }
</span><span class="cx">     template &lt;class T&gt; inline bool operator==(const T* a, const ProtectedPtr&lt;T&gt;&amp; b) { return a == b.get(); }
</span></span></pre>
</div>
</div>

</body>
</html>