Title: [102811] trunk/Source/_javascript_Core
Revision
102811
Author
barraclo...@apple.com
Date
2011-12-14 12:51:14 -0800 (Wed, 14 Dec 2011)

Log Message

DFG relies on returning a struct in registers
https://bugs.webkit.org/show_bug.cgi?id=74527

Reviewed by Geoff Garen.

This will not work on all platforms. Returning a uint64_t will more reliably achieve
what we want, on 32-bit platforms (on 64-bit, stick with the struct return).

* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
(JSC::DFG::DFGHandler::dfgHandlerEncoded):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (102810 => 102811)


--- trunk/Source/_javascript_Core/ChangeLog	2011-12-14 20:33:07 UTC (rev 102810)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-12-14 20:51:14 UTC (rev 102811)
@@ -1,3 +1,17 @@
+2011-12-14  Gavin Barraclough  <barraclo...@apple.com>
+
+        DFG relies on returning a struct in registers
+        https://bugs.webkit.org/show_bug.cgi?id=74527
+
+        Reviewed by Geoff Garen.
+
+        This will not work on all platforms. Returning a uint64_t will more reliably achieve
+        what we want, on 32-bit platforms (on 64-bit, stick with the struct return).
+
+        * dfg/DFGOperations.cpp:
+        * dfg/DFGOperations.h:
+        (JSC::DFG::DFGHandler::dfgHandlerEncoded):
+
 2011-12-14  Anders Carlsson  <ander...@apple.com>
 
         Add unary and binary bind overloads

Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.cpp (102810 => 102811)


--- trunk/Source/_javascript_Core/dfg/DFGOperations.cpp	2011-12-14 20:33:07 UTC (rev 102810)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.cpp	2011-12-14 20:51:14 UTC (rev 102811)
@@ -795,7 +795,7 @@
     return JSValue::encode(RegExpObject::create(exec->globalData(), exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->regExpStructure(), regexp));
 }
 
-DFGHandler DFG_OPERATION lookupExceptionHandler(ExecState* exec, ReturnAddressPtr faultLocation)
+DFGHandlerEncoded DFG_OPERATION lookupExceptionHandler(ExecState* exec, ReturnAddressPtr faultLocation)
 {
     JSValue exceptionValue = exec->exception();
     ASSERT(exceptionValue);
@@ -805,7 +805,7 @@
 
     void* catchRoutine = handler ? handler->nativeCode.executableAddress() : (void*)ctiOpThrowNotCaught;
     ASSERT(catchRoutine);
-    return DFGHandler(exec, catchRoutine);
+    return dfgHandlerEncoded(exec, catchRoutine);
 }
 
 double DFG_OPERATION dfgConvertJSValueToNumber(ExecState* exec, EncodedJSValue value)

Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.h (102810 => 102811)


--- trunk/Source/_javascript_Core/dfg/DFGOperations.h	2011-12-14 20:33:07 UTC (rev 102810)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.h	2011-12-14 20:51:14 UTC (rev 102811)
@@ -146,15 +146,41 @@
 // the return location from one of the calls out to one of the helper operations above.
 struct DFGHandler {
     DFGHandler(ExecState* exec, void* handler)
-        : exec(exec)
-        , handler(handler)
     {
+        u.s.exec = exec;
+        u.s.handler = handler;
     }
 
-    ExecState* exec;
-    void* handler;
+#if !CPU(X86_64)
+    uint64_t encoded()
+    {
+        COMPILE_ASSERT(sizeof(Union) == sizeof(uint64_t), DFGHandler_Union_is_64bit);
+        return u.encoded;
+    }
+#endif
+
+    union Union {
+        struct Struct {
+            ExecState* exec;
+            void* handler;
+        } s;
+        uint64_t encoded;
+    } u;
 };
-DFGHandler DFG_OPERATION lookupExceptionHandler(ExecState*, ReturnAddressPtr faultLocation);
+#if CPU(X86_64)
+typedef DFGHandler DFGHandlerEncoded;
+inline DFGHandlerEncoded dfgHandlerEncoded(ExecState* exec, void* handler)
+{
+    return DFGHandler(exec, handler);
+}
+#else
+typedef uint64_t DFGHandlerEncoded;
+inline DFGHandlerEncoded dfgHandlerEncoded(ExecState* exec, void* handler)
+{
+    return DFGHandler(exec, handler).encoded();
+}
+#endif
+DFGHandlerEncoded DFG_OPERATION lookupExceptionHandler(ExecState*, ReturnAddressPtr faultLocation);
 
 // These operations implement the implicitly called ToInt32, ToNumber, and ToBoolean conversions from ES5.
 double DFG_OPERATION dfgConvertJSValueToNumber(ExecState*, EncodedJSValue);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to