Title: [196731] trunk/Source/_javascript_Core
Revision
196731
Author
fpi...@apple.com
Date
2016-02-17 16:42:36 -0800 (Wed, 17 Feb 2016)

Log Message

Rename FTLB3Blah to FTLBlah
https://bugs.webkit.org/show_bug.cgi?id=154365

Rubber stamped by Geoffrey Garen, Benjamin Poulain, Awesome Kling, and Saam Barati.

* CMakeLists.txt:
* _javascript_Core.xcodeproj/project.pbxproj:
* ftl/FTLB3Compile.cpp: Removed.
* ftl/FTLB3Output.cpp: Removed.
* ftl/FTLB3Output.h: Removed.
* ftl/FTLCompile.cpp: Copied from Source/_javascript_Core/ftl/FTLB3Compile.cpp.
* ftl/FTLOutput.cpp: Copied from Source/_javascript_Core/ftl/FTLB3Output.cpp.
* ftl/FTLOutput.h: Copied from Source/_javascript_Core/ftl/FTLB3Output.h.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/_javascript_Core/CMakeLists.txt (196730 => 196731)


--- trunk/Source/_javascript_Core/CMakeLists.txt	2016-02-18 00:37:50 UTC (rev 196730)
+++ trunk/Source/_javascript_Core/CMakeLists.txt	2016-02-18 00:42:36 UTC (rev 196731)
@@ -1000,10 +1000,9 @@
         ftl/FTLAbstractHeap.cpp
         ftl/FTLAbstractHeapRepository.cpp
         ftl/FTLAvailableRecovery.cpp
-        ftl/FTLB3Compile.cpp
-        ftl/FTLB3Output.cpp
         ftl/FTLCapabilities.cpp
         ftl/FTLCommonValues.cpp
+        ftl/FTLCompile.cpp
         ftl/FTLExceptionTarget.cpp
         ftl/FTLExitArgument.cpp
         ftl/FTLExitArgumentForOperand.cpp
@@ -1023,6 +1022,7 @@
         ftl/FTLOSRExitCompiler.cpp
         ftl/FTLOSRExitHandle.cpp
         ftl/FTLOperations.cpp
+        ftl/FTLOutput.cpp
         ftl/FTLPatchpointExceptionHandle.cpp
         ftl/FTLRecoveryOpcode.cpp
         ftl/FTLSaveRestore.cpp

Modified: trunk/Source/_javascript_Core/ChangeLog (196730 => 196731)


--- trunk/Source/_javascript_Core/ChangeLog	2016-02-18 00:37:50 UTC (rev 196730)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-02-18 00:42:36 UTC (rev 196731)
@@ -1,5 +1,21 @@
 2016-02-17  Filip Pizlo  <fpi...@apple.com>
 
+        Rename FTLB3Blah to FTLBlah
+        https://bugs.webkit.org/show_bug.cgi?id=154365
+
+        Rubber stamped by Geoffrey Garen, Benjamin Poulain, Awesome Kling, and Saam Barati.
+
+        * CMakeLists.txt:
+        * _javascript_Core.xcodeproj/project.pbxproj:
+        * ftl/FTLB3Compile.cpp: Removed.
+        * ftl/FTLB3Output.cpp: Removed.
+        * ftl/FTLB3Output.h: Removed.
+        * ftl/FTLCompile.cpp: Copied from Source/_javascript_Core/ftl/FTLB3Compile.cpp.
+        * ftl/FTLOutput.cpp: Copied from Source/_javascript_Core/ftl/FTLB3Output.cpp.
+        * ftl/FTLOutput.h: Copied from Source/_javascript_Core/ftl/FTLB3Output.h.
+
+2016-02-17  Filip Pizlo  <fpi...@apple.com>
+
         Remove LLVM dependencies from WebKit
         https://bugs.webkit.org/show_bug.cgi?id=154323
 

Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (196730 => 196731)


--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2016-02-18 00:37:50 UTC (rev 196730)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2016-02-18 00:42:36 UTC (rev 196731)
@@ -540,7 +540,7 @@
 		0F978B3B1AAEA71D007C7369 /* ConstantMode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F978B3A1AAEA71D007C7369 /* ConstantMode.cpp */; };
 		0F98206016BFE38100240D02 /* PreciseJumpTargets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F98205D16BFE37F00240D02 /* PreciseJumpTargets.cpp */; };
 		0F98206116BFE38300240D02 /* PreciseJumpTargets.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F98205E16BFE37F00240D02 /* PreciseJumpTargets.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		0F9B1DB41C0E42A500E5BFD2 /* FTLB3Output.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F9B1DB31C0E42A500E5BFD2 /* FTLB3Output.cpp */; };
+		0F9B1DB41C0E42A500E5BFD2 /* FTLOutput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F9B1DB31C0E42A500E5BFD2 /* FTLOutput.cpp */; };
 		0F9B1DB71C0E42BD00E5BFD2 /* FTLOSRExitHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F9B1DB51C0E42BD00E5BFD2 /* FTLOSRExitHandle.cpp */; };
 		0F9B1DB81C0E42BD00E5BFD2 /* FTLOSRExitHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F9B1DB61C0E42BD00E5BFD2 /* FTLOSRExitHandle.h */; };
 		0F9D3370165DBB90005AD387 /* Disassembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F9D336E165DBB8D005AD387 /* Disassembler.cpp */; };
@@ -584,7 +584,7 @@
 		0FB3878E1BFBC44D00E3AB1E /* AirBlockWorklist.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB3878B1BFBC44D00E3AB1E /* AirBlockWorklist.h */; };
 		0FB3878F1BFBC44D00E3AB1E /* AirOptimizeBlockOrder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FB3878C1BFBC44D00E3AB1E /* AirOptimizeBlockOrder.cpp */; };
 		0FB387901BFBC44D00E3AB1E /* AirOptimizeBlockOrder.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB3878D1BFBC44D00E3AB1E /* AirOptimizeBlockOrder.h */; };
-		0FB387921BFD31A100E3AB1E /* FTLB3Compile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FB387911BFD31A100E3AB1E /* FTLB3Compile.cpp */; };
+		0FB387921BFD31A100E3AB1E /* FTLCompile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FB387911BFD31A100E3AB1E /* FTLCompile.cpp */; };
 		0FB438A319270B1D00E1FBC9 /* StructureSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FB438A219270B1D00E1FBC9 /* StructureSet.cpp */; };
 		0FB4FB731BC843140025CA5A /* FTLLazySlowPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FB4FB701BC843140025CA5A /* FTLLazySlowPath.cpp */; };
 		0FB4FB741BC843140025CA5A /* FTLLazySlowPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB4FB711BC843140025CA5A /* FTLLazySlowPath.h */; };
@@ -1116,7 +1116,7 @@
 		26718BA41BE99F780052017B /* AirIteratedRegisterCoalescing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26718BA21BE99F780052017B /* AirIteratedRegisterCoalescing.cpp */; };
 		26718BA51BE99F780052017B /* AirIteratedRegisterCoalescing.h in Headers */ = {isa = PBXBuildFile; fileRef = 26718BA31BE99F780052017B /* AirIteratedRegisterCoalescing.h */; };
 		2684D4381C00161C0081D663 /* AirLiveness.h in Headers */ = {isa = PBXBuildFile; fileRef = 2684D4371C00161C0081D663 /* AirLiveness.h */; };
-		269D636E1BFBE5D100101B1D /* FTLB3Output.h in Headers */ = {isa = PBXBuildFile; fileRef = 269D636D1BFBE5D000101B1D /* FTLB3Output.h */; };
+		269D636E1BFBE5D100101B1D /* FTLOutput.h in Headers */ = {isa = PBXBuildFile; fileRef = 269D636D1BFBE5D000101B1D /* FTLOutput.h */; };
 		2A05ABD51961DF2400341750 /* JSPropertyNameEnumerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2A05ABD31961DF2400341750 /* JSPropertyNameEnumerator.cpp */; };
 		2A05ABD61961DF2400341750 /* JSPropertyNameEnumerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 2A05ABD41961DF2400341750 /* JSPropertyNameEnumerator.h */; };
 		2A111245192FCE79005EE18D /* CustomGetterSetter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2A111243192FCE79005EE18D /* CustomGetterSetter.cpp */; };
@@ -2679,7 +2679,7 @@
 		0F978B3A1AAEA71D007C7369 /* ConstantMode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConstantMode.cpp; sourceTree = "<group>"; };
 		0F98205D16BFE37F00240D02 /* PreciseJumpTargets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PreciseJumpTargets.cpp; sourceTree = "<group>"; };
 		0F98205E16BFE37F00240D02 /* PreciseJumpTargets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreciseJumpTargets.h; sourceTree = "<group>"; };
-		0F9B1DB31C0E42A500E5BFD2 /* FTLB3Output.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLB3Output.cpp; path = ftl/FTLB3Output.cpp; sourceTree = "<group>"; };
+		0F9B1DB31C0E42A500E5BFD2 /* FTLOutput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLOutput.cpp; path = ftl/FTLOutput.cpp; sourceTree = "<group>"; };
 		0F9B1DB51C0E42BD00E5BFD2 /* FTLOSRExitHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLOSRExitHandle.cpp; path = ftl/FTLOSRExitHandle.cpp; sourceTree = "<group>"; };
 		0F9B1DB61C0E42BD00E5BFD2 /* FTLOSRExitHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLOSRExitHandle.h; path = ftl/FTLOSRExitHandle.h; sourceTree = "<group>"; };
 		0F9D336E165DBB8D005AD387 /* Disassembler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Disassembler.cpp; path = disassembler/Disassembler.cpp; sourceTree = "<group>"; };
@@ -2723,7 +2723,7 @@
 		0FB3878B1BFBC44D00E3AB1E /* AirBlockWorklist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AirBlockWorklist.h; path = b3/air/AirBlockWorklist.h; sourceTree = "<group>"; };
 		0FB3878C1BFBC44D00E3AB1E /* AirOptimizeBlockOrder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AirOptimizeBlockOrder.cpp; path = b3/air/AirOptimizeBlockOrder.cpp; sourceTree = "<group>"; };
 		0FB3878D1BFBC44D00E3AB1E /* AirOptimizeBlockOrder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AirOptimizeBlockOrder.h; path = b3/air/AirOptimizeBlockOrder.h; sourceTree = "<group>"; };
-		0FB387911BFD31A100E3AB1E /* FTLB3Compile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLB3Compile.cpp; path = ftl/FTLB3Compile.cpp; sourceTree = "<group>"; };
+		0FB387911BFD31A100E3AB1E /* FTLCompile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLCompile.cpp; path = ftl/FTLCompile.cpp; sourceTree = "<group>"; };
 		0FB438A219270B1D00E1FBC9 /* StructureSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StructureSet.cpp; sourceTree = "<group>"; };
 		0FB4B51016B3A964003F696B /* DFGMinifiedID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGMinifiedID.h; path = dfg/DFGMinifiedID.h; sourceTree = "<group>"; };
 		0FB4B51916B62772003F696B /* DFGAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGAllocator.h; path = dfg/DFGAllocator.h; sourceTree = "<group>"; };
@@ -3225,7 +3225,7 @@
 		26718BA21BE99F780052017B /* AirIteratedRegisterCoalescing.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AirIteratedRegisterCoalescing.cpp; path = b3/air/AirIteratedRegisterCoalescing.cpp; sourceTree = "<group>"; };
 		26718BA31BE99F780052017B /* AirIteratedRegisterCoalescing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AirIteratedRegisterCoalescing.h; path = b3/air/AirIteratedRegisterCoalescing.h; sourceTree = "<group>"; };
 		2684D4371C00161C0081D663 /* AirLiveness.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AirLiveness.h; path = b3/air/AirLiveness.h; sourceTree = "<group>"; };
-		269D636D1BFBE5D000101B1D /* FTLB3Output.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLB3Output.h; path = ftl/FTLB3Output.h; sourceTree = "<group>"; };
+		269D636D1BFBE5D000101B1D /* FTLOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLOutput.h; path = ftl/FTLOutput.h; sourceTree = "<group>"; };
 		2A05ABD31961DF2400341750 /* JSPropertyNameEnumerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPropertyNameEnumerator.cpp; sourceTree = "<group>"; };
 		2A05ABD41961DF2400341750 /* JSPropertyNameEnumerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPropertyNameEnumerator.h; sourceTree = "<group>"; };
 		2A111243192FCE79005EE18D /* CustomGetterSetter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustomGetterSetter.cpp; sourceTree = "<group>"; };
@@ -4520,13 +4520,11 @@
 				0FEA0A1A1708B00700BB722C /* FTLAbstractHeapRepository.h */,
 				0F485323187DFDEC0083B687 /* FTLAvailableRecovery.cpp */,
 				0F485324187DFDEC0083B687 /* FTLAvailableRecovery.h */,
-				0FB387911BFD31A100E3AB1E /* FTLB3Compile.cpp */,
-				0F9B1DB31C0E42A500E5BFD2 /* FTLB3Output.cpp */,
-				269D636D1BFBE5D000101B1D /* FTLB3Output.h */,
 				0FEA09FE170513DB00BB722C /* FTLCapabilities.cpp */,
 				0FEA09FF170513DB00BB722C /* FTLCapabilities.h */,
 				0FEA0A251709623B00BB722C /* FTLCommonValues.cpp */,
 				0FEA0A211709606900BB722C /* FTLCommonValues.h */,
+				0FB387911BFD31A100E3AB1E /* FTLCompile.cpp */,
 				0FEA0A01170513DB00BB722C /* FTLCompile.h */,
 				0F9D4C0A1C3E1C11006CD984 /* FTLExceptionTarget.cpp */,
 				0F9D4C0B1C3E1C11006CD984 /* FTLExceptionTarget.h */,
@@ -4570,6 +4568,8 @@
 				0F235BCA17178E1C00690C7F /* FTLOSRExitCompiler.h */,
 				0F9B1DB51C0E42BD00E5BFD2 /* FTLOSRExitHandle.cpp */,
 				0F9B1DB61C0E42BD00E5BFD2 /* FTLOSRExitHandle.h */,
+				0F9B1DB31C0E42A500E5BFD2 /* FTLOutput.cpp */,
+				269D636D1BFBE5D000101B1D /* FTLOutput.h */,
 				0F9D4C0E1C3E2C74006CD984 /* FTLPatchpointExceptionHandle.cpp */,
 				0F9D4C0F1C3E2C74006CD984 /* FTLPatchpointExceptionHandle.h */,
 				0F485325187DFDEC0083B687 /* FTLRecoveryOpcode.cpp */,
@@ -6974,7 +6974,7 @@
 				0F4570411BE584CA0062A629 /* B3TimingScope.h in Headers */,
 				0F338E1E1BF286EA0013C88F /* B3LowerMacros.h in Headers */,
 				0FEC853C1BDACDAC0080FF74 /* B3Type.h in Headers */,
-				269D636E1BFBE5D100101B1D /* FTLB3Output.h in Headers */,
+				269D636E1BFBE5D100101B1D /* FTLOutput.h in Headers */,
 				0FEC853E1BDACDAC0080FF74 /* B3UpsilonValue.h in Headers */,
 				0FEC85401BDACDAC0080FF74 /* B3UseCounts.h in Headers */,
 				0FEC85421BDACDAC0080FF74 /* B3Validate.h in Headers */,
@@ -8818,7 +8818,7 @@
 				0FD8A32717D51F5700CA2C40 /* DFGTierUpCheckInjectionPhase.cpp in Sources */,
 				0FD8A32917D51F5700CA2C40 /* DFGToFTLDeferredCompilationCallback.cpp in Sources */,
 				0FD8A32B17D51F5700CA2C40 /* DFGToFTLForOSREntryDeferredCompilationCallback.cpp in Sources */,
-				0F9B1DB41C0E42A500E5BFD2 /* FTLB3Output.cpp in Sources */,
+				0F9B1DB41C0E42A500E5BFD2 /* FTLOutput.cpp in Sources */,
 				0FE7211D193B9C590031F6ED /* DFGTransition.cpp in Sources */,
 				0F63944015C75F1D006A597C /* DFGTypeCheckHoistingPhase.cpp in Sources */,
 				0FBE0F7616C1DB0F0082C5E8 /* DFGUnificationPhase.cpp in Sources */,
@@ -9046,7 +9046,7 @@
 				E3D239C81B829C1C00BBEF67 /* JSModuleEnvironment.cpp in Sources */,
 				E318CBC01B8AEF5100A2929D /* JSModuleNamespaceObject.cpp in Sources */,
 				E39DA4A61B7E8B7C0084F33A /* JSModuleRecord.cpp in Sources */,
-				0FB387921BFD31A100E3AB1E /* FTLB3Compile.cpp in Sources */,
+				0FB387921BFD31A100E3AB1E /* FTLCompile.cpp in Sources */,
 				E33E8D1C1B9013C300346B52 /* JSNativeStdFunction.cpp in Sources */,
 				A72700900DAC6BBC00E548D7 /* JSNotAnObject.cpp in Sources */,
 				147F39D4107EC37600427A48 /* JSObject.cpp in Sources */,

Modified: trunk/Source/_javascript_Core/ftl/FTLAbstractHeap.cpp (196730 => 196731)


--- trunk/Source/_javascript_Core/ftl/FTLAbstractHeap.cpp	2016-02-18 00:37:50 UTC (rev 196730)
+++ trunk/Source/_javascript_Core/ftl/FTLAbstractHeap.cpp	2016-02-18 00:42:36 UTC (rev 196731)
@@ -31,7 +31,7 @@
 #include "DFGCommon.h"
 #include "FTLAbbreviatedTypes.h"
 #include "FTLAbstractHeapRepository.h"
-#include "FTLB3Output.h"
+#include "FTLOutput.h"
 #include "FTLTypedPointer.h"
 #include "JSCInlines.h"
 #include "Options.h"

Deleted: trunk/Source/_javascript_Core/ftl/FTLB3Compile.cpp (196730 => 196731)


--- trunk/Source/_javascript_Core/ftl/FTLB3Compile.cpp	2016-02-18 00:37:50 UTC (rev 196730)
+++ trunk/Source/_javascript_Core/ftl/FTLB3Compile.cpp	2016-02-18 00:42:36 UTC (rev 196731)
@@ -1,153 +0,0 @@
-/*
- * Copyright (C) 2015-2016 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 "FTLCompile.h"
-
-#if ENABLE(FTL_JIT)
-
-#include "AirCode.h"
-#include "B3Generate.h"
-#include "B3ProcedureInlines.h"
-#include "B3StackSlot.h"
-#include "CodeBlockWithJITType.h"
-#include "CCallHelpers.h"
-#include "DFGCommon.h"
-#include "DFGGraphSafepoint.h"
-#include "DFGOperations.h"
-#include "DataView.h"
-#include "Disassembler.h"
-#include "FTLJITCode.h"
-#include "FTLThunks.h"
-#include "JITSubGenerator.h"
-#include "LinkBuffer.h"
-#include "PCToCodeOriginMap.h"
-#include "ScratchRegisterAllocator.h"
-
-namespace JSC { namespace FTL {
-
-using namespace DFG;
-
-void compile(State& state, Safepoint::Result& safepointResult)
-{
-    Graph& graph = state.graph;
-    CodeBlock* codeBlock = graph.m_codeBlock;
-    VM& vm = graph.m_vm;
-
-    {
-        GraphSafepoint safepoint(state.graph, safepointResult);
-
-        B3::prepareForGeneration(*state.proc);
-    }
-
-    if (safepointResult.didGetCancelled())
-        return;
-    RELEASE_ASSERT(!state.graph.m_vm.heap.isCollecting());
-    
-    if (state.allocationFailed)
-        return;
-    
-    std::unique_ptr<RegisterAtOffsetList> registerOffsets =
-        std::make_unique<RegisterAtOffsetList>(state.proc->calleeSaveRegisters());
-    if (shouldDumpDisassembly()) {
-        dataLog("Unwind info for ", CodeBlockWithJITType(state.graph.m_codeBlock, JITCode::FTLJIT), ":\n");
-        dataLog("    ", *registerOffsets, "\n");
-    }
-    state.graph.m_codeBlock->setCalleeSaveRegisters(WTFMove(registerOffsets));
-    ASSERT(!(state.proc->frameSize() % sizeof(EncodedJSValue)));
-    state.jitCode->common.frameRegisterCount = state.proc->frameSize() / sizeof(EncodedJSValue);
-
-    int localsOffset =
-        state.capturedValue->offsetFromFP() / sizeof(EncodedJSValue) + graph.m_nextMachineLocal;
-    if (shouldDumpDisassembly()) {
-        dataLog(
-            "localsOffset = ", localsOffset, " for stack slot: ",
-            pointerDump(state.capturedValue), " at ", RawPointer(state.capturedValue), "\n");
-    }
-    
-    for (unsigned i = graph.m_inlineVariableData.size(); i--;) {
-        InlineCallFrame* inlineCallFrame = graph.m_inlineVariableData[i].inlineCallFrame;
-        
-        if (inlineCallFrame->argumentCountRegister.isValid())
-            inlineCallFrame->argumentCountRegister += localsOffset;
-        
-        for (unsigned argument = inlineCallFrame->arguments.size(); argument-- > 1;) {
-            inlineCallFrame->arguments[argument] =
-                inlineCallFrame->arguments[argument].withLocalsOffset(localsOffset);
-        }
-        
-        if (inlineCallFrame->isClosureCall) {
-            inlineCallFrame->calleeRecovery =
-                inlineCallFrame->calleeRecovery.withLocalsOffset(localsOffset);
-        }
-
-        if (graph.hasDebuggerEnabled())
-            codeBlock->setScopeRegister(codeBlock->scopeRegister() + localsOffset);
-    }
-    for (OSRExitDescriptor& descriptor : state.jitCode->osrExitDescriptors) {
-        for (unsigned i = descriptor.m_values.size(); i--;)
-            descriptor.m_values[i] = descriptor.m_values[i].withLocalsOffset(localsOffset);
-        for (ExitTimeObjectMaterialization* materialization : descriptor.m_materializations)
-            materialization->accountForLocalsOffset(localsOffset);
-    }
-
-    // We will add exception handlers while generating.
-    codeBlock->clearExceptionHandlers();
-
-    CCallHelpers jit(&vm, codeBlock);
-    B3::generate(*state.proc, jit);
-
-    // Emit the exception handler.
-    *state.exceptionHandler = jit.label();
-    jit.copyCalleeSavesToVMCalleeSavesBuffer();
-    jit.move(MacroAssembler::TrustedImmPtr(jit.vm()), GPRInfo::argumentGPR0);
-    jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR1);
-    CCallHelpers::Call call = jit.call();
-    jit.jumpToExceptionHandler();
-    jit.addLinkTask(
-        [=] (LinkBuffer& linkBuffer) {
-            linkBuffer.link(call, FunctionPtr(lookupExceptionHandler));
-        });
-
-    state.finalizer->b3CodeLinkBuffer = std::make_unique<LinkBuffer>(
-        vm, jit, codeBlock, JITCompilationCanFail);
-    if (state.finalizer->b3CodeLinkBuffer->didFailToAllocate()) {
-        state.allocationFailed = true;
-        return;
-    }
-    
-    B3::PCToOriginMap originMap = state.proc->releasePCToOriginMap();
-    if (vm.shouldBuilderPCToCodeOriginMapping())
-        codeBlock->setPCToCodeOriginMap(std::make_unique<PCToCodeOriginMap>(PCToCodeOriginMapBuilder(vm, WTFMove(originMap)), *state.finalizer->b3CodeLinkBuffer));
-
-    state.generatedFunction = bitwise_cast<GeneratedFunction>(
-        state.finalizer->b3CodeLinkBuffer->entrypoint().executableAddress());
-    state.jitCode->initializeB3Byproducts(state.proc->releaseByproducts());
-}
-
-} } // namespace JSC::FTL
-
-#endif // ENABLE(FTL_JIT)
-

Deleted: trunk/Source/_javascript_Core/ftl/FTLB3Output.cpp (196730 => 196731)


--- trunk/Source/_javascript_Core/ftl/FTLB3Output.cpp	2016-02-18 00:37:50 UTC (rev 196730)
+++ trunk/Source/_javascript_Core/ftl/FTLB3Output.cpp	2016-02-18 00:42:36 UTC (rev 196731)
@@ -1,302 +0,0 @@
-/*
- * Copyright (C) 2013-2016 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 "FTLB3Output.h"
-
-#if ENABLE(FTL_JIT)
-
-#include "B3MathExtras.h"
-#include "B3StackmapGenerationParams.h"
-
-namespace JSC { namespace FTL {
-
-using namespace B3;
-
-Output::Output(State& state)
-    : m_proc(*state.proc)
-{
-}
-
-Output::~Output()
-{
-}
-
-void Output::initialize(AbstractHeapRepository& heaps)
-{
-    m_heaps = &heaps;
-}
-
-LBasicBlock Output::newBlock(const char*)
-{
-    LBasicBlock result = m_proc.addBlock(m_frequency);
-
-    if (!m_nextBlock)
-        m_blockOrder.append(result);
-    else
-        m_blockOrder.insertBefore(m_nextBlock, result);
-
-    return result;
-}
-
-void Output::applyBlockOrder()
-{
-    m_proc.setBlockOrder(m_blockOrder);
-}
-
-LBasicBlock Output::appendTo(LBasicBlock block, LBasicBlock nextBlock)
-{
-    appendTo(block);
-    return insertNewBlocksBefore(nextBlock);
-}
-
-void Output::appendTo(LBasicBlock block)
-{
-    m_block = block;
-}
-
-SlotBaseValue* Output::lockedStackSlot(size_t bytes)
-{
-    return m_block->appendNew<SlotBaseValue>(m_proc, origin(), m_proc.addStackSlot(bytes));
-}
-
-LValue Output::neg(LValue value)
-{
-    return m_block->appendNew<Value>(m_proc, B3::Neg, origin(), value);
-}
-
-LValue Output::bitNot(LValue value)
-{
-    return m_block->appendNew<B3::Value>(m_proc, B3::BitXor, origin(),
-        value,
-        m_block->appendIntConstant(m_proc, origin(), value->type(), -1));
-}
-
-LValue Output::logicalNot(LValue value)
-{
-    return m_block->appendNew<B3::Value>(m_proc, B3::Equal, origin(), value, int32Zero);
-}
-
-LValue Output::load(TypedPointer pointer, LType type)
-{
-    LValue load = m_block->appendNew<MemoryValue>(m_proc, Load, type, origin(), pointer.value());
-    pointer.heap().decorateInstruction(load, *m_heaps);
-    return load;
-}
-
-LValue Output::doublePowi(LValue x, LValue y)
-{
-    // FIXME: powDoubleInt32() should be inlined here since Output knows about block layout and
-    // should be involved in any operation that creates blocks.
-    // https://bugs.webkit.org/show_bug.cgi?id=152223
-    auto result = powDoubleInt32(m_proc, m_block, origin(), x, y);
-    m_block = result.first;
-    return result.second;
-}
-
-bool Output::hasSensibleDoubleToInt()
-{
-    return optimizeForX86();
-}
-
-LValue Output::doubleToInt(LValue value)
-{
-    PatchpointValue* result = patchpoint(Int32);
-    result->append(value, ValueRep::SomeRegister);
-    result->setGenerator(
-        [] (CCallHelpers& jit, const StackmapGenerationParams& params) {
-            jit.truncateDoubleToInt32(params[1].fpr(), params[0].gpr());
-        });
-    result->effects = Effects::none();
-    return result;
-}
-
-LValue Output::doubleToUInt(LValue value)
-{
-    PatchpointValue* result = patchpoint(Int32);
-    result->append(value, ValueRep::SomeRegister);
-    result->setGenerator(
-        [] (CCallHelpers& jit, const StackmapGenerationParams& params) {
-            jit.truncateDoubleToUint32(params[1].fpr(), params[0].gpr());
-        });
-    result->effects = Effects::none();
-    return result;
-}
-
-LValue Output::unsignedToDouble(LValue value)
-{
-    return intToDouble(zeroExt(value, Int64));
-}
-
-LValue Output::load8SignExt32(TypedPointer pointer)
-{
-    LValue load = m_block->appendNew<MemoryValue>(m_proc, Load8S, Int32, origin(), pointer.value());
-    pointer.heap().decorateInstruction(load, *m_heaps);
-    return load;
-}
-
-LValue Output::load8ZeroExt32(TypedPointer pointer)
-{
-    LValue load = m_block->appendNew<MemoryValue>(m_proc, Load8Z, Int32, origin(), pointer.value());
-    pointer.heap().decorateInstruction(load, *m_heaps);
-    return load;
-}
-
-LValue Output::load16SignExt32(TypedPointer pointer)
-{
-    LValue load = m_block->appendNew<MemoryValue>(m_proc, Load16S, Int32, origin(), pointer.value());
-    pointer.heap().decorateInstruction(load, *m_heaps);
-    return load;
-}
-
-LValue Output::load16ZeroExt32(TypedPointer pointer)
-{
-    LValue load = m_block->appendNew<MemoryValue>(m_proc, Load16Z, Int32, origin(), pointer.value());
-    pointer.heap().decorateInstruction(load, *m_heaps);
-    return load;
-}
-
-void Output::store(LValue value, TypedPointer pointer)
-{
-    LValue store = m_block->appendNew<MemoryValue>(m_proc, Store, origin(), value, pointer.value());
-    pointer.heap().decorateInstruction(store, *m_heaps);
-}
-
-void Output::store32As8(LValue value, TypedPointer pointer)
-{
-    LValue store = m_block->appendNew<MemoryValue>(m_proc, Store8, origin(), value, pointer.value());
-    pointer.heap().decorateInstruction(store, *m_heaps);
-}
-
-void Output::store32As16(LValue value, TypedPointer pointer)
-{
-    LValue store = m_block->appendNew<MemoryValue>(m_proc, Store16, origin(), value, pointer.value());
-    pointer.heap().decorateInstruction(store, *m_heaps);
-}
-
-LValue Output::baseIndex(LValue base, LValue index, Scale scale, ptrdiff_t offset)
-{
-    LValue accumulatedOffset;
-        
-    switch (scale) {
-    case ScaleOne:
-        accumulatedOffset = index;
-        break;
-    case ScaleTwo:
-        accumulatedOffset = shl(index, intPtrOne);
-        break;
-    case ScaleFour:
-        accumulatedOffset = shl(index, intPtrTwo);
-        break;
-    case ScaleEight:
-    case ScalePtr:
-        accumulatedOffset = shl(index, intPtrThree);
-        break;
-    }
-        
-    if (offset)
-        accumulatedOffset = add(accumulatedOffset, constIntPtr(offset));
-        
-    return add(base, accumulatedOffset);
-}
-
-void Output::branch(LValue condition, LBasicBlock taken, Weight takenWeight, LBasicBlock notTaken, Weight notTakenWeight)
-{
-    m_block->appendNew<ControlValue>(
-        m_proc, B3::Branch, origin(), condition,
-        FrequentedBlock(taken, takenWeight.frequencyClass()),
-        FrequentedBlock(notTaken, notTakenWeight.frequencyClass()));
-}
-
-void Output::check(LValue condition, WeightedTarget taken, Weight notTakenWeight)
-{
-    LBasicBlock continuation = FTL_NEW_BLOCK(*this, ("Output::check continuation"));
-    branch(condition, taken, WeightedTarget(continuation, notTakenWeight));
-    appendTo(continuation);
-}
-
-void Output::check(LValue condition, WeightedTarget taken)
-{
-    check(condition, taken, taken.weight().inverse());
-}
-
-LValue Output::load(TypedPointer pointer, LoadType type)
-{
-    switch (type) {
-    case Load8SignExt32:
-        return load8SignExt32(pointer);
-    case Load8ZeroExt32:
-        return load8ZeroExt32(pointer);
-    case Load16SignExt32:
-        return load8SignExt32(pointer);
-    case Load16ZeroExt32:
-        return load8ZeroExt32(pointer);
-    case Load32:
-        return load32(pointer);
-    case Load64:
-        return load64(pointer);
-    case LoadPtr:
-        return loadPtr(pointer);
-    case LoadFloat:
-        return loadFloat(pointer);
-    case LoadDouble:
-        return loadDouble(pointer);
-    }
-    RELEASE_ASSERT_NOT_REACHED();
-    return nullptr;
-}
-
-void Output::store(LValue value, TypedPointer pointer, StoreType type)
-{
-    switch (type) {
-    case Store32As8:
-        store32As8(value, pointer);
-        return;
-    case Store32As16:
-        store32As16(value, pointer);
-        return;
-    case Store32:
-        store32(value, pointer);
-        return;
-    case Store64:
-        store64(value, pointer);
-        return;
-    case StorePtr:
-        storePtr(value, pointer);
-        return;
-    case StoreFloat:
-        storeFloat(value, pointer);
-        return;
-    case StoreDouble:
-        storeDouble(value, pointer);
-        return;
-    }
-    RELEASE_ASSERT_NOT_REACHED();
-}
-
-} } // namespace JSC::FTL
-
-#endif // ENABLE(FTL_JIT)
-

Deleted: trunk/Source/_javascript_Core/ftl/FTLB3Output.h (196730 => 196731)


--- trunk/Source/_javascript_Core/ftl/FTLB3Output.h	2016-02-18 00:37:50 UTC (rev 196730)
+++ trunk/Source/_javascript_Core/ftl/FTLB3Output.h	2016-02-18 00:42:36 UTC (rev 196731)
@@ -1,535 +0,0 @@
-/*
- * Copyright (C) 2013-2016 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 FTLB3Output_h
-#define FTLB3Output_h
-
-#include "DFGCommon.h"
-
-#if ENABLE(FTL_JIT)
-
-#include "B3ArgumentRegValue.h"
-#include "B3BasicBlockInlines.h"
-#include "B3CCallValue.h"
-#include "B3Compilation.h"
-#include "B3Const32Value.h"
-#include "B3ConstPtrValue.h"
-#include "B3ControlValue.h"
-#include "B3MemoryValue.h"
-#include "B3Procedure.h"
-#include "B3SlotBaseValue.h"
-#include "B3SwitchValue.h"
-#include "B3UpsilonValue.h"
-#include "B3ValueInlines.h"
-#include "FTLAbbreviatedTypes.h"
-#include "FTLAbstractHeapRepository.h"
-#include "FTLCommonValues.h"
-#include "FTLState.h"
-#include "FTLSwitchCase.h"
-#include "FTLTypedPointer.h"
-#include "FTLValueFromBlock.h"
-#include "FTLWeight.h"
-#include "FTLWeightedTarget.h"
-#include <wtf/OrderMaker.h>
-#include <wtf/StringPrintStream.h>
-
-// FIXME: remove this once everything can be generated through B3.
-#if COMPILER(GCC_OR_CLANG)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmissing-noreturn"
-#pragma GCC diagnostic ignored "-Wunused-parameter"
-#endif // COMPILER(GCC_OR_CLANG)
-
-namespace JSC {
-
-namespace DFG { struct Node; }
-
-namespace FTL {
-
-enum Scale { ScaleOne, ScaleTwo, ScaleFour, ScaleEight, ScalePtr };
-
-class Output : public CommonValues {
-public:
-    Output(State&);
-    ~Output();
-
-    void initialize(AbstractHeapRepository&);
-
-    void setFrequency(double value)
-    {
-        m_frequency = value;
-    }
-
-    LBasicBlock newBlock(const char* name = "");
-
-    LBasicBlock insertNewBlocksBefore(LBasicBlock nextBlock)
-    {
-        LBasicBlock lastNextBlock = m_nextBlock;
-        m_nextBlock = nextBlock;
-        return lastNextBlock;
-    }
-
-    void applyBlockOrder();
-
-    LBasicBlock appendTo(LBasicBlock, LBasicBlock nextBlock);
-    void appendTo(LBasicBlock);
-
-    void setOrigin(DFG::Node* node) { m_origin = node; }
-    B3::Origin origin() { return B3::Origin(m_origin); }
-
-    LValue framePointer() { return m_block->appendNew<B3::Value>(m_proc, B3::FramePointer, origin()); }
-
-    B3::SlotBaseValue* lockedStackSlot(size_t bytes);
-
-    LValue constBool(bool value) { return m_block->appendNew<B3::Const32Value>(m_proc, origin(), value); }
-    LValue constInt32(int32_t value) { return m_block->appendNew<B3::Const32Value>(m_proc, origin(), value); }
-    template<typename T>
-    LValue constIntPtr(T* value) { return m_block->appendNew<B3::ConstPtrValue>(m_proc, origin(), value); }
-    template<typename T>
-    LValue constIntPtr(T value) { return m_block->appendNew<B3::ConstPtrValue>(m_proc, origin(), value); }
-    LValue constInt64(int64_t value) { return m_block->appendNew<B3::Const64Value>(m_proc, origin(), value); }
-    LValue constDouble(double value) { return m_block->appendNew<B3::ConstDoubleValue>(m_proc, origin(), value); }
-
-    LValue phi(LType type) { return m_block->appendNew<B3::Value>(m_proc, B3::Phi, type, origin()); }
-    template<typename... Params>
-    LValue phi(LType, ValueFromBlock, Params... theRest);
-    template<typename VectorType>
-    LValue phi(LType, const VectorType&);
-    void addIncomingToPhi(LValue phi, ValueFromBlock);
-    template<typename... Params>
-    void addIncomingToPhi(LValue phi, ValueFromBlock, Params... theRest);
-
-    LValue add(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Add, origin(), left, right); }
-    LValue sub(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Sub, origin(), left, right); }
-    LValue mul(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Mul, origin(), left, right); }
-    LValue div(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Div, origin(), left, right); }
-    LValue chillDiv(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::ChillDiv, origin(), left, right); }
-    LValue mod(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Mod, origin(), left, right); }
-    LValue chillMod(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::ChillMod, origin(), left, right); }
-    LValue neg(LValue);
-
-    LValue doubleAdd(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Add, origin(), left, right); }
-    LValue doubleSub(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Sub, origin(), left, right); }
-    LValue doubleMul(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Mul, origin(), left, right); }
-    LValue doubleDiv(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Div, origin(), left, right); }
-    LValue doubleMod(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Mod, origin(), left, right); }
-    LValue doubleNeg(LValue value) { return neg(value); }
-
-    LValue bitAnd(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::BitAnd, origin(), left, right); }
-    LValue bitOr(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::BitOr, origin(), left, right); }
-    LValue bitXor(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::BitXor, origin(), left, right); }
-    LValue shl(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Shl, origin(), left, castToInt32(right)); }
-    LValue aShr(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::SShr, origin(), left, castToInt32(right)); }
-    LValue lShr(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::ZShr, origin(), left, castToInt32(right)); }
-    LValue bitNot(LValue);
-    LValue logicalNot(LValue);
-
-    LValue ctlz32(LValue operand) { return m_block->appendNew<B3::Value>(m_proc, B3::Clz, origin(), operand); }
-    LValue addWithOverflow32(LValue left, LValue right) { CRASH(); }
-    LValue subWithOverflow32(LValue left, LValue right) { CRASH(); }
-    LValue mulWithOverflow32(LValue left, LValue right) { CRASH(); }
-    LValue addWithOverflow64(LValue left, LValue right) { CRASH(); }
-    LValue subWithOverflow64(LValue left, LValue right) { CRASH(); }
-    LValue mulWithOverflow64(LValue left, LValue right) { CRASH(); }
-    LValue doubleAbs(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::Abs, origin(), value); }
-    LValue doubleCeil(LValue operand) { return m_block->appendNew<B3::Value>(m_proc, B3::Ceil, origin(), operand); }
-
-    LValue doubleSin(LValue value)
-    {
-        double (*sinDouble)(double) = sin;
-        return callWithoutSideEffects(B3::Double, sinDouble, value);
-    }
-    LValue doubleCos(LValue value)
-    {
-        double (*cosDouble)(double) = cos;
-        return callWithoutSideEffects(B3::Double, cosDouble, value);
-    }
-
-    LValue doublePow(LValue xOperand, LValue yOperand)
-    {
-        double (*powDouble)(double, double) = pow;
-        return callWithoutSideEffects(B3::Double, powDouble, xOperand, yOperand);
-    }
-
-    LValue doublePowi(LValue xOperand, LValue yOperand);
-
-    LValue doubleSqrt(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::Sqrt, origin(), value); }
-
-    LValue doubleLog(LValue value)
-    {
-        double (*logDouble)(double) = log;
-        return callWithoutSideEffects(B3::Double, logDouble, value);
-    }
-
-    static bool hasSensibleDoubleToInt();
-    LValue doubleToInt(LValue);
-    LValue doubleToUInt(LValue);
-
-    LValue signExt32To64(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::SExt32, origin(), value); }
-    LValue zeroExt(LValue value, LType type)
-    {
-        if (value->type() == type)
-            return value;
-        return m_block->appendNew<B3::Value>(m_proc, B3::ZExt32, origin(), value);
-    }
-    LValue zeroExtPtr(LValue value) { return zeroExt(value, B3::Int64); }
-    LValue intToDouble(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::IToD, origin(), value); }
-    LValue unsignedToDouble(LValue);
-    LValue castToInt32(LValue value)
-    {
-        return value->type() == B3::Int32 ? value :
-            m_block->appendNew<B3::Value>(m_proc, B3::Trunc, origin(), value);
-    }
-    LValue doubleToFloat(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::DoubleToFloat, origin(), value); }
-    LValue floatToDouble(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::FloatToDouble, origin(), value); }
-    LValue bitCast(LValue, LType);
-    LValue fround(LValue doubleValue);
-
-    LValue load(TypedPointer, LType);
-    void store(LValue, TypedPointer);
-
-    LValue load8SignExt32(TypedPointer);
-    LValue load8ZeroExt32(TypedPointer);
-    LValue load16SignExt32(TypedPointer);
-    LValue load16ZeroExt32(TypedPointer);
-    LValue load32(TypedPointer pointer) { return load(pointer, B3::Int32); }
-    LValue load64(TypedPointer pointer) { return load(pointer, B3::Int64); }
-    LValue loadPtr(TypedPointer pointer) { return load(pointer, B3::pointerType()); }
-    LValue loadFloat(TypedPointer pointer) { return load(pointer, B3::Float); }
-    LValue loadDouble(TypedPointer pointer) { return load(pointer, B3::Double); }
-    void store32As8(LValue value, TypedPointer pointer);
-    void store32As16(LValue value, TypedPointer pointer);
-    void store32(LValue value, TypedPointer pointer)
-    {
-        ASSERT(value->type() == B3::Int32);
-        store(value, pointer);
-    }
-    void store64(LValue value, TypedPointer pointer)
-    {
-        ASSERT(value->type() == B3::Int64);
-        store(value, pointer);
-    }
-    void storePtr(LValue value, TypedPointer pointer)
-    {
-        ASSERT(value->type() == B3::pointerType());
-        store(value, pointer);
-    }
-    void storeFloat(LValue value, TypedPointer pointer)
-    {
-        ASSERT(value->type() == B3::Float);
-        store(value, pointer);
-    }
-    void storeDouble(LValue value, TypedPointer pointer)
-    {
-        ASSERT(value->type() == B3::Double);
-        store(value, pointer);
-    }
-
-    enum LoadType {
-        Load8SignExt32,
-        Load8ZeroExt32,
-        Load16SignExt32,
-        Load16ZeroExt32,
-        Load32,
-        Load64,
-        LoadPtr,
-        LoadFloat,
-        LoadDouble
-    };
-
-    LValue load(TypedPointer, LoadType);
-    
-    enum StoreType {
-        Store32As8,
-        Store32As16,
-        Store32,
-        Store64,
-        StorePtr,
-        StoreFloat,
-        StoreDouble
-    };
-
-    void store(LValue, TypedPointer, StoreType);
-
-    LValue addPtr(LValue value, ptrdiff_t immediate = 0)
-    {
-        if (!immediate)
-            return value;
-        return add(value, constIntPtr(immediate));
-    }
-
-    // Construct an address by offsetting base by the requested amount and ascribing
-    // the requested abstract heap to it.
-    TypedPointer address(const AbstractHeap& heap, LValue base, ptrdiff_t offset = 0)
-    {
-        return TypedPointer(heap, addPtr(base, offset));
-    }
-    // Construct an address by offsetting base by the amount specified by the field,
-    // and optionally an additional amount (use this with care), and then creating
-    // a TypedPointer with the given field as the heap.
-    TypedPointer address(LValue base, const AbstractField& field, ptrdiff_t offset = 0)
-    {
-        return address(field, base, offset + field.offset());
-    }
-
-    LValue baseIndex(LValue base, LValue index, Scale, ptrdiff_t offset = 0);
-
-    TypedPointer baseIndex(const AbstractHeap& heap, LValue base, LValue index, Scale scale, ptrdiff_t offset = 0)
-    {
-        return TypedPointer(heap, baseIndex(base, index, scale, offset));
-    }
-    TypedPointer baseIndex(IndexedAbstractHeap& heap, LValue base, LValue index, JSValue indexAsConstant = JSValue(), ptrdiff_t offset = 0)
-    {
-        return heap.baseIndex(*this, base, index, indexAsConstant, offset);
-    }
-
-    TypedPointer absolute(void* address)
-    {
-        return TypedPointer(m_heaps->absolute[address], constIntPtr(address));
-    }
-
-    LValue load8SignExt32(LValue base, const AbstractField& field) { return load8SignExt32(address(base, field)); }
-    LValue load8ZeroExt32(LValue base, const AbstractField& field) { return load8ZeroExt32(address(base, field)); }
-    LValue load16SignExt32(LValue base, const AbstractField& field) { return load16SignExt32(address(base, field)); }
-    LValue load16ZeroExt32(LValue base, const AbstractField& field) { return load16ZeroExt32(address(base, field)); }
-    LValue load32(LValue base, const AbstractField& field) { return load32(address(base, field)); }
-    LValue load64(LValue base, const AbstractField& field) { return load64(address(base, field)); }
-    LValue loadPtr(LValue base, const AbstractField& field) { return loadPtr(address(base, field)); }
-    LValue loadDouble(LValue base, const AbstractField& field) { return loadDouble(address(base, field)); }
-    void store32(LValue value, LValue base, const AbstractField& field) { store32(value, address(base, field)); }
-    void store64(LValue value, LValue base, const AbstractField& field) { store64(value, address(base, field)); }
-    void storePtr(LValue value, LValue base, const AbstractField& field) { storePtr(value, address(base, field)); }
-    void storeDouble(LValue value, LValue base, const AbstractField& field) { storeDouble(value, address(base, field)); }
-
-    // FIXME: Explore adding support for value range constraints to B3. Maybe it could be as simple as having
-    // a load instruction that guarantees that its result is non-negative.
-    // https://bugs.webkit.org/show_bug.cgi?id=151458
-    void ascribeRange(LValue, const ValueRange&) { }
-    LValue nonNegative32(LValue loadInstruction) { return loadInstruction; }
-    LValue load32NonNegative(TypedPointer pointer) { return load32(pointer); }
-    LValue load32NonNegative(LValue base, const AbstractField& field) { return load32(base, field); }
-
-    LValue equal(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Equal, origin(), left, right); }
-    LValue notEqual(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::NotEqual, origin(), left, right); }
-    LValue above(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Above, origin(), left, right); }
-    LValue aboveOrEqual(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::AboveEqual, origin(), left, right); }
-    LValue below(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Below, origin(), left, right); }
-    LValue belowOrEqual(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::BelowEqual, origin(), left, right); }
-    LValue greaterThan(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::GreaterThan, origin(), left, right); }
-    LValue greaterThanOrEqual(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::GreaterEqual, origin(), left, right); }
-    LValue lessThan(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::LessThan, origin(), left, right); }
-    LValue lessThanOrEqual(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::LessEqual, origin(), left, right); }
-
-    LValue doubleEqual(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Equal, origin(), left, right); }
-    LValue doubleEqualOrUnordered(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::EqualOrUnordered, origin(), left, right); }
-    LValue doubleNotEqualOrUnordered(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::NotEqual, origin(), left, right); }
-    LValue doubleLessThan(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::LessThan, origin(), left, right); }
-    LValue doubleLessThanOrEqual(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::LessEqual, origin(), left, right); }
-    LValue doubleGreaterThan(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::GreaterThan, origin(), left, right); }
-    LValue doubleGreaterThanOrEqual(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::GreaterEqual, origin(), left, right); }
-    LValue doubleNotEqualAndOrdered(LValue left, LValue right) { return logicalNot(doubleEqualOrUnordered(left, right)); }
-    LValue doubleLessThanOrUnordered(LValue left, LValue right) { return logicalNot(doubleGreaterThanOrEqual(left, right)); }
-    LValue doubleLessThanOrEqualOrUnordered(LValue left, LValue right) { return logicalNot(doubleGreaterThan(left, right)); }
-    LValue doubleGreaterThanOrUnordered(LValue left, LValue right) { return logicalNot(doubleLessThanOrEqual(left, right)); }
-    LValue doubleGreaterThanOrEqualOrUnordered(LValue left, LValue right) { return logicalNot(doubleLessThan(left, right)); }
-
-    LValue isZero32(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::Equal, origin(), value, int32Zero); }
-    LValue notZero32(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::NotEqual, origin(), value, int32Zero); }
-    LValue isZero64(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::Equal, origin(), value, int64Zero); }
-    LValue notZero64(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::NotEqual, origin(), value, int64Zero); }
-    LValue isNull(LValue value) { return isZero64(value); }
-    LValue notNull(LValue value) { return notZero64(value); }
-
-    LValue testIsZero32(LValue value, LValue mask) { return isZero32(bitAnd(value, mask)); }
-    LValue testNonZero32(LValue value, LValue mask) { return notZero32(bitAnd(value, mask)); }
-    LValue testIsZero64(LValue value, LValue mask) { return isZero64(bitAnd(value, mask)); }
-    LValue testNonZero64(LValue value, LValue mask) { return notZero64(bitAnd(value, mask)); }
-    LValue testIsZeroPtr(LValue value, LValue mask) { return isNull(bitAnd(value, mask)); }
-    LValue testNonZeroPtr(LValue value, LValue mask) { return notNull(bitAnd(value, mask)); }
-
-    LValue select(LValue value, LValue taken, LValue notTaken) { return m_block->appendNew<B3::Value>(m_proc, B3::Select, origin(), value, taken, notTaken); }
-    LValue extractValue(LValue aggVal, unsigned index) { CRASH(); }
-
-    template<typename VectorType>
-    LValue call(LType type, LValue function, const VectorType& vector)
-    {
-        B3::CCallValue* result = m_block->appendNew<B3::CCallValue>(m_proc, type, origin(), function);
-        result->children().appendVector(vector);
-        return result;
-    }
-    LValue call(LType type, LValue function) { return m_block->appendNew<B3::CCallValue>(m_proc, type, origin(), function); }
-    LValue call(LType type, LValue function, LValue arg1) { return m_block->appendNew<B3::CCallValue>(m_proc, type, origin(), function, arg1); }
-    template<typename... Args>
-    LValue call(LType type, LValue function, LValue arg1, Args... args) { return m_block->appendNew<B3::CCallValue>(m_proc, type, origin(), function, arg1, args...); }
-
-    template<typename FunctionType>
-    LValue operation(FunctionType function) { return constIntPtr(bitwise_cast<void*>(function)); }
-
-    void jump(LBasicBlock destination) { m_block->appendNew<B3::ControlValue>(m_proc, B3::Jump, origin(), B3::FrequentedBlock(destination)); }
-    void branch(LValue condition, LBasicBlock taken, Weight takenWeight, LBasicBlock notTaken, Weight notTakenWeight);
-    void branch(LValue condition, WeightedTarget taken, WeightedTarget notTaken)
-    {
-        branch(condition, taken.target(), taken.weight(), notTaken.target(), notTaken.weight());
-    }
-
-    // Branches to an already-created handler if true, "falls through" if false. Fall-through is
-    // simulated by creating a continuation for you.
-    void check(LValue condition, WeightedTarget taken, Weight notTakenWeight);
-    
-    // Same as check(), but uses Weight::inverse() to compute the notTakenWeight.
-    void check(LValue condition, WeightedTarget taken);
-    
-    template<typename VectorType>
-    void switchInstruction(LValue value, const VectorType& cases, LBasicBlock fallThrough, Weight fallThroughWeight)
-    {
-        B3::SwitchValue* switchValue = m_block->appendNew<B3::SwitchValue>(
-            m_proc, origin(), value, B3::FrequentedBlock(fallThrough));
-        for (const SwitchCase& switchCase : cases) {
-            int64_t value = switchCase.value()->asInt();
-            B3::FrequentedBlock target(switchCase.target(), switchCase.weight().frequencyClass());
-            switchValue->appendCase(B3::SwitchCase(value, target));
-        }
-    }
-
-    void ret(LValue value) { m_block->appendNew<B3::ControlValue>(m_proc, B3::Return, origin(), value); }
-
-    void unreachable() { m_block->appendNew<B3::ControlValue>(m_proc, B3::Oops, origin()); }
-
-    B3::CheckValue* speculate(LValue value)
-    {
-        return m_block->appendNew<B3::CheckValue>(m_proc, B3::Check, origin(), value);
-    }
-
-    B3::CheckValue* speculateAdd(LValue left, LValue right)
-    {
-        return m_block->appendNew<B3::CheckValue>(m_proc, B3::CheckAdd, origin(), left, right);
-    }
-
-    B3::CheckValue* speculateSub(LValue left, LValue right)
-    {
-        return m_block->appendNew<B3::CheckValue>(m_proc, B3::CheckSub, origin(), left, right);
-    }
-
-    B3::CheckValue* speculateMul(LValue left, LValue right)
-    {
-        return m_block->appendNew<B3::CheckValue>(m_proc, B3::CheckMul, origin(), left, right);
-    }
-
-    B3::PatchpointValue* patchpoint(LType type)
-    {
-        return m_block->appendNew<B3::PatchpointValue>(m_proc, type, origin());
-    }
-
-    void trap()
-    {
-        m_block->appendNew<B3::ControlValue>(m_proc, B3::Oops, origin());
-    }
-
-    ValueFromBlock anchor(LValue value)
-    {
-        B3::UpsilonValue* upsilon = m_block->appendNew<B3::UpsilonValue>(m_proc, origin(), value);
-        return ValueFromBlock(upsilon, m_block);
-    }
-
-#if PLATFORM(COCOA)
-#pragma mark - States
-#endif
-    B3::Procedure& m_proc;
-
-    DFG::Node* m_origin { nullptr };
-    LBasicBlock m_block { nullptr };
-    LBasicBlock m_nextBlock { nullptr };
-
-    AbstractHeapRepository* m_heaps;
-
-    double m_frequency { 1 };
-
-private:
-    OrderMaker<LBasicBlock> m_blockOrder;
-    
-    template<typename Function, typename... Args>
-    LValue callWithoutSideEffects(B3::Type type, Function function, LValue arg1, Args... args)
-    {
-        return m_block->appendNew<B3::CCallValue>(m_proc, type, origin(), B3::Effects::none(),
-            m_block->appendNew<B3::ConstPtrValue>(m_proc, origin(), bitwise_cast<void*>(function)),
-            arg1, args...);
-    }
-
-};
-
-template<typename... Params>
-inline LValue Output::phi(LType type, ValueFromBlock value, Params... theRest)
-{
-    LValue phiNode = phi(type);
-    addIncomingToPhi(phiNode, value, theRest...);
-    return phiNode;
-}
-
-template<typename VectorType>
-inline LValue Output::phi(LType type, const VectorType& vector)
-{
-    LValue phiNode = phi(type);
-    for (const ValueFromBlock& valueFromBlock : vector)
-        addIncomingToPhi(phiNode, valueFromBlock);
-    return phiNode;
-}
-
-inline void Output::addIncomingToPhi(LValue phi, ValueFromBlock value)
-{
-    value.value()->as<B3::UpsilonValue>()->setPhi(phi);
-}
-
-template<typename... Params>
-inline void Output::addIncomingToPhi(LValue phi, ValueFromBlock value, Params... theRest)
-{
-    addIncomingToPhi(phi, value);
-    addIncomingToPhi(phi, theRest...);
-}
-
-inline LValue Output::bitCast(LValue value, LType type)
-{
-    ASSERT_UNUSED(type, type == int64 || type == doubleType);
-    return m_block->appendNew<B3::Value>(m_proc, B3::BitwiseCast, origin(), value);
-}
-
-inline LValue Output::fround(LValue doubleValue)
-{
-    return floatToDouble(doubleToFloat(doubleValue));
-}
-
-#if COMPILER(GCC_OR_CLANG)
-#pragma GCC diagnostic pop
-#endif // COMPILER(GCC_OR_CLANG)
-
-#define FTL_NEW_BLOCK(output, nameArguments) \
-    (LIKELY(!verboseCompilationEnabled()) \
-    ? (output).newBlock() \
-    : (output).newBlock((toCString nameArguments).data()))
-
-} } // namespace JSC::FTL
-
-#endif // ENABLE(FTL_JIT)
-
-#endif // FTLB3Output_h

Copied: trunk/Source/_javascript_Core/ftl/FTLCompile.cpp (from rev 196729, trunk/Source/_javascript_Core/ftl/FTLB3Compile.cpp) (0 => 196731)


--- trunk/Source/_javascript_Core/ftl/FTLCompile.cpp	                        (rev 0)
+++ trunk/Source/_javascript_Core/ftl/FTLCompile.cpp	2016-02-18 00:42:36 UTC (rev 196731)
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2015-2016 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 "FTLCompile.h"
+
+#if ENABLE(FTL_JIT)
+
+#include "AirCode.h"
+#include "B3Generate.h"
+#include "B3ProcedureInlines.h"
+#include "B3StackSlot.h"
+#include "CodeBlockWithJITType.h"
+#include "CCallHelpers.h"
+#include "DFGCommon.h"
+#include "DFGGraphSafepoint.h"
+#include "DFGOperations.h"
+#include "DataView.h"
+#include "Disassembler.h"
+#include "FTLJITCode.h"
+#include "FTLThunks.h"
+#include "JITSubGenerator.h"
+#include "LinkBuffer.h"
+#include "PCToCodeOriginMap.h"
+#include "ScratchRegisterAllocator.h"
+
+namespace JSC { namespace FTL {
+
+using namespace DFG;
+
+void compile(State& state, Safepoint::Result& safepointResult)
+{
+    Graph& graph = state.graph;
+    CodeBlock* codeBlock = graph.m_codeBlock;
+    VM& vm = graph.m_vm;
+
+    {
+        GraphSafepoint safepoint(state.graph, safepointResult);
+
+        B3::prepareForGeneration(*state.proc);
+    }
+
+    if (safepointResult.didGetCancelled())
+        return;
+    RELEASE_ASSERT(!state.graph.m_vm.heap.isCollecting());
+    
+    if (state.allocationFailed)
+        return;
+    
+    std::unique_ptr<RegisterAtOffsetList> registerOffsets =
+        std::make_unique<RegisterAtOffsetList>(state.proc->calleeSaveRegisters());
+    if (shouldDumpDisassembly()) {
+        dataLog("Unwind info for ", CodeBlockWithJITType(state.graph.m_codeBlock, JITCode::FTLJIT), ":\n");
+        dataLog("    ", *registerOffsets, "\n");
+    }
+    state.graph.m_codeBlock->setCalleeSaveRegisters(WTFMove(registerOffsets));
+    ASSERT(!(state.proc->frameSize() % sizeof(EncodedJSValue)));
+    state.jitCode->common.frameRegisterCount = state.proc->frameSize() / sizeof(EncodedJSValue);
+
+    int localsOffset =
+        state.capturedValue->offsetFromFP() / sizeof(EncodedJSValue) + graph.m_nextMachineLocal;
+    if (shouldDumpDisassembly()) {
+        dataLog(
+            "localsOffset = ", localsOffset, " for stack slot: ",
+            pointerDump(state.capturedValue), " at ", RawPointer(state.capturedValue), "\n");
+    }
+    
+    for (unsigned i = graph.m_inlineVariableData.size(); i--;) {
+        InlineCallFrame* inlineCallFrame = graph.m_inlineVariableData[i].inlineCallFrame;
+        
+        if (inlineCallFrame->argumentCountRegister.isValid())
+            inlineCallFrame->argumentCountRegister += localsOffset;
+        
+        for (unsigned argument = inlineCallFrame->arguments.size(); argument-- > 1;) {
+            inlineCallFrame->arguments[argument] =
+                inlineCallFrame->arguments[argument].withLocalsOffset(localsOffset);
+        }
+        
+        if (inlineCallFrame->isClosureCall) {
+            inlineCallFrame->calleeRecovery =
+                inlineCallFrame->calleeRecovery.withLocalsOffset(localsOffset);
+        }
+
+        if (graph.hasDebuggerEnabled())
+            codeBlock->setScopeRegister(codeBlock->scopeRegister() + localsOffset);
+    }
+    for (OSRExitDescriptor& descriptor : state.jitCode->osrExitDescriptors) {
+        for (unsigned i = descriptor.m_values.size(); i--;)
+            descriptor.m_values[i] = descriptor.m_values[i].withLocalsOffset(localsOffset);
+        for (ExitTimeObjectMaterialization* materialization : descriptor.m_materializations)
+            materialization->accountForLocalsOffset(localsOffset);
+    }
+
+    // We will add exception handlers while generating.
+    codeBlock->clearExceptionHandlers();
+
+    CCallHelpers jit(&vm, codeBlock);
+    B3::generate(*state.proc, jit);
+
+    // Emit the exception handler.
+    *state.exceptionHandler = jit.label();
+    jit.copyCalleeSavesToVMCalleeSavesBuffer();
+    jit.move(MacroAssembler::TrustedImmPtr(jit.vm()), GPRInfo::argumentGPR0);
+    jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR1);
+    CCallHelpers::Call call = jit.call();
+    jit.jumpToExceptionHandler();
+    jit.addLinkTask(
+        [=] (LinkBuffer& linkBuffer) {
+            linkBuffer.link(call, FunctionPtr(lookupExceptionHandler));
+        });
+
+    state.finalizer->b3CodeLinkBuffer = std::make_unique<LinkBuffer>(
+        vm, jit, codeBlock, JITCompilationCanFail);
+    if (state.finalizer->b3CodeLinkBuffer->didFailToAllocate()) {
+        state.allocationFailed = true;
+        return;
+    }
+    
+    B3::PCToOriginMap originMap = state.proc->releasePCToOriginMap();
+    if (vm.shouldBuilderPCToCodeOriginMapping())
+        codeBlock->setPCToCodeOriginMap(std::make_unique<PCToCodeOriginMap>(PCToCodeOriginMapBuilder(vm, WTFMove(originMap)), *state.finalizer->b3CodeLinkBuffer));
+
+    state.generatedFunction = bitwise_cast<GeneratedFunction>(
+        state.finalizer->b3CodeLinkBuffer->entrypoint().executableAddress());
+    state.jitCode->initializeB3Byproducts(state.proc->releaseByproducts());
+}
+
+} } // namespace JSC::FTL
+
+#endif // ENABLE(FTL_JIT)
+

Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp (196730 => 196731)


--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp	2016-02-18 00:37:50 UTC (rev 196730)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp	2016-02-18 00:42:36 UTC (rev 196731)
@@ -41,13 +41,13 @@
 #include "DirectArguments.h"
 #include "FTLAbstractHeapRepository.h"
 #include "FTLAvailableRecovery.h"
-#include "FTLB3Output.h"
 #include "FTLExceptionTarget.h"
 #include "FTLForOSREntryJITCode.h"
 #include "FTLFormattedValue.h"
 #include "FTLLazySlowPathCall.h"
 #include "FTLLoweredNodeValue.h"
 #include "FTLOperations.h"
+#include "FTLOutput.h"
 #include "FTLPatchpointExceptionHandle.h"
 #include "FTLThunks.h"
 #include "FTLWeightedTarget.h"

Copied: trunk/Source/_javascript_Core/ftl/FTLOutput.cpp (from rev 196729, trunk/Source/_javascript_Core/ftl/FTLB3Output.cpp) (0 => 196731)


--- trunk/Source/_javascript_Core/ftl/FTLOutput.cpp	                        (rev 0)
+++ trunk/Source/_javascript_Core/ftl/FTLOutput.cpp	2016-02-18 00:42:36 UTC (rev 196731)
@@ -0,0 +1,302 @@
+/*
+ * Copyright (C) 2013-2016 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 "FTLOutput.h"
+
+#if ENABLE(FTL_JIT)
+
+#include "B3MathExtras.h"
+#include "B3StackmapGenerationParams.h"
+
+namespace JSC { namespace FTL {
+
+using namespace B3;
+
+Output::Output(State& state)
+    : m_proc(*state.proc)
+{
+}
+
+Output::~Output()
+{
+}
+
+void Output::initialize(AbstractHeapRepository& heaps)
+{
+    m_heaps = &heaps;
+}
+
+LBasicBlock Output::newBlock(const char*)
+{
+    LBasicBlock result = m_proc.addBlock(m_frequency);
+
+    if (!m_nextBlock)
+        m_blockOrder.append(result);
+    else
+        m_blockOrder.insertBefore(m_nextBlock, result);
+
+    return result;
+}
+
+void Output::applyBlockOrder()
+{
+    m_proc.setBlockOrder(m_blockOrder);
+}
+
+LBasicBlock Output::appendTo(LBasicBlock block, LBasicBlock nextBlock)
+{
+    appendTo(block);
+    return insertNewBlocksBefore(nextBlock);
+}
+
+void Output::appendTo(LBasicBlock block)
+{
+    m_block = block;
+}
+
+SlotBaseValue* Output::lockedStackSlot(size_t bytes)
+{
+    return m_block->appendNew<SlotBaseValue>(m_proc, origin(), m_proc.addStackSlot(bytes));
+}
+
+LValue Output::neg(LValue value)
+{
+    return m_block->appendNew<Value>(m_proc, B3::Neg, origin(), value);
+}
+
+LValue Output::bitNot(LValue value)
+{
+    return m_block->appendNew<B3::Value>(m_proc, B3::BitXor, origin(),
+        value,
+        m_block->appendIntConstant(m_proc, origin(), value->type(), -1));
+}
+
+LValue Output::logicalNot(LValue value)
+{
+    return m_block->appendNew<B3::Value>(m_proc, B3::Equal, origin(), value, int32Zero);
+}
+
+LValue Output::load(TypedPointer pointer, LType type)
+{
+    LValue load = m_block->appendNew<MemoryValue>(m_proc, Load, type, origin(), pointer.value());
+    pointer.heap().decorateInstruction(load, *m_heaps);
+    return load;
+}
+
+LValue Output::doublePowi(LValue x, LValue y)
+{
+    // FIXME: powDoubleInt32() should be inlined here since Output knows about block layout and
+    // should be involved in any operation that creates blocks.
+    // https://bugs.webkit.org/show_bug.cgi?id=152223
+    auto result = powDoubleInt32(m_proc, m_block, origin(), x, y);
+    m_block = result.first;
+    return result.second;
+}
+
+bool Output::hasSensibleDoubleToInt()
+{
+    return optimizeForX86();
+}
+
+LValue Output::doubleToInt(LValue value)
+{
+    PatchpointValue* result = patchpoint(Int32);
+    result->append(value, ValueRep::SomeRegister);
+    result->setGenerator(
+        [] (CCallHelpers& jit, const StackmapGenerationParams& params) {
+            jit.truncateDoubleToInt32(params[1].fpr(), params[0].gpr());
+        });
+    result->effects = Effects::none();
+    return result;
+}
+
+LValue Output::doubleToUInt(LValue value)
+{
+    PatchpointValue* result = patchpoint(Int32);
+    result->append(value, ValueRep::SomeRegister);
+    result->setGenerator(
+        [] (CCallHelpers& jit, const StackmapGenerationParams& params) {
+            jit.truncateDoubleToUint32(params[1].fpr(), params[0].gpr());
+        });
+    result->effects = Effects::none();
+    return result;
+}
+
+LValue Output::unsignedToDouble(LValue value)
+{
+    return intToDouble(zeroExt(value, Int64));
+}
+
+LValue Output::load8SignExt32(TypedPointer pointer)
+{
+    LValue load = m_block->appendNew<MemoryValue>(m_proc, Load8S, Int32, origin(), pointer.value());
+    pointer.heap().decorateInstruction(load, *m_heaps);
+    return load;
+}
+
+LValue Output::load8ZeroExt32(TypedPointer pointer)
+{
+    LValue load = m_block->appendNew<MemoryValue>(m_proc, Load8Z, Int32, origin(), pointer.value());
+    pointer.heap().decorateInstruction(load, *m_heaps);
+    return load;
+}
+
+LValue Output::load16SignExt32(TypedPointer pointer)
+{
+    LValue load = m_block->appendNew<MemoryValue>(m_proc, Load16S, Int32, origin(), pointer.value());
+    pointer.heap().decorateInstruction(load, *m_heaps);
+    return load;
+}
+
+LValue Output::load16ZeroExt32(TypedPointer pointer)
+{
+    LValue load = m_block->appendNew<MemoryValue>(m_proc, Load16Z, Int32, origin(), pointer.value());
+    pointer.heap().decorateInstruction(load, *m_heaps);
+    return load;
+}
+
+void Output::store(LValue value, TypedPointer pointer)
+{
+    LValue store = m_block->appendNew<MemoryValue>(m_proc, Store, origin(), value, pointer.value());
+    pointer.heap().decorateInstruction(store, *m_heaps);
+}
+
+void Output::store32As8(LValue value, TypedPointer pointer)
+{
+    LValue store = m_block->appendNew<MemoryValue>(m_proc, Store8, origin(), value, pointer.value());
+    pointer.heap().decorateInstruction(store, *m_heaps);
+}
+
+void Output::store32As16(LValue value, TypedPointer pointer)
+{
+    LValue store = m_block->appendNew<MemoryValue>(m_proc, Store16, origin(), value, pointer.value());
+    pointer.heap().decorateInstruction(store, *m_heaps);
+}
+
+LValue Output::baseIndex(LValue base, LValue index, Scale scale, ptrdiff_t offset)
+{
+    LValue accumulatedOffset;
+        
+    switch (scale) {
+    case ScaleOne:
+        accumulatedOffset = index;
+        break;
+    case ScaleTwo:
+        accumulatedOffset = shl(index, intPtrOne);
+        break;
+    case ScaleFour:
+        accumulatedOffset = shl(index, intPtrTwo);
+        break;
+    case ScaleEight:
+    case ScalePtr:
+        accumulatedOffset = shl(index, intPtrThree);
+        break;
+    }
+        
+    if (offset)
+        accumulatedOffset = add(accumulatedOffset, constIntPtr(offset));
+        
+    return add(base, accumulatedOffset);
+}
+
+void Output::branch(LValue condition, LBasicBlock taken, Weight takenWeight, LBasicBlock notTaken, Weight notTakenWeight)
+{
+    m_block->appendNew<ControlValue>(
+        m_proc, B3::Branch, origin(), condition,
+        FrequentedBlock(taken, takenWeight.frequencyClass()),
+        FrequentedBlock(notTaken, notTakenWeight.frequencyClass()));
+}
+
+void Output::check(LValue condition, WeightedTarget taken, Weight notTakenWeight)
+{
+    LBasicBlock continuation = FTL_NEW_BLOCK(*this, ("Output::check continuation"));
+    branch(condition, taken, WeightedTarget(continuation, notTakenWeight));
+    appendTo(continuation);
+}
+
+void Output::check(LValue condition, WeightedTarget taken)
+{
+    check(condition, taken, taken.weight().inverse());
+}
+
+LValue Output::load(TypedPointer pointer, LoadType type)
+{
+    switch (type) {
+    case Load8SignExt32:
+        return load8SignExt32(pointer);
+    case Load8ZeroExt32:
+        return load8ZeroExt32(pointer);
+    case Load16SignExt32:
+        return load8SignExt32(pointer);
+    case Load16ZeroExt32:
+        return load8ZeroExt32(pointer);
+    case Load32:
+        return load32(pointer);
+    case Load64:
+        return load64(pointer);
+    case LoadPtr:
+        return loadPtr(pointer);
+    case LoadFloat:
+        return loadFloat(pointer);
+    case LoadDouble:
+        return loadDouble(pointer);
+    }
+    RELEASE_ASSERT_NOT_REACHED();
+    return nullptr;
+}
+
+void Output::store(LValue value, TypedPointer pointer, StoreType type)
+{
+    switch (type) {
+    case Store32As8:
+        store32As8(value, pointer);
+        return;
+    case Store32As16:
+        store32As16(value, pointer);
+        return;
+    case Store32:
+        store32(value, pointer);
+        return;
+    case Store64:
+        store64(value, pointer);
+        return;
+    case StorePtr:
+        storePtr(value, pointer);
+        return;
+    case StoreFloat:
+        storeFloat(value, pointer);
+        return;
+    case StoreDouble:
+        storeDouble(value, pointer);
+        return;
+    }
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+} } // namespace JSC::FTL
+
+#endif // ENABLE(FTL_JIT)
+

Copied: trunk/Source/_javascript_Core/ftl/FTLOutput.h (from rev 196729, trunk/Source/_javascript_Core/ftl/FTLB3Output.h) (0 => 196731)


--- trunk/Source/_javascript_Core/ftl/FTLOutput.h	                        (rev 0)
+++ trunk/Source/_javascript_Core/ftl/FTLOutput.h	2016-02-18 00:42:36 UTC (rev 196731)
@@ -0,0 +1,535 @@
+/*
+ * Copyright (C) 2013-2016 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 FTLOutput_h
+#define FTLOutput_h
+
+#include "DFGCommon.h"
+
+#if ENABLE(FTL_JIT)
+
+#include "B3ArgumentRegValue.h"
+#include "B3BasicBlockInlines.h"
+#include "B3CCallValue.h"
+#include "B3Compilation.h"
+#include "B3Const32Value.h"
+#include "B3ConstPtrValue.h"
+#include "B3ControlValue.h"
+#include "B3MemoryValue.h"
+#include "B3Procedure.h"
+#include "B3SlotBaseValue.h"
+#include "B3SwitchValue.h"
+#include "B3UpsilonValue.h"
+#include "B3ValueInlines.h"
+#include "FTLAbbreviatedTypes.h"
+#include "FTLAbstractHeapRepository.h"
+#include "FTLCommonValues.h"
+#include "FTLState.h"
+#include "FTLSwitchCase.h"
+#include "FTLTypedPointer.h"
+#include "FTLValueFromBlock.h"
+#include "FTLWeight.h"
+#include "FTLWeightedTarget.h"
+#include <wtf/OrderMaker.h>
+#include <wtf/StringPrintStream.h>
+
+// FIXME: remove this once everything can be generated through B3.
+#if COMPILER(GCC_OR_CLANG)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmissing-noreturn"
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#endif // COMPILER(GCC_OR_CLANG)
+
+namespace JSC {
+
+namespace DFG { struct Node; }
+
+namespace FTL {
+
+enum Scale { ScaleOne, ScaleTwo, ScaleFour, ScaleEight, ScalePtr };
+
+class Output : public CommonValues {
+public:
+    Output(State&);
+    ~Output();
+
+    void initialize(AbstractHeapRepository&);
+
+    void setFrequency(double value)
+    {
+        m_frequency = value;
+    }
+
+    LBasicBlock newBlock(const char* name = "");
+
+    LBasicBlock insertNewBlocksBefore(LBasicBlock nextBlock)
+    {
+        LBasicBlock lastNextBlock = m_nextBlock;
+        m_nextBlock = nextBlock;
+        return lastNextBlock;
+    }
+
+    void applyBlockOrder();
+
+    LBasicBlock appendTo(LBasicBlock, LBasicBlock nextBlock);
+    void appendTo(LBasicBlock);
+
+    void setOrigin(DFG::Node* node) { m_origin = node; }
+    B3::Origin origin() { return B3::Origin(m_origin); }
+
+    LValue framePointer() { return m_block->appendNew<B3::Value>(m_proc, B3::FramePointer, origin()); }
+
+    B3::SlotBaseValue* lockedStackSlot(size_t bytes);
+
+    LValue constBool(bool value) { return m_block->appendNew<B3::Const32Value>(m_proc, origin(), value); }
+    LValue constInt32(int32_t value) { return m_block->appendNew<B3::Const32Value>(m_proc, origin(), value); }
+    template<typename T>
+    LValue constIntPtr(T* value) { return m_block->appendNew<B3::ConstPtrValue>(m_proc, origin(), value); }
+    template<typename T>
+    LValue constIntPtr(T value) { return m_block->appendNew<B3::ConstPtrValue>(m_proc, origin(), value); }
+    LValue constInt64(int64_t value) { return m_block->appendNew<B3::Const64Value>(m_proc, origin(), value); }
+    LValue constDouble(double value) { return m_block->appendNew<B3::ConstDoubleValue>(m_proc, origin(), value); }
+
+    LValue phi(LType type) { return m_block->appendNew<B3::Value>(m_proc, B3::Phi, type, origin()); }
+    template<typename... Params>
+    LValue phi(LType, ValueFromBlock, Params... theRest);
+    template<typename VectorType>
+    LValue phi(LType, const VectorType&);
+    void addIncomingToPhi(LValue phi, ValueFromBlock);
+    template<typename... Params>
+    void addIncomingToPhi(LValue phi, ValueFromBlock, Params... theRest);
+
+    LValue add(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Add, origin(), left, right); }
+    LValue sub(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Sub, origin(), left, right); }
+    LValue mul(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Mul, origin(), left, right); }
+    LValue div(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Div, origin(), left, right); }
+    LValue chillDiv(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::ChillDiv, origin(), left, right); }
+    LValue mod(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Mod, origin(), left, right); }
+    LValue chillMod(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::ChillMod, origin(), left, right); }
+    LValue neg(LValue);
+
+    LValue doubleAdd(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Add, origin(), left, right); }
+    LValue doubleSub(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Sub, origin(), left, right); }
+    LValue doubleMul(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Mul, origin(), left, right); }
+    LValue doubleDiv(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Div, origin(), left, right); }
+    LValue doubleMod(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Mod, origin(), left, right); }
+    LValue doubleNeg(LValue value) { return neg(value); }
+
+    LValue bitAnd(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::BitAnd, origin(), left, right); }
+    LValue bitOr(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::BitOr, origin(), left, right); }
+    LValue bitXor(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::BitXor, origin(), left, right); }
+    LValue shl(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Shl, origin(), left, castToInt32(right)); }
+    LValue aShr(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::SShr, origin(), left, castToInt32(right)); }
+    LValue lShr(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::ZShr, origin(), left, castToInt32(right)); }
+    LValue bitNot(LValue);
+    LValue logicalNot(LValue);
+
+    LValue ctlz32(LValue operand) { return m_block->appendNew<B3::Value>(m_proc, B3::Clz, origin(), operand); }
+    LValue addWithOverflow32(LValue left, LValue right) { CRASH(); }
+    LValue subWithOverflow32(LValue left, LValue right) { CRASH(); }
+    LValue mulWithOverflow32(LValue left, LValue right) { CRASH(); }
+    LValue addWithOverflow64(LValue left, LValue right) { CRASH(); }
+    LValue subWithOverflow64(LValue left, LValue right) { CRASH(); }
+    LValue mulWithOverflow64(LValue left, LValue right) { CRASH(); }
+    LValue doubleAbs(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::Abs, origin(), value); }
+    LValue doubleCeil(LValue operand) { return m_block->appendNew<B3::Value>(m_proc, B3::Ceil, origin(), operand); }
+
+    LValue doubleSin(LValue value)
+    {
+        double (*sinDouble)(double) = sin;
+        return callWithoutSideEffects(B3::Double, sinDouble, value);
+    }
+    LValue doubleCos(LValue value)
+    {
+        double (*cosDouble)(double) = cos;
+        return callWithoutSideEffects(B3::Double, cosDouble, value);
+    }
+
+    LValue doublePow(LValue xOperand, LValue yOperand)
+    {
+        double (*powDouble)(double, double) = pow;
+        return callWithoutSideEffects(B3::Double, powDouble, xOperand, yOperand);
+    }
+
+    LValue doublePowi(LValue xOperand, LValue yOperand);
+
+    LValue doubleSqrt(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::Sqrt, origin(), value); }
+
+    LValue doubleLog(LValue value)
+    {
+        double (*logDouble)(double) = log;
+        return callWithoutSideEffects(B3::Double, logDouble, value);
+    }
+
+    static bool hasSensibleDoubleToInt();
+    LValue doubleToInt(LValue);
+    LValue doubleToUInt(LValue);
+
+    LValue signExt32To64(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::SExt32, origin(), value); }
+    LValue zeroExt(LValue value, LType type)
+    {
+        if (value->type() == type)
+            return value;
+        return m_block->appendNew<B3::Value>(m_proc, B3::ZExt32, origin(), value);
+    }
+    LValue zeroExtPtr(LValue value) { return zeroExt(value, B3::Int64); }
+    LValue intToDouble(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::IToD, origin(), value); }
+    LValue unsignedToDouble(LValue);
+    LValue castToInt32(LValue value)
+    {
+        return value->type() == B3::Int32 ? value :
+            m_block->appendNew<B3::Value>(m_proc, B3::Trunc, origin(), value);
+    }
+    LValue doubleToFloat(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::DoubleToFloat, origin(), value); }
+    LValue floatToDouble(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::FloatToDouble, origin(), value); }
+    LValue bitCast(LValue, LType);
+    LValue fround(LValue doubleValue);
+
+    LValue load(TypedPointer, LType);
+    void store(LValue, TypedPointer);
+
+    LValue load8SignExt32(TypedPointer);
+    LValue load8ZeroExt32(TypedPointer);
+    LValue load16SignExt32(TypedPointer);
+    LValue load16ZeroExt32(TypedPointer);
+    LValue load32(TypedPointer pointer) { return load(pointer, B3::Int32); }
+    LValue load64(TypedPointer pointer) { return load(pointer, B3::Int64); }
+    LValue loadPtr(TypedPointer pointer) { return load(pointer, B3::pointerType()); }
+    LValue loadFloat(TypedPointer pointer) { return load(pointer, B3::Float); }
+    LValue loadDouble(TypedPointer pointer) { return load(pointer, B3::Double); }
+    void store32As8(LValue value, TypedPointer pointer);
+    void store32As16(LValue value, TypedPointer pointer);
+    void store32(LValue value, TypedPointer pointer)
+    {
+        ASSERT(value->type() == B3::Int32);
+        store(value, pointer);
+    }
+    void store64(LValue value, TypedPointer pointer)
+    {
+        ASSERT(value->type() == B3::Int64);
+        store(value, pointer);
+    }
+    void storePtr(LValue value, TypedPointer pointer)
+    {
+        ASSERT(value->type() == B3::pointerType());
+        store(value, pointer);
+    }
+    void storeFloat(LValue value, TypedPointer pointer)
+    {
+        ASSERT(value->type() == B3::Float);
+        store(value, pointer);
+    }
+    void storeDouble(LValue value, TypedPointer pointer)
+    {
+        ASSERT(value->type() == B3::Double);
+        store(value, pointer);
+    }
+
+    enum LoadType {
+        Load8SignExt32,
+        Load8ZeroExt32,
+        Load16SignExt32,
+        Load16ZeroExt32,
+        Load32,
+        Load64,
+        LoadPtr,
+        LoadFloat,
+        LoadDouble
+    };
+
+    LValue load(TypedPointer, LoadType);
+    
+    enum StoreType {
+        Store32As8,
+        Store32As16,
+        Store32,
+        Store64,
+        StorePtr,
+        StoreFloat,
+        StoreDouble
+    };
+
+    void store(LValue, TypedPointer, StoreType);
+
+    LValue addPtr(LValue value, ptrdiff_t immediate = 0)
+    {
+        if (!immediate)
+            return value;
+        return add(value, constIntPtr(immediate));
+    }
+
+    // Construct an address by offsetting base by the requested amount and ascribing
+    // the requested abstract heap to it.
+    TypedPointer address(const AbstractHeap& heap, LValue base, ptrdiff_t offset = 0)
+    {
+        return TypedPointer(heap, addPtr(base, offset));
+    }
+    // Construct an address by offsetting base by the amount specified by the field,
+    // and optionally an additional amount (use this with care), and then creating
+    // a TypedPointer with the given field as the heap.
+    TypedPointer address(LValue base, const AbstractField& field, ptrdiff_t offset = 0)
+    {
+        return address(field, base, offset + field.offset());
+    }
+
+    LValue baseIndex(LValue base, LValue index, Scale, ptrdiff_t offset = 0);
+
+    TypedPointer baseIndex(const AbstractHeap& heap, LValue base, LValue index, Scale scale, ptrdiff_t offset = 0)
+    {
+        return TypedPointer(heap, baseIndex(base, index, scale, offset));
+    }
+    TypedPointer baseIndex(IndexedAbstractHeap& heap, LValue base, LValue index, JSValue indexAsConstant = JSValue(), ptrdiff_t offset = 0)
+    {
+        return heap.baseIndex(*this, base, index, indexAsConstant, offset);
+    }
+
+    TypedPointer absolute(void* address)
+    {
+        return TypedPointer(m_heaps->absolute[address], constIntPtr(address));
+    }
+
+    LValue load8SignExt32(LValue base, const AbstractField& field) { return load8SignExt32(address(base, field)); }
+    LValue load8ZeroExt32(LValue base, const AbstractField& field) { return load8ZeroExt32(address(base, field)); }
+    LValue load16SignExt32(LValue base, const AbstractField& field) { return load16SignExt32(address(base, field)); }
+    LValue load16ZeroExt32(LValue base, const AbstractField& field) { return load16ZeroExt32(address(base, field)); }
+    LValue load32(LValue base, const AbstractField& field) { return load32(address(base, field)); }
+    LValue load64(LValue base, const AbstractField& field) { return load64(address(base, field)); }
+    LValue loadPtr(LValue base, const AbstractField& field) { return loadPtr(address(base, field)); }
+    LValue loadDouble(LValue base, const AbstractField& field) { return loadDouble(address(base, field)); }
+    void store32(LValue value, LValue base, const AbstractField& field) { store32(value, address(base, field)); }
+    void store64(LValue value, LValue base, const AbstractField& field) { store64(value, address(base, field)); }
+    void storePtr(LValue value, LValue base, const AbstractField& field) { storePtr(value, address(base, field)); }
+    void storeDouble(LValue value, LValue base, const AbstractField& field) { storeDouble(value, address(base, field)); }
+
+    // FIXME: Explore adding support for value range constraints to B3. Maybe it could be as simple as having
+    // a load instruction that guarantees that its result is non-negative.
+    // https://bugs.webkit.org/show_bug.cgi?id=151458
+    void ascribeRange(LValue, const ValueRange&) { }
+    LValue nonNegative32(LValue loadInstruction) { return loadInstruction; }
+    LValue load32NonNegative(TypedPointer pointer) { return load32(pointer); }
+    LValue load32NonNegative(LValue base, const AbstractField& field) { return load32(base, field); }
+
+    LValue equal(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Equal, origin(), left, right); }
+    LValue notEqual(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::NotEqual, origin(), left, right); }
+    LValue above(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Above, origin(), left, right); }
+    LValue aboveOrEqual(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::AboveEqual, origin(), left, right); }
+    LValue below(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Below, origin(), left, right); }
+    LValue belowOrEqual(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::BelowEqual, origin(), left, right); }
+    LValue greaterThan(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::GreaterThan, origin(), left, right); }
+    LValue greaterThanOrEqual(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::GreaterEqual, origin(), left, right); }
+    LValue lessThan(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::LessThan, origin(), left, right); }
+    LValue lessThanOrEqual(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::LessEqual, origin(), left, right); }
+
+    LValue doubleEqual(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::Equal, origin(), left, right); }
+    LValue doubleEqualOrUnordered(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::EqualOrUnordered, origin(), left, right); }
+    LValue doubleNotEqualOrUnordered(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::NotEqual, origin(), left, right); }
+    LValue doubleLessThan(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::LessThan, origin(), left, right); }
+    LValue doubleLessThanOrEqual(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::LessEqual, origin(), left, right); }
+    LValue doubleGreaterThan(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::GreaterThan, origin(), left, right); }
+    LValue doubleGreaterThanOrEqual(LValue left, LValue right) { return m_block->appendNew<B3::Value>(m_proc, B3::GreaterEqual, origin(), left, right); }
+    LValue doubleNotEqualAndOrdered(LValue left, LValue right) { return logicalNot(doubleEqualOrUnordered(left, right)); }
+    LValue doubleLessThanOrUnordered(LValue left, LValue right) { return logicalNot(doubleGreaterThanOrEqual(left, right)); }
+    LValue doubleLessThanOrEqualOrUnordered(LValue left, LValue right) { return logicalNot(doubleGreaterThan(left, right)); }
+    LValue doubleGreaterThanOrUnordered(LValue left, LValue right) { return logicalNot(doubleLessThanOrEqual(left, right)); }
+    LValue doubleGreaterThanOrEqualOrUnordered(LValue left, LValue right) { return logicalNot(doubleLessThan(left, right)); }
+
+    LValue isZero32(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::Equal, origin(), value, int32Zero); }
+    LValue notZero32(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::NotEqual, origin(), value, int32Zero); }
+    LValue isZero64(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::Equal, origin(), value, int64Zero); }
+    LValue notZero64(LValue value) { return m_block->appendNew<B3::Value>(m_proc, B3::NotEqual, origin(), value, int64Zero); }
+    LValue isNull(LValue value) { return isZero64(value); }
+    LValue notNull(LValue value) { return notZero64(value); }
+
+    LValue testIsZero32(LValue value, LValue mask) { return isZero32(bitAnd(value, mask)); }
+    LValue testNonZero32(LValue value, LValue mask) { return notZero32(bitAnd(value, mask)); }
+    LValue testIsZero64(LValue value, LValue mask) { return isZero64(bitAnd(value, mask)); }
+    LValue testNonZero64(LValue value, LValue mask) { return notZero64(bitAnd(value, mask)); }
+    LValue testIsZeroPtr(LValue value, LValue mask) { return isNull(bitAnd(value, mask)); }
+    LValue testNonZeroPtr(LValue value, LValue mask) { return notNull(bitAnd(value, mask)); }
+
+    LValue select(LValue value, LValue taken, LValue notTaken) { return m_block->appendNew<B3::Value>(m_proc, B3::Select, origin(), value, taken, notTaken); }
+    LValue extractValue(LValue aggVal, unsigned index) { CRASH(); }
+
+    template<typename VectorType>
+    LValue call(LType type, LValue function, const VectorType& vector)
+    {
+        B3::CCallValue* result = m_block->appendNew<B3::CCallValue>(m_proc, type, origin(), function);
+        result->children().appendVector(vector);
+        return result;
+    }
+    LValue call(LType type, LValue function) { return m_block->appendNew<B3::CCallValue>(m_proc, type, origin(), function); }
+    LValue call(LType type, LValue function, LValue arg1) { return m_block->appendNew<B3::CCallValue>(m_proc, type, origin(), function, arg1); }
+    template<typename... Args>
+    LValue call(LType type, LValue function, LValue arg1, Args... args) { return m_block->appendNew<B3::CCallValue>(m_proc, type, origin(), function, arg1, args...); }
+
+    template<typename FunctionType>
+    LValue operation(FunctionType function) { return constIntPtr(bitwise_cast<void*>(function)); }
+
+    void jump(LBasicBlock destination) { m_block->appendNew<B3::ControlValue>(m_proc, B3::Jump, origin(), B3::FrequentedBlock(destination)); }
+    void branch(LValue condition, LBasicBlock taken, Weight takenWeight, LBasicBlock notTaken, Weight notTakenWeight);
+    void branch(LValue condition, WeightedTarget taken, WeightedTarget notTaken)
+    {
+        branch(condition, taken.target(), taken.weight(), notTaken.target(), notTaken.weight());
+    }
+
+    // Branches to an already-created handler if true, "falls through" if false. Fall-through is
+    // simulated by creating a continuation for you.
+    void check(LValue condition, WeightedTarget taken, Weight notTakenWeight);
+    
+    // Same as check(), but uses Weight::inverse() to compute the notTakenWeight.
+    void check(LValue condition, WeightedTarget taken);
+    
+    template<typename VectorType>
+    void switchInstruction(LValue value, const VectorType& cases, LBasicBlock fallThrough, Weight fallThroughWeight)
+    {
+        B3::SwitchValue* switchValue = m_block->appendNew<B3::SwitchValue>(
+            m_proc, origin(), value, B3::FrequentedBlock(fallThrough));
+        for (const SwitchCase& switchCase : cases) {
+            int64_t value = switchCase.value()->asInt();
+            B3::FrequentedBlock target(switchCase.target(), switchCase.weight().frequencyClass());
+            switchValue->appendCase(B3::SwitchCase(value, target));
+        }
+    }
+
+    void ret(LValue value) { m_block->appendNew<B3::ControlValue>(m_proc, B3::Return, origin(), value); }
+
+    void unreachable() { m_block->appendNew<B3::ControlValue>(m_proc, B3::Oops, origin()); }
+
+    B3::CheckValue* speculate(LValue value)
+    {
+        return m_block->appendNew<B3::CheckValue>(m_proc, B3::Check, origin(), value);
+    }
+
+    B3::CheckValue* speculateAdd(LValue left, LValue right)
+    {
+        return m_block->appendNew<B3::CheckValue>(m_proc, B3::CheckAdd, origin(), left, right);
+    }
+
+    B3::CheckValue* speculateSub(LValue left, LValue right)
+    {
+        return m_block->appendNew<B3::CheckValue>(m_proc, B3::CheckSub, origin(), left, right);
+    }
+
+    B3::CheckValue* speculateMul(LValue left, LValue right)
+    {
+        return m_block->appendNew<B3::CheckValue>(m_proc, B3::CheckMul, origin(), left, right);
+    }
+
+    B3::PatchpointValue* patchpoint(LType type)
+    {
+        return m_block->appendNew<B3::PatchpointValue>(m_proc, type, origin());
+    }
+
+    void trap()
+    {
+        m_block->appendNew<B3::ControlValue>(m_proc, B3::Oops, origin());
+    }
+
+    ValueFromBlock anchor(LValue value)
+    {
+        B3::UpsilonValue* upsilon = m_block->appendNew<B3::UpsilonValue>(m_proc, origin(), value);
+        return ValueFromBlock(upsilon, m_block);
+    }
+
+#if PLATFORM(COCOA)
+#pragma mark - States
+#endif
+    B3::Procedure& m_proc;
+
+    DFG::Node* m_origin { nullptr };
+    LBasicBlock m_block { nullptr };
+    LBasicBlock m_nextBlock { nullptr };
+
+    AbstractHeapRepository* m_heaps;
+
+    double m_frequency { 1 };
+
+private:
+    OrderMaker<LBasicBlock> m_blockOrder;
+    
+    template<typename Function, typename... Args>
+    LValue callWithoutSideEffects(B3::Type type, Function function, LValue arg1, Args... args)
+    {
+        return m_block->appendNew<B3::CCallValue>(m_proc, type, origin(), B3::Effects::none(),
+            m_block->appendNew<B3::ConstPtrValue>(m_proc, origin(), bitwise_cast<void*>(function)),
+            arg1, args...);
+    }
+
+};
+
+template<typename... Params>
+inline LValue Output::phi(LType type, ValueFromBlock value, Params... theRest)
+{
+    LValue phiNode = phi(type);
+    addIncomingToPhi(phiNode, value, theRest...);
+    return phiNode;
+}
+
+template<typename VectorType>
+inline LValue Output::phi(LType type, const VectorType& vector)
+{
+    LValue phiNode = phi(type);
+    for (const ValueFromBlock& valueFromBlock : vector)
+        addIncomingToPhi(phiNode, valueFromBlock);
+    return phiNode;
+}
+
+inline void Output::addIncomingToPhi(LValue phi, ValueFromBlock value)
+{
+    value.value()->as<B3::UpsilonValue>()->setPhi(phi);
+}
+
+template<typename... Params>
+inline void Output::addIncomingToPhi(LValue phi, ValueFromBlock value, Params... theRest)
+{
+    addIncomingToPhi(phi, value);
+    addIncomingToPhi(phi, theRest...);
+}
+
+inline LValue Output::bitCast(LValue value, LType type)
+{
+    ASSERT_UNUSED(type, type == int64 || type == doubleType);
+    return m_block->appendNew<B3::Value>(m_proc, B3::BitwiseCast, origin(), value);
+}
+
+inline LValue Output::fround(LValue doubleValue)
+{
+    return floatToDouble(doubleToFloat(doubleValue));
+}
+
+#if COMPILER(GCC_OR_CLANG)
+#pragma GCC diagnostic pop
+#endif // COMPILER(GCC_OR_CLANG)
+
+#define FTL_NEW_BLOCK(output, nameArguments) \
+    (LIKELY(!verboseCompilationEnabled()) \
+    ? (output).newBlock() \
+    : (output).newBlock((toCString nameArguments).data()))
+
+} } // namespace JSC::FTL
+
+#endif // ENABLE(FTL_JIT)
+
+#endif // FTLOutput_h
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to