Get rid of FTLValueFormat
https://bugs.webkit.org/show_bug.cgi?id=148448
Reviewed by Michael Saboff.
FTL::ValueFormat is nothing more than DataFormat (and is actually
slightly less). Let's get rid of it.
* CMakeLists.txt:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/DataFormat.cpp: Renamed from Source/JavaScriptCore/ftl/FTLValueFormat.h.
(WTF::printInternal):
* bytecode/DataFormat.h:
* ftl/FTLAvailableRecovery.h:
(JSC::FTL::AvailableRecovery::AvailableRecovery):
(JSC::FTL::AvailableRecovery::format):
* ftl/FTLExitArgument.h:
(JSC::FTL::ExitArgument::ExitArgument):
(JSC::FTL::ExitArgument::operator!):
(JSC::FTL::ExitArgument::format):
(JSC::FTL::ExitArgument::withFormat):
* ftl/FTLExitValue.cpp:
(JSC::FTL::ExitValue::dataFormat):
* ftl/FTLExitValue.h:
(JSC::FTL::ExitValue::recovery):
(JSC::FTL::ExitValue::recoveryFormat):
* ftl/FTLFormattedValue.h:
(JSC::FTL::FormattedValue::FormattedValue):
(JSC::FTL::FormattedValue::operator!):
(JSC::FTL::FormattedValue::format):
(JSC::FTL::int32Value):
(JSC::FTL::booleanValue):
(JSC::FTL::jsValueValue):
(JSC::FTL::doubleValue):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::DFG::LowerDFGToLLVM::compileArithAddOrSub):
(JSC::FTL::DFG::LowerDFGToLLVM::compileInvalidationPoint):
(JSC::FTL::DFG::LowerDFGToLLVM::convertDoubleToInt32):
(JSC::FTL::DFG::LowerDFGToLLVM::exitValueForNode):
(JSC::FTL::DFG::LowerDFGToLLVM::exitArgument):
(JSC::FTL::DFG::LowerDFGToLLVM::addAvailableRecovery):
* ftl/FTLOSRExit.cpp:
(JSC::FTL::OSRExit::OSRExit):
* ftl/FTLOSRExit.h:
* ftl/FTLOSRExitCompiler.cpp:
(JSC::FTL::reboxAccordingToFormat):
(JSC::FTL::compileRecovery):
(JSC::FTL::compileStub):
* ftl/FTLValueFormat.cpp: Removed.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@189362 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/CMakeLists.txt b/Source/JavaScriptCore/CMakeLists.txt
index 47e0833..601ff75 100644
--- a/Source/JavaScriptCore/CMakeLists.txt
+++ b/Source/JavaScriptCore/CMakeLists.txt
@@ -87,6 +87,7 @@
bytecode/CodeOrigin.cpp
bytecode/CodeType.cpp
bytecode/ComplexGetStatus.cpp
+ bytecode/DataFormat.cpp
bytecode/DFGExitProfile.cpp
bytecode/DeferredCompilationCallback.cpp
bytecode/DeferredSourceDump.cpp
@@ -908,7 +909,6 @@
ftl/FTLState.cpp
ftl/FTLThunks.cpp
ftl/FTLUnwindInfo.cpp
- ftl/FTLValueFormat.cpp
ftl/FTLValueRange.cpp
llvm/InitializeLLVM.cpp
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index 149cbbc..2fffdf8 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,57 @@
+2015-08-25 Basile Clement <basile_clement@apple.com>
+
+ Get rid of FTLValueFormat
+ https://bugs.webkit.org/show_bug.cgi?id=148448
+
+ Reviewed by Michael Saboff.
+
+ FTL::ValueFormat is nothing more than DataFormat (and is actually
+ slightly less). Let's get rid of it.
+
+ * CMakeLists.txt:
+ * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
+ * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * bytecode/DataFormat.cpp: Renamed from Source/JavaScriptCore/ftl/FTLValueFormat.h.
+ (WTF::printInternal):
+ * bytecode/DataFormat.h:
+ * ftl/FTLAvailableRecovery.h:
+ (JSC::FTL::AvailableRecovery::AvailableRecovery):
+ (JSC::FTL::AvailableRecovery::format):
+ * ftl/FTLExitArgument.h:
+ (JSC::FTL::ExitArgument::ExitArgument):
+ (JSC::FTL::ExitArgument::operator!):
+ (JSC::FTL::ExitArgument::format):
+ (JSC::FTL::ExitArgument::withFormat):
+ * ftl/FTLExitValue.cpp:
+ (JSC::FTL::ExitValue::dataFormat):
+ * ftl/FTLExitValue.h:
+ (JSC::FTL::ExitValue::recovery):
+ (JSC::FTL::ExitValue::recoveryFormat):
+ * ftl/FTLFormattedValue.h:
+ (JSC::FTL::FormattedValue::FormattedValue):
+ (JSC::FTL::FormattedValue::operator!):
+ (JSC::FTL::FormattedValue::format):
+ (JSC::FTL::int32Value):
+ (JSC::FTL::booleanValue):
+ (JSC::FTL::jsValueValue):
+ (JSC::FTL::doubleValue):
+ * ftl/FTLLowerDFGToLLVM.cpp:
+ (JSC::FTL::DFG::LowerDFGToLLVM::compileArithAddOrSub):
+ (JSC::FTL::DFG::LowerDFGToLLVM::compileInvalidationPoint):
+ (JSC::FTL::DFG::LowerDFGToLLVM::convertDoubleToInt32):
+ (JSC::FTL::DFG::LowerDFGToLLVM::exitValueForNode):
+ (JSC::FTL::DFG::LowerDFGToLLVM::exitArgument):
+ (JSC::FTL::DFG::LowerDFGToLLVM::addAvailableRecovery):
+ * ftl/FTLOSRExit.cpp:
+ (JSC::FTL::OSRExit::OSRExit):
+ * ftl/FTLOSRExit.h:
+ * ftl/FTLOSRExitCompiler.cpp:
+ (JSC::FTL::reboxAccordingToFormat):
+ (JSC::FTL::compileRecovery):
+ (JSC::FTL::compileStub):
+ * ftl/FTLValueFormat.cpp: Removed.
+
2015-09-04 Basile Clement <basile_clement@apple.com>
Introduce RegisterMap<T>
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj b/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
index c8016a5..4797114 100644
--- a/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
+++ b/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
@@ -326,6 +326,7 @@
<ClCompile Include="..\bytecode\CodeOrigin.cpp" />
<ClCompile Include="..\bytecode\CodeType.cpp" />
<ClCompile Include="..\bytecode\ComplexGetStatus.cpp" />
+ <ClCompile Include="..\bytecode\DataFormat.cpp" />
<ClCompile Include="..\bytecode\DeferredCompilationCallback.cpp" />
<ClCompile Include="..\bytecode\DeferredSourceDump.cpp" />
<ClCompile Include="..\bytecode\DFGExitProfile.cpp" />
@@ -551,7 +552,6 @@
<ClCompile Include="..\ftl\FTLState.cpp" />
<ClCompile Include="..\ftl\FTLThunks.cpp" />
<ClCompile Include="..\ftl\FTLUnwindInfo.cpp" />
- <ClCompile Include="..\ftl\FTLValueFormat.cpp" />
<ClCompile Include="..\ftl\FTLValueRange.cpp" />
<ClCompile Include="..\heap\CodeBlockSet.cpp" />
<ClCompile Include="..\heap\ConservativeRoots.cpp" />
@@ -1303,7 +1303,6 @@
<ClInclude Include="..\ftl\FTLThunks.h" />
<ClInclude Include="..\ftl\FTLTypedPointer.h" />
<ClInclude Include="..\ftl\FTLUnwindInfo.h" />
- <ClInclude Include="..\ftl\FTLValueFormat.h" />
<ClInclude Include="..\ftl\FTLValueFromBlock.h" />
<ClInclude Include="..\ftl\FTLValueRange.h" />
<ClInclude Include="..\ftl\FTLWeight.h" />
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters b/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters
index 74de6e6..258fb76 100644
--- a/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters
+++ b/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters
@@ -174,6 +174,9 @@
<ClCompile Include="..\bytecode\CodeType.cpp">
<Filter>bytecode</Filter>
</ClCompile>
+ <ClCompile Include="..\bytecode\DataFormat.cpp">
+ <Filter>bytecode</Filter>
+ </ClCompile>
<ClCompile Include="..\bytecode\ExecutionCounter.cpp">
<Filter>bytecode</Filter>
</ClCompile>
@@ -1602,9 +1605,6 @@
<ClCompile Include="..\ftl\FTLUnwindInfo.cpp">
<Filter>ftl</Filter>
</ClCompile>
- <ClCompile Include="..\ftl\FTLValueFormat.cpp">
- <Filter>ftl</Filter>
- </ClCompile>
<ClCompile Include="..\ftl\FTLValueRange.cpp">
<Filter>ftl</Filter>
</ClCompile>
@@ -4172,9 +4172,6 @@
<ClInclude Include="..\ftl\FTLUnwindInfo.h">
<Filter>ftl</Filter>
</ClInclude>
- <ClInclude Include="..\ftl\FTLValueFormat.h">
- <Filter>ftl</Filter>
- </ClInclude>
<ClInclude Include="..\ftl\FTLValueFromBlock.h">
<Filter>ftl</Filter>
</ClInclude>
diff --git a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
index fb2200d..da7c45c 100644
--- a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
+++ b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
@@ -135,8 +135,6 @@
0F235BE017178E1C00690C7F /* FTLOSRExitCompiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F235BCA17178E1C00690C7F /* FTLOSRExitCompiler.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F235BE117178E1C00690C7F /* FTLThunks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F235BCB17178E1C00690C7F /* FTLThunks.cpp */; };
0F235BE217178E1C00690C7F /* FTLThunks.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F235BCC17178E1C00690C7F /* FTLThunks.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 0F235BE317178E1C00690C7F /* FTLValueFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F235BCD17178E1C00690C7F /* FTLValueFormat.cpp */; };
- 0F235BE417178E1C00690C7F /* FTLValueFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F235BCE17178E1C00690C7F /* FTLValueFormat.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F235BEB17178E7300690C7F /* DFGOSRExitBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F235BE717178E7300690C7F /* DFGOSRExitBase.cpp */; };
0F235BEC17178E7300690C7F /* DFGOSRExitBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F235BE817178E7300690C7F /* DFGOSRExitBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F235BED17178E7300690C7F /* DFGOSRExitPreparation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F235BE917178E7300690C7F /* DFGOSRExitPreparation.cpp */; };
@@ -980,6 +978,7 @@
623A37EC1B87A7C000754209 /* RegisterMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 623A37EB1B87A7BD00754209 /* RegisterMap.h */; };
62D2D38F1ADF103F000206C1 /* FunctionRareData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 62D2D38D1ADF103F000206C1 /* FunctionRareData.cpp */; };
62D2D3901ADF103F000206C1 /* FunctionRareData.h in Headers */ = {isa = PBXBuildFile; fileRef = 62D2D38E1ADF103F000206C1 /* FunctionRareData.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 62E3D5F01B8D0B7300B868BB /* DataFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 62E3D5EF1B8D0B7300B868BB /* DataFormat.cpp */; };
62F2AA371B0BEDE300610C7A /* DFGLazyNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 62A9A29E1B0BED4800BD54CA /* DFGLazyNode.cpp */; };
62F2AA381B0BEDE300610C7A /* DFGLazyNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 62A9A29F1B0BED4800BD54CA /* DFGLazyNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
6507D29E0E871E5E00D7D896 /* JSTypeInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 6507D2970E871E4A00D7D896 /* JSTypeInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -1964,8 +1963,6 @@
0F235BCA17178E1C00690C7F /* FTLOSRExitCompiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLOSRExitCompiler.h; path = ftl/FTLOSRExitCompiler.h; sourceTree = "<group>"; };
0F235BCB17178E1C00690C7F /* FTLThunks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLThunks.cpp; path = ftl/FTLThunks.cpp; sourceTree = "<group>"; };
0F235BCC17178E1C00690C7F /* FTLThunks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLThunks.h; path = ftl/FTLThunks.h; sourceTree = "<group>"; };
- 0F235BCD17178E1C00690C7F /* FTLValueFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLValueFormat.cpp; path = ftl/FTLValueFormat.cpp; sourceTree = "<group>"; };
- 0F235BCE17178E1C00690C7F /* FTLValueFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLValueFormat.h; path = ftl/FTLValueFormat.h; sourceTree = "<group>"; };
0F235BE717178E7300690C7F /* DFGOSRExitBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGOSRExitBase.cpp; path = dfg/DFGOSRExitBase.cpp; sourceTree = "<group>"; };
0F235BE817178E7300690C7F /* DFGOSRExitBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGOSRExitBase.h; path = dfg/DFGOSRExitBase.h; sourceTree = "<group>"; };
0F235BE917178E7300690C7F /* DFGOSRExitPreparation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGOSRExitPreparation.cpp; path = dfg/DFGOSRExitPreparation.cpp; sourceTree = "<group>"; };
@@ -2784,6 +2781,7 @@
62A9A29F1B0BED4800BD54CA /* DFGLazyNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGLazyNode.h; path = dfg/DFGLazyNode.h; sourceTree = "<group>"; };
62D2D38D1ADF103F000206C1 /* FunctionRareData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FunctionRareData.cpp; sourceTree = "<group>"; };
62D2D38E1ADF103F000206C1 /* FunctionRareData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FunctionRareData.h; sourceTree = "<group>"; };
+ 62E3D5EF1B8D0B7300B868BB /* DataFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DataFormat.cpp; sourceTree = "<group>"; };
6507D2970E871E4A00D7D896 /* JSTypeInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTypeInfo.h; sourceTree = "<group>"; };
651122E5140469BA002B101D /* testRegExp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = testRegExp.cpp; sourceTree = "<group>"; };
6511230514046A4C002B101D /* testRegExp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testRegExp; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -3977,8 +3975,6 @@
0FEA0A1B1708B00700BB722C /* FTLTypedPointer.h */,
0F6B1CC11862C47800845D97 /* FTLUnwindInfo.cpp */,
0F6B1CC21862C47800845D97 /* FTLUnwindInfo.h */,
- 0F235BCD17178E1C00690C7F /* FTLValueFormat.cpp */,
- 0F235BCE17178E1C00690C7F /* FTLValueFormat.h */,
0FDB2CC8173DA51E007B3C1B /* FTLValueFromBlock.h */,
0F5A6281188C98D40072C9DF /* FTLValueRange.cpp */,
0F5A6282188C98D40072C9DF /* FTLValueRange.h */,
@@ -5547,6 +5543,7 @@
0F0B83A514BCF50400885B4F /* CodeType.h */,
0F6FC74E196110A800E1D02D /* ComplexGetStatus.cpp */,
0F6FC74F196110A800E1D02D /* ComplexGetStatus.h */,
+ 62E3D5EF1B8D0B7300B868BB /* DataFormat.cpp */,
0F426A4A1460CD6B00131F8F /* DataFormat.h */,
0FC712DC17CD8778008CC93C /* DeferredCompilationCallback.cpp */,
0FC712DD17CD8778008CC93C /* DeferredCompilationCallback.h */,
@@ -6313,7 +6310,6 @@
0F235BE217178E1C00690C7F /* FTLThunks.h in Headers */,
0FEA0A201708B00700BB722C /* FTLTypedPointer.h in Headers */,
0F6B1CC61862C47800845D97 /* FTLUnwindInfo.h in Headers */,
- 0F235BE417178E1C00690C7F /* FTLValueFormat.h in Headers */,
0FDB2CCA173DA523007B3C1B /* FTLValueFromBlock.h in Headers */,
0FE7211E193B9C590031F6ED /* DFGTransition.h in Headers */,
0F5A6284188C98D40072C9DF /* FTLValueRange.h in Headers */,
@@ -7639,7 +7635,6 @@
0FEA0A161706BB9000BB722C /* FTLState.cpp in Sources */,
0F235BE117178E1C00690C7F /* FTLThunks.cpp in Sources */,
0F6B1CC51862C47800845D97 /* FTLUnwindInfo.cpp in Sources */,
- 0F235BE317178E1C00690C7F /* FTLValueFormat.cpp in Sources */,
0F5A1273192D9FDF008764A3 /* DFGDoesGC.cpp in Sources */,
A53CE08718BC1A5600BEDF76 /* JSConsole.cpp in Sources */,
0F5A6283188C98D40072C9DF /* FTLValueRange.cpp in Sources */,
@@ -7777,6 +7772,7 @@
7C184E1A17BEDBD3007CB63A /* JSPromise.cpp in Sources */,
7C184E2217BEE240007CB63A /* JSPromiseConstructor.cpp in Sources */,
A552C37F1ADDB8FE00139726 /* JSRemoteInspector.cpp in Sources */,
+ 62E3D5F01B8D0B7300B868BB /* DataFormat.cpp in Sources */,
0F893BDB1936E23C001211F4 /* DFGStructureAbstractValue.cpp in Sources */,
7C008CDA187124BB00955C24 /* JSPromiseDeferred.cpp in Sources */,
7C184E1E17BEE22E007CB63A /* JSPromisePrototype.cpp in Sources */,
diff --git a/Source/JavaScriptCore/ftl/FTLValueFormat.h b/Source/JavaScriptCore/bytecode/DataFormat.cpp
similarity index 61%
rename from Source/JavaScriptCore/ftl/FTLValueFormat.h
rename to Source/JavaScriptCore/bytecode/DataFormat.cpp
index 4a4dcbe..8bd42e1 100644
--- a/Source/JavaScriptCore/ftl/FTLValueFormat.h
+++ b/Source/JavaScriptCore/bytecode/DataFormat.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,45 +23,17 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef FTLValueFormat_h
-#define FTLValueFormat_h
+#include "config.h"
+#include "DataFormat.h"
-#if ENABLE(FTL_JIT)
-
-#include "GPRInfo.h"
+#include <wtf/Assertions.h>
#include <wtf/PrintStream.h>
-namespace JSC {
-
-class AssemblyHelpers;
-
-namespace FTL {
-
-// 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,
- ValueFormatInt52,
- ValueFormatStrictInt52,
- ValueFormatBoolean,
- ValueFormatJSValue,
- ValueFormatDouble
-};
-
-void reboxAccordingToFormat(
- ValueFormat, AssemblyHelpers&, GPRReg value, GPRReg scratch1, GPRReg scratch2);
-
-} } // namespace JSC::FTL
-
namespace WTF {
-void printInternal(PrintStream&, JSC::FTL::ValueFormat);
+void printInternal(PrintStream& out, JSC::DataFormat dataFormat)
+{
+ out.print(dataFormatToString(dataFormat));
+}
} // namespace WTF
-
-#endif // ENABLE(FTL_JIT)
-
-#endif // FTLValueFormat_h
-
diff --git a/Source/JavaScriptCore/bytecode/DataFormat.h b/Source/JavaScriptCore/bytecode/DataFormat.h
index 6d7542e..81d6831 100644
--- a/Source/JavaScriptCore/bytecode/DataFormat.h
+++ b/Source/JavaScriptCore/bytecode/DataFormat.h
@@ -121,6 +121,13 @@
return isJSFormat(format, DataFormatJSBoolean);
}
-}
+} // namespace JSC
+
+namespace WTF {
+
+class PrintStream;
+void printInternal(PrintStream&, JSC::DataFormat);
+
+} // namespace WTF
#endif // DataFormat_h
diff --git a/Source/JavaScriptCore/ftl/FTLAvailableRecovery.h b/Source/JavaScriptCore/ftl/FTLAvailableRecovery.h
index fcaf4a2..8932576 100644
--- a/Source/JavaScriptCore/ftl/FTLAvailableRecovery.h
+++ b/Source/JavaScriptCore/ftl/FTLAvailableRecovery.h
@@ -29,9 +29,9 @@
#if ENABLE(FTL_JIT)
#include "DFGNode.h"
+#include "DataFormat.h"
#include "FTLAbbreviatedTypes.h"
#include "FTLRecoveryOpcode.h"
-#include "FTLValueFormat.h"
namespace JSC { namespace FTL {
@@ -39,14 +39,14 @@
public:
AvailableRecovery()
: m_node(0)
- , m_format(InvalidValueFormat)
+ , m_format(DataFormatNone)
, m_opcode(AddRecovery)
, m_left(0)
, m_right(0)
{
}
- AvailableRecovery(DFG::Node* node, RecoveryOpcode opcode, LValue left, LValue right, ValueFormat format)
+ AvailableRecovery(DFG::Node* node, RecoveryOpcode opcode, LValue left, LValue right, DataFormat format)
: m_node(node)
, m_format(format)
, m_opcode(opcode)
@@ -56,7 +56,7 @@
}
DFG::Node* node() const { return m_node; }
- ValueFormat format() const { return m_format; }
+ DataFormat format() const { return m_format; }
RecoveryOpcode opcode() const { return m_opcode; }
LValue left() const { return m_left; }
LValue right() const { return m_right; }
@@ -65,7 +65,7 @@
private:
DFG::Node* m_node;
- ValueFormat m_format;
+ DataFormat m_format;
RecoveryOpcode m_opcode;
LValue m_left;
LValue m_right;
diff --git a/Source/JavaScriptCore/ftl/FTLExitArgument.h b/Source/JavaScriptCore/ftl/FTLExitArgument.h
index 85b14d7..cf75ab0 100644
--- a/Source/JavaScriptCore/ftl/FTLExitArgument.h
+++ b/Source/JavaScriptCore/ftl/FTLExitArgument.h
@@ -28,13 +28,13 @@
#if ENABLE(FTL_JIT)
-#include "FTLValueFormat.h"
+#include "DataFormat.h"
#include <wtf/PrintStream.h>
namespace JSC { namespace FTL {
struct ExitArgumentRepresentation {
- ValueFormat format;
+ DataFormat format;
unsigned argument;
};
@@ -42,10 +42,10 @@
public:
ExitArgument()
{
- m_representation.format = InvalidValueFormat;
+ m_representation.format = DataFormatNone;
}
- ExitArgument(ValueFormat format, unsigned argument)
+ ExitArgument(DataFormat format, unsigned argument)
{
m_representation.format = format;
m_representation.argument = argument;
@@ -56,9 +56,9 @@
m_representation = representation;
}
- bool operator!() const { return m_representation.format == InvalidValueFormat; }
+ bool operator!() const { return m_representation.format == DataFormatNone; }
- ValueFormat format() const
+ DataFormat format() const
{
ASSERT(*this);
return m_representation.format;
@@ -70,7 +70,7 @@
return m_representation.argument;
}
- ExitArgument withFormat(ValueFormat format)
+ ExitArgument withFormat(DataFormat format)
{
return ExitArgument(format, argument());
}
diff --git a/Source/JavaScriptCore/ftl/FTLExitValue.cpp b/Source/JavaScriptCore/ftl/FTLExitValue.cpp
index 24a0f3c..7004b9bd 100644
--- a/Source/JavaScriptCore/ftl/FTLExitValue.cpp
+++ b/Source/JavaScriptCore/ftl/FTLExitValue.cpp
@@ -51,37 +51,36 @@
return withVirtualRegister(virtualRegister() + offset);
}
-ValueFormat ExitValue::valueFormat() const
+DataFormat ExitValue::dataFormat() const
{
switch (kind()) {
case InvalidExitValue:
RELEASE_ASSERT_NOT_REACHED();
- return InvalidValueFormat;
+ return DataFormatNone;
case ExitValueDead:
case ExitValueConstant:
case ExitValueInJSStack:
case ExitValueMaterializeNewObject:
- return ValueFormatJSValue;
+ return DataFormatJS;
case ExitValueArgument:
return exitArgument().format();
case ExitValueInJSStackAsInt32:
- return ValueFormatInt32;
+ return DataFormatInt32;
case ExitValueInJSStackAsInt52:
- return ValueFormatInt52;
+ return DataFormatInt52;
case ExitValueInJSStackAsDouble:
- return ValueFormatDouble;
+ return DataFormatDouble;
case ExitValueRecovery:
return recoveryFormat();
}
RELEASE_ASSERT_NOT_REACHED();
- return InvalidValueFormat;
}
void ExitValue::dumpInContext(PrintStream& out, DumpContext* context) const
diff --git a/Source/JavaScriptCore/ftl/FTLExitValue.h b/Source/JavaScriptCore/ftl/FTLExitValue.h
index 13e6e09..bcf1930 100644
--- a/Source/JavaScriptCore/ftl/FTLExitValue.h
+++ b/Source/JavaScriptCore/ftl/FTLExitValue.h
@@ -125,7 +125,7 @@
return result;
}
- static ExitValue recovery(RecoveryOpcode opcode, unsigned leftArgument, unsigned rightArgument, ValueFormat format)
+ static ExitValue recovery(RecoveryOpcode opcode, unsigned leftArgument, unsigned rightArgument, DataFormat format)
{
ExitValue result;
result.m_kind = ExitValueRecovery;
@@ -176,10 +176,10 @@
return u.recovery.rightArgument;
}
- ValueFormat recoveryFormat() const
+ DataFormat recoveryFormat() const
{
ASSERT(isRecovery());
- return static_cast<ValueFormat>(u.recovery.format);
+ return static_cast<DataFormat>(u.recovery.format);
}
RecoveryOpcode recoveryOpcode() const
@@ -221,7 +221,7 @@
// that is compatible with exitArgument().format(). If it's a constant or it's dead, it
// will claim to be a JSValue. If it's an argument then it will tell you the argument's
// format.
- ValueFormat valueFormat() const;
+ DataFormat dataFormat() const;
void dump(PrintStream&) const;
void dumpInContext(PrintStream&, DumpContext*) const;
diff --git a/Source/JavaScriptCore/ftl/FTLFormattedValue.h b/Source/JavaScriptCore/ftl/FTLFormattedValue.h
index e100f52..1b05ef0 100644
--- a/Source/JavaScriptCore/ftl/FTLFormattedValue.h
+++ b/Source/JavaScriptCore/ftl/FTLFormattedValue.h
@@ -28,8 +28,8 @@
#if ENABLE(FTL_JIT)
+#include "DataFormat.h"
#include "FTLAbbreviations.h"
-#include "FTLValueFormat.h"
namespace JSC { namespace FTL {
@@ -43,12 +43,12 @@
class FormattedValue {
public:
FormattedValue()
- : m_format(InvalidValueFormat)
+ : m_format(DataFormatNone)
, m_value(0)
{
}
- FormattedValue(ValueFormat format, LValue value)
+ FormattedValue(DataFormat format, LValue value)
: m_format(format)
, m_value(value)
{
@@ -56,23 +56,23 @@
bool operator!() const
{
- ASSERT((m_format == InvalidValueFormat) == !m_value);
- return m_format == InvalidValueFormat;
+ ASSERT((m_format == DataFormatNone) == !m_value);
+ return m_format == DataFormatNone;
}
- ValueFormat format() const { return m_format; }
+ DataFormat format() const { return m_format; }
LValue value() const { return m_value; }
private:
- ValueFormat m_format;
+ DataFormat m_format;
LValue m_value;
};
static inline FormattedValue noValue() { return FormattedValue(); }
-static inline FormattedValue int32Value(LValue value) { return FormattedValue(ValueFormatInt32, value); }
-static inline FormattedValue booleanValue(LValue value) { return FormattedValue(ValueFormatBoolean, value); }
-static inline FormattedValue jsValueValue(LValue value) { return FormattedValue(ValueFormatJSValue, value); }
-static inline FormattedValue doubleValue(LValue value) { return FormattedValue(ValueFormatDouble, value); }
+static inline FormattedValue int32Value(LValue value) { return FormattedValue(DataFormatInt32, value); }
+static inline FormattedValue booleanValue(LValue value) { return FormattedValue(DataFormatBoolean, value); }
+static inline FormattedValue jsValueValue(LValue value) { return FormattedValue(DataFormatJS, value); }
+static inline FormattedValue doubleValue(LValue value) { return FormattedValue(DataFormatDouble, value); }
} } // namespace JSC::FTL
diff --git a/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp b/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp
index 2f67f83..e74139c 100644
--- a/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp
+++ b/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp
@@ -1359,11 +1359,11 @@
if (doesKill(m_node->child2())) {
addAvailableRecovery(
m_node->child2(), SubRecovery,
- m_out.extractValue(result, 0), left, ValueFormatInt32);
+ m_out.extractValue(result, 0), left, DataFormatInt32);
} else if (doesKill(m_node->child1())) {
addAvailableRecovery(
m_node->child1(), SubRecovery,
- m_out.extractValue(result, 0), right, ValueFormatInt32);
+ m_out.extractValue(result, 0), right, DataFormatInt32);
}
} else {
result = m_out.subWithOverflow32(left, right);
@@ -1374,13 +1374,13 @@
// right = left - result
addAvailableRecovery(
m_node->child2(), SubRecovery,
- left, m_out.extractValue(result, 0), ValueFormatInt32);
+ left, m_out.extractValue(result, 0), DataFormatInt32);
} else if (doesKill(m_node->child1())) {
// result = left - right
// result + right = left
addAvailableRecovery(
m_node->child1(), AddRecovery,
- m_out.extractValue(result, 0), right, ValueFormatInt32);
+ m_out.extractValue(result, 0), right, DataFormatInt32);
}
}
@@ -1409,11 +1409,11 @@
if (doesKill(m_node->child2())) {
addAvailableRecovery(
m_node->child2(), SubRecovery,
- m_out.extractValue(result, 0), left, ValueFormatInt52);
+ m_out.extractValue(result, 0), left, DataFormatInt52);
} else if (doesKill(m_node->child1())) {
addAvailableRecovery(
m_node->child1(), SubRecovery,
- m_out.extractValue(result, 0), right, ValueFormatInt52);
+ m_out.extractValue(result, 0), right, DataFormatInt52);
}
} else {
result = m_out.subWithOverflow64(left, right);
@@ -1424,13 +1424,13 @@
// right = left - result
addAvailableRecovery(
m_node->child2(), SubRecovery,
- left, m_out.extractValue(result, 0), ValueFormatInt52);
+ left, m_out.extractValue(result, 0), DataFormatInt52);
} else if (doesKill(m_node->child1())) {
// result = left - right
// result + right = left
addAvailableRecovery(
m_node->child1(), AddRecovery,
- m_out.extractValue(result, 0), right, ValueFormatInt52);
+ m_out.extractValue(result, 0), right, DataFormatInt52);
}
}
@@ -4761,7 +4761,7 @@
DFG_ASSERT(m_graph, m_node, m_origin.exitOK);
m_ftlState.jitCode->osrExit.append(OSRExit(
- UncountableInvalidation, InvalidValueFormat, MethodOfGettingAValueProfile(),
+ UncountableInvalidation, DataFormatNone, MethodOfGettingAValueProfile(),
m_origin.forExit, m_origin.semantic,
availabilityMap().m_locals.numberOfArguments(),
availabilityMap().m_locals.numberOfLocals()));
@@ -7379,7 +7379,7 @@
LValue integerValue = m_out.fpToInt32(value);
LValue integerValueConvertedToDouble = m_out.intToDouble(integerValue);
LValue valueNotConvertibleToInteger = m_out.doubleNotEqualOrUnordered(value, integerValueConvertedToDouble);
- speculate(Overflow, FormattedValue(ValueFormatDouble, value), m_node, valueNotConvertibleToInteger);
+ speculate(Overflow, FormattedValue(DataFormatDouble, value), m_node, valueNotConvertibleToInteger);
if (shouldCheckNegativeZero) {
LBasicBlock valueIsZero = FTL_NEW_BLOCK(m_out, ("ConvertDoubleToInt32 on zero"));
@@ -7391,7 +7391,7 @@
LValue doubleBitcastToInt64 = m_out.bitCast(value, m_out.int64);
LValue signBitSet = m_out.lessThan(doubleBitcastToInt64, m_out.constInt64(0));
- speculate(NegativeZero, FormattedValue(ValueFormatDouble, value), m_node, signBitSet);
+ speculate(NegativeZero, FormattedValue(DataFormatDouble, value), m_node, signBitSet);
m_out.jump(continuation);
m_out.appendTo(continuation, lastNext);
}
@@ -8305,35 +8305,35 @@
LoweredNodeValue value = m_int32Values.get(node);
if (isValid(value))
- return exitArgument(arguments, ValueFormatInt32, value.value());
+ return exitArgument(arguments, DataFormatInt32, value.value());
value = m_int52Values.get(node);
if (isValid(value))
- return exitArgument(arguments, ValueFormatInt52, value.value());
+ return exitArgument(arguments, DataFormatInt52, value.value());
value = m_strictInt52Values.get(node);
if (isValid(value))
- return exitArgument(arguments, ValueFormatStrictInt52, value.value());
+ return exitArgument(arguments, DataFormatStrictInt52, value.value());
value = m_booleanValues.get(node);
if (isValid(value)) {
LValue valueToPass = m_out.zeroExt(value.value(), m_out.int32);
- return exitArgument(arguments, ValueFormatBoolean, valueToPass);
+ return exitArgument(arguments, DataFormatBoolean, valueToPass);
}
value = m_jsValueValues.get(node);
if (isValid(value))
- return exitArgument(arguments, ValueFormatJSValue, value.value());
+ return exitArgument(arguments, DataFormatJS, value.value());
value = m_doubleValues.get(node);
if (isValid(value))
- return exitArgument(arguments, ValueFormatDouble, value.value());
+ return exitArgument(arguments, DataFormatDouble, value.value());
DFG_CRASH(m_graph, m_node, toCString("Cannot find value for node: ", node).data());
return ExitValue::dead();
}
- ExitValue exitArgument(ExitArgumentList& arguments, ValueFormat format, LValue value)
+ ExitValue exitArgument(ExitArgumentList& arguments, DataFormat format, LValue value)
{
ExitValue result = ExitValue::exitArgument(ExitArgument(format, arguments.size()));
arguments.append(value);
@@ -8352,13 +8352,13 @@
}
void addAvailableRecovery(
- Node* node, RecoveryOpcode opcode, LValue left, LValue right, ValueFormat format)
+ Node* node, RecoveryOpcode opcode, LValue left, LValue right, DataFormat format)
{
m_availableRecoveries.append(AvailableRecovery(node, opcode, left, right, format));
}
void addAvailableRecovery(
- Edge edge, RecoveryOpcode opcode, LValue left, LValue right, ValueFormat format)
+ Edge edge, RecoveryOpcode opcode, LValue left, LValue right, DataFormat format)
{
addAvailableRecovery(edge.node(), opcode, left, right, format);
}
diff --git a/Source/JavaScriptCore/ftl/FTLOSRExit.cpp b/Source/JavaScriptCore/ftl/FTLOSRExit.cpp
index 3d96f39..afa0d53 100644
--- a/Source/JavaScriptCore/ftl/FTLOSRExit.cpp
+++ b/Source/JavaScriptCore/ftl/FTLOSRExit.cpp
@@ -41,12 +41,12 @@
using namespace DFG;
OSRExit::OSRExit(
- ExitKind exitKind, ValueFormat profileValueFormat,
+ ExitKind exitKind, DataFormat profileDataFormat,
MethodOfGettingAValueProfile valueProfile, CodeOrigin codeOrigin,
CodeOrigin originForProfile, unsigned numberOfArguments,
unsigned numberOfLocals)
: OSRExitBase(exitKind, codeOrigin, originForProfile)
- , m_profileValueFormat(profileValueFormat)
+ , m_profileDataFormat(profileDataFormat)
, m_valueProfile(valueProfile)
, m_patchableCodeOffset(0)
, m_values(numberOfArguments, numberOfLocals)
diff --git a/Source/JavaScriptCore/ftl/FTLOSRExit.h b/Source/JavaScriptCore/ftl/FTLOSRExit.h
index 337c618..5a514dc 100644
--- a/Source/JavaScriptCore/ftl/FTLOSRExit.h
+++ b/Source/JavaScriptCore/ftl/FTLOSRExit.h
@@ -135,7 +135,7 @@
struct OSRExit : public DFG::OSRExitBase {
OSRExit(
- ExitKind, ValueFormat profileValueFormat, MethodOfGettingAValueProfile,
+ ExitKind, DataFormat profileDataFormat, MethodOfGettingAValueProfile,
CodeOrigin, CodeOrigin originForProfile,
unsigned numberOfArguments, unsigned numberOfLocals);
@@ -146,7 +146,7 @@
// method of getting a value profile. Note that all of the ExitArgument's
// are already aware of this possible off-by-one, so there is no need to
// correct them.
- ValueFormat m_profileValueFormat;
+ DataFormat m_profileDataFormat;
MethodOfGettingAValueProfile m_valueProfile;
// Offset within the exit stubs of the stub for this exit.
diff --git a/Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp b/Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp
index 2a6e097..57900e6 100644
--- a/Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp
+++ b/Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp
@@ -46,6 +46,57 @@
using namespace DFG;
+static void reboxAccordingToFormat(
+ DataFormat format, AssemblyHelpers& jit, GPRReg value, GPRReg scratch1, GPRReg scratch2)
+{
+ switch (format) {
+ case DataFormatInt32: {
+ jit.zeroExtend32ToPtr(value, value);
+ jit.or64(GPRInfo::tagTypeNumberRegister, value);
+ break;
+ }
+
+ case DataFormatInt52: {
+ jit.rshift64(AssemblyHelpers::TrustedImm32(JSValue::int52ShiftAmount), value);
+ jit.moveDoubleTo64(FPRInfo::fpRegT0, scratch2);
+ jit.boxInt52(value, value, scratch1, FPRInfo::fpRegT0);
+ jit.move64ToDouble(scratch2, FPRInfo::fpRegT0);
+ break;
+ }
+
+ case DataFormatStrictInt52: {
+ jit.moveDoubleTo64(FPRInfo::fpRegT0, scratch2);
+ jit.boxInt52(value, value, scratch1, FPRInfo::fpRegT0);
+ jit.move64ToDouble(scratch2, FPRInfo::fpRegT0);
+ break;
+ }
+
+ case DataFormatBoolean: {
+ jit.zeroExtend32ToPtr(value, value);
+ jit.or32(MacroAssembler::TrustedImm32(ValueFalse), value);
+ break;
+ }
+
+ case DataFormatJS: {
+ // Done already!
+ break;
+ }
+
+ case DataFormatDouble: {
+ jit.moveDoubleTo64(FPRInfo::fpRegT0, scratch1);
+ jit.move64ToDouble(value, FPRInfo::fpRegT0);
+ jit.purifyNaN(FPRInfo::fpRegT0);
+ jit.boxDouble(FPRInfo::fpRegT0, value);
+ jit.move64ToDouble(scratch1, FPRInfo::fpRegT0);
+ break;
+ }
+
+ default:
+ RELEASE_ASSERT_NOT_REACHED();
+ break;
+ }
+}
+
static void compileRecovery(
CCallHelpers& jit, const ExitValue& value, StackMaps::Record* record, StackMaps& stackmaps,
char* registerScratch,
@@ -80,10 +131,10 @@
switch (value.recoveryOpcode()) {
case AddRecovery:
switch (value.recoveryFormat()) {
- case ValueFormatInt32:
+ case DataFormatInt32:
jit.add32(GPRInfo::regT1, GPRInfo::regT0);
break;
- case ValueFormatInt52:
+ case DataFormatInt52:
jit.add64(GPRInfo::regT1, GPRInfo::regT0);
break;
default:
@@ -93,10 +144,10 @@
break;
case SubRecovery:
switch (value.recoveryFormat()) {
- case ValueFormatInt32:
+ case DataFormatInt32:
jit.sub32(GPRInfo::regT1, GPRInfo::regT0);
break;
- case ValueFormatInt52:
+ case DataFormatInt52:
jit.sub64(GPRInfo::regT1, GPRInfo::regT0);
break;
default:
@@ -120,7 +171,7 @@
}
reboxAccordingToFormat(
- value.valueFormat(), jit, GPRInfo::regT0, GPRInfo::regT1, GPRInfo::regT2);
+ value.dataFormat(), jit, GPRInfo::regT0, GPRInfo::regT1, GPRInfo::regT2);
}
static void compileStub(
@@ -203,10 +254,10 @@
jit.move(MacroAssembler::TrustedImm64(TagMask), GPRInfo::tagMaskRegister);
// Do some value profiling.
- if (exit.m_profileValueFormat != InvalidValueFormat) {
+ if (exit.m_profileDataFormat != DataFormatNone) {
record->locations[0].restoreInto(jit, jitCode->stackmaps, registerScratch, GPRInfo::regT0);
reboxAccordingToFormat(
- exit.m_profileValueFormat, jit, GPRInfo::regT0, GPRInfo::regT1, GPRInfo::regT2);
+ exit.m_profileDataFormat, jit, GPRInfo::regT0, GPRInfo::regT1, GPRInfo::regT2);
if (exit.m_kind == BadCache || exit.m_kind == BadIndexingType) {
CodeOrigin codeOrigin = exit.m_codeOriginForExitProfile;
diff --git a/Source/JavaScriptCore/ftl/FTLValueFormat.cpp b/Source/JavaScriptCore/ftl/FTLValueFormat.cpp
deleted file mode 100644
index 45fdc09..0000000
--- a/Source/JavaScriptCore/ftl/FTLValueFormat.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2013, 2014 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.
- */
-
-#include "config.h"
-#include "FTLValueFormat.h"
-
-#if ENABLE(FTL_JIT)
-
-#include "AssemblyHelpers.h"
-
-namespace JSC { namespace FTL {
-
-void reboxAccordingToFormat(
- ValueFormat format, AssemblyHelpers& jit, GPRReg value, GPRReg scratch1, GPRReg scratch2)
-{
- switch (format) {
- case ValueFormatInt32: {
- jit.zeroExtend32ToPtr(value, value);
- jit.or64(GPRInfo::tagTypeNumberRegister, value);
- break;
- }
-
- case ValueFormatInt52: {
- jit.rshift64(AssemblyHelpers::TrustedImm32(JSValue::int52ShiftAmount), value);
- jit.moveDoubleTo64(FPRInfo::fpRegT0, scratch2);
- jit.boxInt52(value, value, scratch1, FPRInfo::fpRegT0);
- jit.move64ToDouble(scratch2, FPRInfo::fpRegT0);
- break;
- }
-
- case ValueFormatStrictInt52: {
- jit.moveDoubleTo64(FPRInfo::fpRegT0, scratch2);
- jit.boxInt52(value, value, scratch1, FPRInfo::fpRegT0);
- jit.move64ToDouble(scratch2, FPRInfo::fpRegT0);
- break;
- }
-
- case ValueFormatBoolean: {
- jit.zeroExtend32ToPtr(value, value);
- jit.or32(MacroAssembler::TrustedImm32(ValueFalse), value);
- break;
- }
-
- case ValueFormatJSValue: {
- // Done already!
- break;
- }
-
- case ValueFormatDouble: {
- jit.moveDoubleTo64(FPRInfo::fpRegT0, scratch1);
- jit.move64ToDouble(value, FPRInfo::fpRegT0);
- jit.purifyNaN(FPRInfo::fpRegT0);
- jit.boxDouble(FPRInfo::fpRegT0, value);
- jit.move64ToDouble(scratch1, FPRInfo::fpRegT0);
- break;
- }
-
- default:
- RELEASE_ASSERT_NOT_REACHED();
- break;
- }
-}
-
-} } // namespace JSC::FTL
-
-namespace WTF {
-
-using namespace JSC::FTL;
-
-void printInternal(PrintStream& out, ValueFormat format)
-{
- switch (format) {
- case InvalidValueFormat:
- out.print("Invalid");
- return;
- case ValueFormatInt32:
- out.print("Int32");
- return;
- case ValueFormatInt52:
- out.print("Int52");
- return;
- case ValueFormatStrictInt52:
- out.print("StrictInt52");
- return;
- case ValueFormatBoolean:
- out.print("Boolean");
- return;
- case ValueFormatJSValue:
- out.print("JSValue");
- return;
- case ValueFormatDouble:
- out.print("Double");
- return;
- }
-
- RELEASE_ASSERT_NOT_REACHED();
-}
-
-} // namespace WTF
-
-#endif // ENABLE(FTL_JIT)
-