Title: [147487] branches/dfgFourthTier/Source/_javascript_Core
Revision
147487
Author
[email protected]
Date
2013-04-02 12:54:01 -0700 (Tue, 02 Apr 2013)

Log Message

fourthTier: FTL should have the equivalent of a ValueRecovery
https://bugs.webkit.org/show_bug.cgi?id=113819

Reviewed by Mark Hahnenberg.
        
This adds a way of saying that we have a value, we don't want to say what
node the value came from, but we know specifics of how the value is
formatted. This is the LLVM equivalent of DFG's ValueRecovery.

* _javascript_Core.xcodeproj/project.pbxproj:
* ftl/FTLFormattedValue.h: Added.
(FTL):
(FormattedValue):
(JSC::FTL::FormattedValue::FormattedValue):
(JSC::FTL::FormattedValue::operator!):
(JSC::FTL::FormattedValue::format):
(JSC::FTL::FormattedValue::value):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileUInt32ToNumber):
(JSC::FTL::LowerDFGToLLVM::speculateForward):
(JSC::FTL::LowerDFGToLLVM::weakPointer):

Modified Paths

Added Paths

Diff

Modified: branches/dfgFourthTier/Source/_javascript_Core/ChangeLog (147486 => 147487)


--- branches/dfgFourthTier/Source/_javascript_Core/ChangeLog	2013-04-02 19:53:35 UTC (rev 147486)
+++ branches/dfgFourthTier/Source/_javascript_Core/ChangeLog	2013-04-02 19:54:01 UTC (rev 147487)
@@ -1,5 +1,29 @@
 2013-04-02  Filip Pizlo  <[email protected]>
 
+        fourthTier: FTL should have the equivalent of a ValueRecovery
+        https://bugs.webkit.org/show_bug.cgi?id=113819
+
+        Reviewed by Mark Hahnenberg.
+        
+        This adds a way of saying that we have a value, we don't want to say what
+        node the value came from, but we know specifics of how the value is
+        formatted. This is the LLVM equivalent of DFG's ValueRecovery.
+
+        * _javascript_Core.xcodeproj/project.pbxproj:
+        * ftl/FTLFormattedValue.h: Added.
+        (FTL):
+        (FormattedValue):
+        (JSC::FTL::FormattedValue::FormattedValue):
+        (JSC::FTL::FormattedValue::operator!):
+        (JSC::FTL::FormattedValue::format):
+        (JSC::FTL::FormattedValue::value):
+        * ftl/FTLLowerDFGToLLVM.cpp:
+        (JSC::FTL::LowerDFGToLLVM::compileUInt32ToNumber):
+        (JSC::FTL::LowerDFGToLLVM::speculateForward):
+        (JSC::FTL::LowerDFGToLLVM::weakPointer):
+
+2013-04-02  Filip Pizlo  <[email protected]>
+
         fourthTier: FTL should use the right abstract heap for Int32 array accesses
         https://bugs.webkit.org/show_bug.cgi?id=113759
 

Modified: branches/dfgFourthTier/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (147486 => 147487)


--- branches/dfgFourthTier/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2013-04-02 19:53:35 UTC (rev 147486)
+++ branches/dfgFourthTier/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2013-04-02 19:54:01 UTC (rev 147487)
@@ -303,6 +303,7 @@
 		0FEA0A271709623B00BB722C /* FTLCommonValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FEA0A251709623B00BB722C /* FTLCommonValues.cpp */; };
 		0FEA0A281709623B00BB722C /* FTLIntrinsicRepository.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FEA0A261709623B00BB722C /* FTLIntrinsicRepository.cpp */; };
 		0FEA0A2A1709629600BB722C /* FTLOutput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FEA0A291709629600BB722C /* FTLOutput.cpp */; };
+		0FEA0A2C170B661900BB722C /* FTLFormattedValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEA0A2B170B661900BB722C /* FTLFormattedValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0FEB3ECD16237F4D00AB67AD /* TypedArrayDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEB3ECB16237F4700AB67AD /* TypedArrayDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0FEB3ECF16237F6C00AB67AD /* MacroAssembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FEB3ECE16237F6700AB67AD /* MacroAssembler.cpp */; };
 		0FEFC9AA1681A3B300567F53 /* DFGOSRExitJumpPlaceholder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FEFC9A71681A3B000567F53 /* DFGOSRExitJumpPlaceholder.cpp */; };
@@ -1242,6 +1243,7 @@
 		0FEA0A251709623B00BB722C /* FTLCommonValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLCommonValues.cpp; path = ftl/FTLCommonValues.cpp; sourceTree = "<group>"; };
 		0FEA0A261709623B00BB722C /* FTLIntrinsicRepository.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLIntrinsicRepository.cpp; path = ftl/FTLIntrinsicRepository.cpp; sourceTree = "<group>"; };
 		0FEA0A291709629600BB722C /* FTLOutput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLOutput.cpp; path = ftl/FTLOutput.cpp; sourceTree = "<group>"; };
+		0FEA0A2B170B661900BB722C /* FTLFormattedValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLFormattedValue.h; path = ftl/FTLFormattedValue.h; sourceTree = "<group>"; };
 		0FEB3ECB16237F4700AB67AD /* TypedArrayDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypedArrayDescriptor.h; sourceTree = "<group>"; };
 		0FEB3ECE16237F6700AB67AD /* MacroAssembler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacroAssembler.cpp; sourceTree = "<group>"; };
 		0FEFC9A71681A3B000567F53 /* DFGOSRExitJumpPlaceholder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGOSRExitJumpPlaceholder.cpp; path = dfg/DFGOSRExitJumpPlaceholder.cpp; sourceTree = "<group>"; };
@@ -2022,6 +2024,7 @@
 				0FEA0A211709606900BB722C /* FTLCommonValues.h */,
 				0FEA0A00170513DB00BB722C /* FTLCompile.cpp */,
 				0FEA0A01170513DB00BB722C /* FTLCompile.h */,
+				0FEA0A2B170B661900BB722C /* FTLFormattedValue.h */,
 				0FEA0A261709623B00BB722C /* FTLIntrinsicRepository.cpp */,
 				0FEA0A221709606900BB722C /* FTLIntrinsicRepository.h */,
 				0FEA0A02170513DB00BB722C /* FTLJITCode.cpp */,
@@ -3111,6 +3114,7 @@
 				0FEA0A11170513DB00BB722C /* FTLOutput.h in Headers */,
 				0F256C361627B0AD007F2783 /* DFGCallArrayAllocatorSlowPathGenerator.h in Headers */,
 				0F7B294B14C3CD2F007C3DB1 /* DFGCapabilities.h in Headers */,
+				0FEA0A2C170B661900BB722C /* FTLFormattedValue.h in Headers */,
 				0F7B294A14C3CD29007C3DB1 /* DFGCCallHelpers.h in Headers */,
 				0FFFC95814EF90A200C72532 /* DFGCFAPhase.h in Headers */,
 				0F3B3A281544C997003ED0FF /* DFGCFGSimplificationPhase.h in Headers */,

Added: branches/dfgFourthTier/Source/_javascript_Core/ftl/FTLFormattedValue.h (0 => 147487)


--- branches/dfgFourthTier/Source/_javascript_Core/ftl/FTLFormattedValue.h	                        (rev 0)
+++ branches/dfgFourthTier/Source/_javascript_Core/ftl/FTLFormattedValue.h	2013-04-02 19:54:01 UTC (rev 147487)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef FTLFormattedValue_h
+#define FTLFormattedValue_h
+
+#include <wtf/Platform.h>
+
+#if ENABLE(FTL_JIT)
+
+#include "FTLAbbreviations.h"
+
+namespace JSC { namespace FTL {
+
+// This class is mostly used for OSR; it's a way of specifying how a value is formatted
+// in cases where it wouldn't have been obvious from looking at other indicators (like
+// the type of the LLVMValueRef or the type of the DFG::Node). Typically this arises
+// because LLVMValueRef doesn't give us the granularity we need to begin with, and we
+// use this in situations where there is no good way to say what node the value came
+// from.
+
+// Note that this is awkwardly similar to DataFormat in other parts of JSC, except that
+// unlike DataFormat and like ValueRecovery, it distinguishes between UInt32 and Int32.
+
+enum ValueFormat {
+    InvalidValueFormat,
+    ValueFormatInt32,
+    ValueFormatUInt32,
+    ValueFormatBoolean,
+    ValueFormatJSValue,
+    ValueFormatDouble
+};
+
+class FormattedValue {
+public:
+    FormattedValue()
+        : m_format(InvalidValueFormat)
+        , m_value(0)
+    {
+    }
+    
+    FormattedValue(ValueFormat format, LValue value)
+        : m_format(format)
+        , m_value(value)
+    {
+    }
+    
+    bool operator!() const
+    {
+        ASSERT((m_format == InvalidValueFormat) == !m_value);
+        return m_format == InvalidValueFormat;
+    }
+    
+    ValueFormat format() const { return m_format; }
+    LValue value() const { return m_value; }
+
+private:
+    ValueFormat m_format;
+    LValue m_value;
+};
+
+} } // namespace JSC::FTL
+
+#endif // ENABLE(FTL_JIT)
+
+#endif // FTLFormattedValue_h
+

Modified: branches/dfgFourthTier/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp (147486 => 147487)


--- branches/dfgFourthTier/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp	2013-04-02 19:53:35 UTC (rev 147486)
+++ branches/dfgFourthTier/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp	2013-04-02 19:54:01 UTC (rev 147487)
@@ -30,6 +30,7 @@
 
 #include "DFGAbstractState.h"
 #include "FTLAbstractHeapRepository.h"
+#include "FTLFormattedValue.h"
 #include "FTLOutput.h"
 #include "Operations.h"
 
@@ -654,11 +655,9 @@
         }
         
         LValue value = lowInt32(m_node->child1());
-        // FIXME: Make sure that we have some way of passing the equivalent of a
-        // ValueRecovery override for OSR exit.
-        // https://bugs.webkit.org/show_bug.cgi?id=113623
-        speculateForward(Overflow, 0, 0, m_out.lessThan(value, m_out.int32Zero));
-        
+        speculateForward(
+            Overflow, 0, 0, m_out.lessThan(value, m_out.int32Zero),
+            FormattedValue(ValueFormatUInt32, value));
         m_int32Values.add(m_node, value);
     }
     
@@ -880,7 +879,7 @@
         m_out.appendTo(continuation, lastNext);
     }
     
-    void speculateForward(ExitKind kind, LValue lowValue, Node* highValue, LValue failCondition)
+    void speculateForward(ExitKind kind, LValue lowValue, Node* highValue, LValue failCondition, const FormattedValue&)
     {
         speculateBackward(kind, lowValue, highValue, failCondition);
         // FIXME: Implement rewiring of OSR exit to forward.
@@ -1109,7 +1108,7 @@
     LValue weakPointer(JSCell* pointer)
     {
         codeBlock()->appendWeakReference(pointer);
-        return accountedPointer(m_out.constIntPtr(pointer));
+        return m_out.constIntPtr(pointer);
     }
     
     TypedPointer addressFor(LValue base, int operand, ptrdiff_t offset = 0)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to