Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (191844 => 191845)
--- trunk/Source/_javascript_Core/ChangeLog 2015-10-31 17:48:47 UTC (rev 191844)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-10-31 23:01:30 UTC (rev 191845)
@@ -1,3 +1,22 @@
+2015-10-31 Filip Pizlo <[email protected]>
+
+ Air needs a late register liveness phase that calls Special::reportUsedRegisters()
+ https://bugs.webkit.org/show_bug.cgi?id=150511
+
+ Reviewed by Saam Barati.
+
+ This change adds such a phase. In the process of writing it, I was reminded about the
+ glaring efficiency bugs in Air::Liveness and so I filed a bug and added FIXMEs.
+
+ * _javascript_Core.xcodeproj/project.pbxproj:
+ * b3/air/AirAllocateStack.cpp:
+ (JSC::B3::Air::allocateStack):
+ * b3/air/AirGenerate.cpp:
+ (JSC::B3::Air::generate):
+ * b3/air/AirReportUsedRegisters.cpp: Added.
+ (JSC::B3::Air::reportUsedRegisters):
+ * b3/air/AirReportUsedRegisters.h: Added.
+
2015-10-31 Brian Burg <[email protected]>
Builtins generator should put WebCore-only wrappers in the per-builtin header
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (191844 => 191845)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2015-10-31 17:48:47 UTC (rev 191844)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2015-10-31 23:01:30 UTC (rev 191845)
@@ -311,6 +311,8 @@
0F426A491460CBB700131F8F /* VirtualRegister.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F426A461460CBAB00131F8F /* VirtualRegister.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F426A4B1460CD6E00131F8F /* DataFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F426A4A1460CD6B00131F8F /* DataFormat.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F431738146BAC69007E3890 /* ListableHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F431736146BAC65007E3890 /* ListableHandler.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 0F45703C1BE45F0A0062A629 /* AirReportUsedRegisters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F45703A1BE45F0A0062A629 /* AirReportUsedRegisters.cpp */; };
+ 0F45703D1BE45F0A0062A629 /* AirReportUsedRegisters.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F45703B1BE45F0A0062A629 /* AirReportUsedRegisters.h */; };
0F46808214BA572D00BFE272 /* JITExceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F46808014BA572700BFE272 /* JITExceptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F46808314BA573100BFE272 /* JITExceptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F46807F14BA572700BFE272 /* JITExceptions.cpp */; };
0F4680A314BA7F8D00BFE272 /* LLIntExceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F46809E14BA7F8200BFE272 /* LLIntExceptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -2325,6 +2327,8 @@
0F426A461460CBAB00131F8F /* VirtualRegister.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VirtualRegister.h; sourceTree = "<group>"; };
0F426A4A1460CD6B00131F8F /* DataFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataFormat.h; sourceTree = "<group>"; };
0F431736146BAC65007E3890 /* ListableHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ListableHandler.h; sourceTree = "<group>"; };
+ 0F45703A1BE45F0A0062A629 /* AirReportUsedRegisters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AirReportUsedRegisters.cpp; path = b3/air/AirReportUsedRegisters.cpp; sourceTree = "<group>"; };
+ 0F45703B1BE45F0A0062A629 /* AirReportUsedRegisters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AirReportUsedRegisters.h; path = b3/air/AirReportUsedRegisters.h; sourceTree = "<group>"; };
0F46807F14BA572700BFE272 /* JITExceptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITExceptions.cpp; sourceTree = "<group>"; };
0F46808014BA572700BFE272 /* JITExceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITExceptions.h; sourceTree = "<group>"; };
0F46809D14BA7F8200BFE272 /* LLIntExceptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LLIntExceptions.cpp; path = llint/LLIntExceptions.cpp; sourceTree = "<group>"; };
@@ -4494,6 +4498,8 @@
264091FA1BE2FD4100684DB2 /* AirOpcode.opcodes */,
0FEC855E1BDACDC70080FF74 /* AirPhaseScope.cpp */,
0FEC855F1BDACDC70080FF74 /* AirPhaseScope.h */,
+ 0F45703A1BE45F0A0062A629 /* AirReportUsedRegisters.cpp */,
+ 0F45703B1BE45F0A0062A629 /* AirReportUsedRegisters.h */,
0FEC85601BDACDC70080FF74 /* AirRegisterPriority.cpp */,
0FEC85611BDACDC70080FF74 /* AirRegisterPriority.h */,
0FEC85621BDACDC70080FF74 /* AirSpecial.cpp */,
@@ -6774,6 +6780,7 @@
0FD8A32617D51F5700CA2C40 /* DFGOSREntrypointCreationPhase.h in Headers */,
0FC0976A1468A6F700CF2442 /* DFGOSRExit.h in Headers */,
0F235BEC17178E7300690C7F /* DFGOSRExitBase.h in Headers */,
+ 0F45703D1BE45F0A0062A629 /* AirReportUsedRegisters.h in Headers */,
0FFB921C16D02F110055A5DB /* DFGOSRExitCompilationInfo.h in Headers */,
0FEC85351BDACDAC0080FF74 /* B3StackSlotValue.h in Headers */,
0FC0977114693AF500CF2442 /* DFGOSRExitCompiler.h in Headers */,
@@ -8377,6 +8384,7 @@
62774DAA1B8D4B190006F05A /* FTLJSTailCall.cpp in Sources */,
0FB4FB731BC843140025CA5A /* FTLLazySlowPath.cpp in Sources */,
0F8F2B95172E04A0007DBDA5 /* FTLLink.cpp in Sources */,
+ 0F45703C1BE45F0A0062A629 /* AirReportUsedRegisters.cpp in Sources */,
0FCEFADF180738C000472CE4 /* FTLLocation.cpp in Sources */,
0FEA0A0F170513DB00BB722C /* FTLLowerDFGToLLVM.cpp in Sources */,
0FEC85001BDACDAC0080FF74 /* B3BasicBlock.cpp in Sources */,
Modified: trunk/Source/_javascript_Core/b3/air/AirAllocateStack.cpp (191844 => 191845)
--- trunk/Source/_javascript_Core/b3/air/AirAllocateStack.cpp 2015-10-31 17:48:47 UTC (rev 191844)
+++ trunk/Source/_javascript_Core/b3/air/AirAllocateStack.cpp 2015-10-31 23:01:30 UTC (rev 191845)
@@ -141,6 +141,8 @@
}
// Now we handle the anonymous slots.
+ // FIXME: We should tell Liveness to only track StackSlots.
+ // https://bugs.webkit.org/show_bug.cgi?id=150751
Liveness<Arg> liveness(code);
IndexMap<StackSlot, HashSet<StackSlot*>> interference(code.stackSlots().size());
Vector<StackSlot*> slots;
Modified: trunk/Source/_javascript_Core/b3/air/AirGenerate.cpp (191844 => 191845)
--- trunk/Source/_javascript_Core/b3/air/AirGenerate.cpp 2015-10-31 17:48:47 UTC (rev 191844)
+++ trunk/Source/_javascript_Core/b3/air/AirGenerate.cpp 2015-10-31 23:01:30 UTC (rev 191845)
@@ -32,6 +32,7 @@
#include "AirCode.h"
#include "AirGenerationContext.h"
#include "AirHandleCalleeSaves.h"
+#include "AirReportUsedRegisters.h"
#include "AirSpillEverything.h"
#include "AirValidate.h"
#include "B3Common.h"
@@ -75,9 +76,7 @@
// FIXME: We should really have a code layout optimization here.
// https://bugs.webkit.org/show_bug.cgi?id=150478
- // FIXME: We need a late liveness analysis over registers to fill in the
- // Special::reportUsedRegisters().
- // https://bugs.webkit.org/show_bug.cgi?id=150511
+ reportUsedRegisters(code);
if (shouldValidateIR())
validate(code);
Added: trunk/Source/_javascript_Core/b3/air/AirReportUsedRegisters.cpp (0 => 191845)
--- trunk/Source/_javascript_Core/b3/air/AirReportUsedRegisters.cpp (rev 0)
+++ trunk/Source/_javascript_Core/b3/air/AirReportUsedRegisters.cpp 2015-10-31 23:01:30 UTC (rev 191845)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * 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 "AirReportUsedRegisters.h"
+
+#if ENABLE(B3_JIT)
+
+#include "AirCode.h"
+#include "AirInstInlines.h"
+#include "AirLiveness.h"
+#include "AirPhaseScope.h"
+
+namespace JSC { namespace B3 { namespace Air {
+
+void reportUsedRegisters(Code& code)
+{
+ PhaseScope phaseScope(code, "reportUsedRegisters");
+
+ // FIXME: We should tell liveness to only track Regs.
+ // https://bugs.webkit.org/show_bug.cgi?id=150751
+ Liveness<Tmp> liveness(code);
+
+ for (BasicBlock* block : code) {
+ Liveness<Tmp>::LocalCalc localCalc(liveness, block);
+
+ for (unsigned instIndex = block->size(); instIndex--;) {
+ Inst& inst = block->at(instIndex);
+ if (inst.hasSpecial()) {
+ RegisterSet registerSet;
+ for (Tmp tmp : localCalc.live()) {
+ if (tmp.isReg())
+ registerSet.set(tmp.reg());
+ }
+ inst.reportUsedRegisters(registerSet);
+ }
+ localCalc.execute(inst);
+ }
+ }
+}
+
+} } } // namespace JSC::B3::Air
+
+#endif // ENABLE(B3_JIT)
+
+
Added: trunk/Source/_javascript_Core/b3/air/AirReportUsedRegisters.h (0 => 191845)
--- trunk/Source/_javascript_Core/b3/air/AirReportUsedRegisters.h (rev 0)
+++ trunk/Source/_javascript_Core/b3/air/AirReportUsedRegisters.h 2015-10-31 23:01:30 UTC (rev 191845)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * 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 AirReportUsedRegisters_h
+#define AirReportUsedRegisters_h
+
+#if ENABLE(B3_JIT)
+
+namespace JSC { namespace B3 { namespace Air {
+
+class Code;
+
+// Performs a liveness analysis over registers and reports the live registers to every Special.
+
+void reportUsedRegisters(Code&);
+
+} } } // namespace JSC::B3::Air
+
+#endif // ENABLE(B3_JIT)
+
+#endif // AirReportUsedRegisters_h
+