Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (278380 => 278381)
--- trunk/Source/_javascript_Core/ChangeLog 2021-06-02 23:10:10 UTC (rev 278380)
+++ trunk/Source/_javascript_Core/ChangeLog 2021-06-02 23:28:30 UTC (rev 278381)
@@ -1,3 +1,47 @@
+2021-06-02 Robin Morisset <rmoris...@apple.com>
+
+ Merge B3::StackSlot and Air::StackSlot
+ https://bugs.webkit.org/show_bug.cgi?id=226362
+
+ Reviewed by Filip Pizlo.
+
+ This is a very simple and safe (although small) memory saving, since every B3StackSlot eventually becomes an AirStackSlot with an exact copy of all the same information.
+ Simply dropping the B3StackSlot past that point is tricky, because one of them might be retained by FTLState (and modified by Air).
+ It is much simpler to just use Air::StackSlot throughout. It saves us:
+ - 16 bytes per B3StackSlot (for the structure itself)
+ - another 8 bytes per B3StackSlot (for the pointer in the SparseCollection)
+ - 8 bytes per AirStackSlot (for the pointer to the B3::StackSlot)
+ I also took the opportunity to save an extra 8 bytes per AirStackSlot, by shrinking the bytesize field to a uint16_t (with a RELEASE_ASSERT that we never overflow it) and moving the StackSlotKind in the hole this creates.
+ Total savings: 16 bytes per spill slot and 40 bytes per locked (by B3) slot.
+
+ * _javascript_Core.xcodeproj/project.pbxproj:
+ * Sources.txt:
+ * b3/B3LowerToAir.cpp:
+ * b3/B3Procedure.cpp:
+ (JSC::B3::Procedure::addStackSlot):
+ (JSC::B3::Procedure::dump const):
+ * b3/B3Procedure.h:
+ * b3/B3ProcedureInlines.h:
+ (JSC::B3::Procedure::stackSlots):
+ (JSC::B3::Procedure::stackSlots const):
+ * b3/B3SlotBaseValue.cpp:
+ * b3/B3SlotBaseValue.h:
+ * b3/B3StackSlot.cpp: Removed.
+ * b3/B3StackSlot.h: Removed.
+ * b3/B3Value.cpp:
+ * b3/air/AirCode.cpp:
+ (JSC::B3::Air::Code::addStackSlot):
+ * b3/air/AirCode.h:
+ * b3/air/AirStackSlot.cpp:
+ (JSC::B3::Air::StackSlot::setOffsetFromFP):
+ (JSC::B3::Air::StackSlot::deepDump const):
+ (JSC::B3::Air::StackSlot::StackSlot):
+ * b3/air/AirStackSlot.h:
+ (JSC::B3::Air::StackSlot::ensureSize):
+ * b3/testb3.h:
+ * ftl/FTLCompile.cpp:
+ * ftl/FTLState.h:
+
2021-06-02 Pablo Saavedra <psaave...@igalia.com>
Fix build error with ENABLE_DFG_JIT=OFF
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (278380 => 278381)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2021-06-02 23:10:10 UTC (rev 278380)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2021-06-02 23:28:30 UTC (rev 278381)
@@ -466,7 +466,6 @@
0F9332A414CA7DD90085F3C6 /* PutByIdStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F93329A14CA7DC10085F3C6 /* PutByIdStatus.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F9332A514CA7DDD0085F3C6 /* StructureSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F93329B14CA7DC10085F3C6 /* StructureSet.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F93B4AA18B92C4D00178A3F /* PutByIdVariant.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F93B4A818B92C4D00178A3F /* PutByIdVariant.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 0F9495881C57F47500413A48 /* B3StackSlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F9495861C57F47500413A48 /* B3StackSlot.h */; };
0F952AA11DF7860900E06FBD /* VisitRaceKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F952AA01DF7860700E06FBD /* VisitRaceKey.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F952ABD1B487A7700C367C5 /* TrackedReferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F952ABB1B487A7700C367C5 /* TrackedReferences.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F96303A1D4192C8005609D9 /* CellAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F9630361D4192C3005609D9 /* CellAttributes.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -2854,8 +2853,6 @@
0F93329B14CA7DC10085F3C6 /* StructureSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StructureSet.h; sourceTree = "<group>"; };
0F93B4A718B92C4D00178A3F /* PutByIdVariant.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PutByIdVariant.cpp; sourceTree = "<group>"; };
0F93B4A818B92C4D00178A3F /* PutByIdVariant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PutByIdVariant.h; sourceTree = "<group>"; };
- 0F9495851C57F47500413A48 /* B3StackSlot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = B3StackSlot.cpp; path = b3/B3StackSlot.cpp; sourceTree = "<group>"; };
- 0F9495861C57F47500413A48 /* B3StackSlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3StackSlot.h; path = b3/B3StackSlot.h; sourceTree = "<group>"; };
0F952A9F1DF7860700E06FBD /* VisitRaceKey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VisitRaceKey.cpp; sourceTree = "<group>"; };
0F952AA01DF7860700E06FBD /* VisitRaceKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisitRaceKey.h; sourceTree = "<group>"; };
0F952ABA1B487A7700C367C5 /* TrackedReferences.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TrackedReferences.cpp; sourceTree = "<group>"; };
@@ -5916,8 +5913,6 @@
0FEC84E71BDACDAC0080FF74 /* B3StackmapSpecial.h */,
0F338DEF1BE93AD10013C88F /* B3StackmapValue.cpp */,
0F338DF01BE93AD10013C88F /* B3StackmapValue.h */,
- 0F9495851C57F47500413A48 /* B3StackSlot.cpp */,
- 0F9495861C57F47500413A48 /* B3StackSlot.h */,
0FEC84EC1BDACDAC0080FF74 /* B3SuccessorCollection.h */,
0FEC84ED1BDACDAC0080FF74 /* B3SwitchCase.cpp */,
0FEC84EE1BDACDAC0080FF74 /* B3SwitchCase.h */,
@@ -9351,7 +9346,6 @@
0F33FCF81C136E2500323F67 /* B3StackmapGenerationParams.h in Headers */,
0FEC85311BDACDAC0080FF74 /* B3StackmapSpecial.h in Headers */,
0F338DF21BE93AD10013C88F /* B3StackmapValue.h in Headers */,
- 0F9495881C57F47500413A48 /* B3StackSlot.h in Headers */,
0FEC85361BDACDAC0080FF74 /* B3SuccessorCollection.h in Headers */,
0FEC85381BDACDAC0080FF74 /* B3SwitchCase.h in Headers */,
0FEC853A1BDACDAC0080FF74 /* B3SwitchValue.h in Headers */,
Modified: trunk/Source/_javascript_Core/Sources.txt (278380 => 278381)
--- trunk/Source/_javascript_Core/Sources.txt 2021-06-02 23:10:10 UTC (rev 278380)
+++ trunk/Source/_javascript_Core/Sources.txt 2021-06-02 23:28:30 UTC (rev 278381)
@@ -166,7 +166,6 @@
b3/B3StackmapGenerationParams.cpp
b3/B3StackmapSpecial.cpp
b3/B3StackmapValue.cpp
-b3/B3StackSlot.cpp
b3/B3SwitchCase.cpp
b3/B3SwitchValue.cpp
b3/B3Type.cpp
Modified: trunk/Source/_javascript_Core/b3/B3LowerToAir.cpp (278380 => 278381)
--- trunk/Source/_javascript_Core/b3/B3LowerToAir.cpp 2021-06-02 23:10:10 UTC (rev 278380)
+++ trunk/Source/_javascript_Core/b3/B3LowerToAir.cpp 2021-06-02 23:28:30 UTC (rev 278381)
@@ -153,8 +153,6 @@
}
}
- for (B3::StackSlot* stack : m_procedure.stackSlots())
- m_stackToStack.add(stack, m_code.addStackSlot(stack));
for (Variable* variable : m_procedure.variables()) {
auto addResult = m_variableToTmps.add(variable, Vector<Tmp, 1>(m_procedure.resultCount(variable->type())));
ASSERT(addResult.isNewEntry);
@@ -582,7 +580,7 @@
return Arg::addr(Tmp(GPRInfo::callFrameRegister), offset);
case SlotBase:
- return Arg::stack(m_stackToStack.get(address->as<SlotBaseValue>()->slot()), offset);
+ return Arg::stack(address->as<SlotBaseValue>()->slot(), offset);
case WasmAddress: {
WasmAddressValue* wasmAddress = address->as<WasmAddressValue>();
@@ -3017,7 +3015,7 @@
case SlotBase: {
append(
pointerType() == Int64 ? Lea64 : Lea32,
- Arg::stack(m_stackToStack.get(m_value->as<SlotBaseValue>()->slot())),
+ Arg::stack(m_value->as<SlotBaseValue>()->slot()),
tmp(m_value));
return;
}
@@ -3712,7 +3710,6 @@
HashMap<Value*, Vector<Tmp>> m_tupleValueToTmps; // This is the same as m_valueToTmp for Values that are Tuples.
HashMap<Value*, Vector<Tmp>> m_tuplePhiToTmps; // This is the same as m_phiToTmp for Phis that are Tuples.
IndexMap<B3::BasicBlock*, Air::BasicBlock*> m_blockToBlock;
- HashMap<B3::StackSlot*, Air::StackSlot*> m_stackToStack;
HashMap<Variable*, Vector<Tmp>> m_variableToTmps;
UseCounts m_useCounts;
Modified: trunk/Source/_javascript_Core/b3/B3Procedure.cpp (278380 => 278381)
--- trunk/Source/_javascript_Core/b3/B3Procedure.cpp 2021-06-02 23:10:10 UTC (rev 278380)
+++ trunk/Source/_javascript_Core/b3/B3Procedure.cpp 2021-06-02 23:28:30 UTC (rev 278381)
@@ -29,6 +29,7 @@
#if ENABLE(B3_JIT)
#include "AirCode.h"
+#include "AirStackSlotKind.h"
#include "B3BackwardsCFG.h"
#include "B3BackwardsDominators.h"
#include "B3BasicBlockUtils.h"
@@ -37,7 +38,6 @@
#include "B3Dominators.h"
#include "B3NaturalLoops.h"
#include "B3ProcedureInlines.h"
-#include "B3StackSlot.h"
#include "B3ValueInlines.h"
#include "B3Variable.h"
#include "JITOpaqueByproducts.h"
@@ -73,9 +73,9 @@
return result;
}
-StackSlot* Procedure::addStackSlot(unsigned byteSize)
+Air::StackSlot* Procedure::addStackSlot(unsigned byteSize)
{
- return m_stackSlots.addNew(byteSize);
+ return m_code->addStackSlot(byteSize, Air::StackSlotKind::Locked);
}
Variable* Procedure::addVariable(Type type)
@@ -253,7 +253,7 @@
}
if (stackSlots().size()) {
out.print(tierName, "Stack slots:\n");
- for (StackSlot* slot : stackSlots())
+ for (Air::StackSlot* slot : stackSlots())
out.print(tierName, " ", pointerDump(slot), ": ", deepDump(slot), "\n");
}
if (m_byproducts->count())
@@ -270,11 +270,6 @@
return B3::blocksInPostOrder(at(0));
}
-void Procedure::deleteStackSlot(StackSlot* stackSlot)
-{
- m_stackSlots.remove(stackSlot);
-}
-
void Procedure::deleteVariable(Variable* variable)
{
m_variables.remove(variable);
Modified: trunk/Source/_javascript_Core/b3/B3Procedure.h (278380 => 278381)
--- trunk/Source/_javascript_Core/b3/B3Procedure.h 2021-06-02 23:10:10 UTC (rev 278380)
+++ trunk/Source/_javascript_Core/b3/B3Procedure.h 2021-06-02 23:28:30 UTC (rev 278381)
@@ -58,11 +58,13 @@
class CFG;
class Dominators;
class NaturalLoops;
-class StackSlot;
class Value;
class Variable;
-namespace Air { class Code; }
+namespace Air {
+class Code;
+class StackSlot;
+} // namespace Air
typedef void WasmBoundsCheckGeneratorFunction(CCallHelpers&, GPRReg);
typedef SharedTask<WasmBoundsCheckGeneratorFunction> WasmBoundsCheckGenerator;
@@ -112,7 +114,7 @@
setBlockOrderImpl(blocks);
}
- JS_EXPORT_PRIVATE StackSlot* addStackSlot(unsigned byteSize);
+ JS_EXPORT_PRIVATE Air::StackSlot* addStackSlot(unsigned byteSize);
JS_EXPORT_PRIVATE Variable* addVariable(Type);
JS_EXPORT_PRIVATE Type addTuple(Vector<Type>&& types);
@@ -163,12 +165,9 @@
Vector<BasicBlock*> blocksInPreOrder();
Vector<BasicBlock*> blocksInPostOrder();
- SparseCollection<StackSlot>& stackSlots() { return m_stackSlots; }
- const SparseCollection<StackSlot>& stackSlots() const { return m_stackSlots; }
+ SparseCollection<Air::StackSlot>& stackSlots();
+ const SparseCollection<Air::StackSlot>& stackSlots() const;
- // Short for stackSlots().remove(). It's better to call this method since it's out of line.
- void deleteStackSlot(StackSlot*);
-
SparseCollection<Variable>& variables() { return m_variables; }
const SparseCollection<Variable>& variables() const { return m_variables; }
@@ -287,7 +286,6 @@
JS_EXPORT_PRIVATE Value* addValueImpl(Value*);
void setBlockOrderImpl(Vector<BasicBlock*>&);
- SparseCollection<StackSlot> m_stackSlots;
SparseCollection<Variable> m_variables;
Vector<Vector<Type>> m_tuples;
Vector<std::unique_ptr<BasicBlock>> m_blocks;
Modified: trunk/Source/_javascript_Core/b3/B3ProcedureInlines.h (278380 => 278381)
--- trunk/Source/_javascript_Core/b3/B3ProcedureInlines.h 2021-06-02 23:10:10 UTC (rev 278380)
+++ trunk/Source/_javascript_Core/b3/B3ProcedureInlines.h 2021-06-02 23:28:30 UTC (rev 278381)
@@ -27,6 +27,7 @@
#if ENABLE(B3_JIT)
+#include "AirCode.h"
#include "B3BasicBlock.h"
#include "B3Procedure.h"
#include "B3Value.h"
@@ -46,6 +47,9 @@
return m_tuples[tuple.tupleIndex()][index];
}
+inline SparseCollection<Air::StackSlot>& Procedure::stackSlots() { return m_code->stackSlots(); }
+inline const SparseCollection<Air::StackSlot>& Procedure::stackSlots() const { return m_code->stackSlots(); }
+
} } // namespace JSC::B3
#endif // ENABLE(B3_JIT)
Modified: trunk/Source/_javascript_Core/b3/B3SlotBaseValue.cpp (278380 => 278381)
--- trunk/Source/_javascript_Core/b3/B3SlotBaseValue.cpp 2021-06-02 23:10:10 UTC (rev 278380)
+++ trunk/Source/_javascript_Core/b3/B3SlotBaseValue.cpp 2021-06-02 23:28:30 UTC (rev 278381)
@@ -28,7 +28,7 @@
#if ENABLE(B3_JIT)
-#include "B3StackSlot.h"
+#include "AirStackSlot.h"
namespace JSC { namespace B3 {
Modified: trunk/Source/_javascript_Core/b3/B3SlotBaseValue.h (278380 => 278381)
--- trunk/Source/_javascript_Core/b3/B3SlotBaseValue.h 2021-06-02 23:10:10 UTC (rev 278380)
+++ trunk/Source/_javascript_Core/b3/B3SlotBaseValue.h 2021-06-02 23:28:30 UTC (rev 278381)
@@ -31,8 +31,13 @@
namespace JSC { namespace B3 {
+namespace Air {
+
class StackSlot;
+} // namespace Air
+
+
class JS_EXPORT_PRIVATE SlotBaseValue final : public Value {
public:
static bool accepts(Kind kind) { return kind == SlotBase; }
@@ -39,7 +44,7 @@
~SlotBaseValue() final;
- StackSlot* slot() const { return m_slot; }
+ Air::StackSlot* slot() const { return m_slot; }
B3_SPECIALIZE_VALUE_FOR_NO_CHILDREN
@@ -49,14 +54,14 @@
void dumpMeta(CommaPrinter&, PrintStream&) const final;
- static Opcode opcodeFromConstructor(Origin, StackSlot*) { return SlotBase; }
- SlotBaseValue(Origin origin, StackSlot* slot)
+ static Opcode opcodeFromConstructor(Origin, Air::StackSlot*) { return SlotBase; }
+ SlotBaseValue(Origin origin, Air::StackSlot* slot)
: Value(CheckedOpcode, SlotBase, pointerType(), Zero, origin)
, m_slot(slot)
{
}
- StackSlot* m_slot;
+ Air::StackSlot* m_slot;
};
} } // namespace JSC::B3
Deleted: trunk/Source/_javascript_Core/b3/B3StackSlot.cpp (278380 => 278381)
--- trunk/Source/_javascript_Core/b3/B3StackSlot.cpp 2021-06-02 23:10:10 UTC (rev 278380)
+++ trunk/Source/_javascript_Core/b3/B3StackSlot.cpp 2021-06-02 23:28:30 UTC (rev 278381)
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 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 "B3StackSlot.h"
-
-#if ENABLE(B3_JIT)
-
-namespace JSC { namespace B3 {
-
-StackSlot::~StackSlot()
-{
-}
-
-void StackSlot::dump(PrintStream& out) const
-{
- out.print("stack", m_index);
-}
-
-void StackSlot::deepDump(PrintStream& out) const
-{
- out.print("byteSize = ", m_byteSize, ", offsetFromFP = ", m_offsetFromFP);
-}
-
-StackSlot::StackSlot(unsigned byteSize)
- : m_byteSize(byteSize)
-{
-}
-
-} } // namespace JSC::B3
-
-#endif // ENABLE(B3_JIT)
-
Deleted: trunk/Source/_javascript_Core/b3/B3StackSlot.h (278380 => 278381)
--- trunk/Source/_javascript_Core/b3/B3StackSlot.h 2021-06-02 23:10:10 UTC (rev 278380)
+++ trunk/Source/_javascript_Core/b3/B3StackSlot.h 2021-06-02 23:28:30 UTC (rev 278381)
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 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.
- */
-
-#pragma once
-
-#if ENABLE(B3_JIT)
-
-#include "B3SparseCollection.h"
-#include <limits.h>
-#include <wtf/FastMalloc.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/PrintStream.h>
-
-namespace JSC { namespace B3 {
-
-class Procedure;
-
-namespace Air {
-class StackSlot;
-} // namespace Air
-
-class StackSlot {
- WTF_MAKE_NONCOPYABLE(StackSlot);
- WTF_MAKE_FAST_ALLOCATED;
-
-public:
- ~StackSlot();
-
- unsigned byteSize() const { return m_byteSize; }
- unsigned index() const { return m_index; }
-
- // This gets assigned at the end of compilation. But, you can totally pin stack slots. Use the
- // set method to do that.
- intptr_t offsetFromFP() const { return m_offsetFromFP; }
-
- // Note that this is meaningless unless the stack slot is Locked.
- void setOffsetFromFP(intptr_t value)
- {
- m_offsetFromFP = value;
- }
-
- void dump(PrintStream&) const;
- void deepDump(PrintStream&) const;
-
-private:
- friend class Air::StackSlot;
- friend class Procedure;
- friend class SparseCollection<StackSlot>;
-
- StackSlot(unsigned byteSize);
-
- unsigned m_index { UINT_MAX };
- unsigned m_byteSize { 0 };
- intptr_t m_offsetFromFP { 0 };
-};
-
-class DeepStackSlotDump {
-public:
- DeepStackSlotDump(const StackSlot* slot)
- : m_slot(slot)
- {
- }
-
- void dump(PrintStream& out) const
- {
- if (m_slot)
- m_slot->deepDump(out);
- else
- out.print("<null>");
- }
-
-private:
- const StackSlot* m_slot;
-};
-
-inline DeepStackSlotDump deepDump(const StackSlot* slot)
-{
- return DeepStackSlotDump(slot);
-}
-
-} } // namespace JSC::B3
-
-#endif // ENABLE(B3_JIT)
Modified: trunk/Source/_javascript_Core/b3/B3Value.cpp (278380 => 278381)
--- trunk/Source/_javascript_Core/b3/B3Value.cpp 2021-06-02 23:10:10 UTC (rev 278380)
+++ trunk/Source/_javascript_Core/b3/B3Value.cpp 2021-06-02 23:28:30 UTC (rev 278381)
@@ -38,7 +38,6 @@
#include "B3OriginDump.h"
#include "B3ProcedureInlines.h"
#include "B3SlotBaseValue.h"
-#include "B3StackSlot.h"
#include "B3ValueInlines.h"
#include "B3ValueKeyInlines.h"
#include "B3WasmBoundsCheckValue.h"
Modified: trunk/Source/_javascript_Core/b3/air/AirCode.cpp (278380 => 278381)
--- trunk/Source/_javascript_Core/b3/air/AirCode.cpp 2021-06-02 23:10:10 UTC (rev 278380)
+++ trunk/Source/_javascript_Core/b3/air/AirCode.cpp 2021-06-02 23:28:30 UTC (rev 278381)
@@ -34,7 +34,6 @@
#include "AllowMacroScratchRegisterUsageIf.h"
#include "B3BasicBlockUtils.h"
#include "B3Procedure.h"
-#include "B3StackSlot.h"
#include "CCallHelpers.h"
#include <wtf/ListDump.h>
#include <wtf/MathExtras.h>
@@ -164,9 +163,9 @@
return result;
}
-StackSlot* Code::addStackSlot(unsigned byteSize, StackSlotKind kind, B3::StackSlot* b3Slot)
+StackSlot* Code::addStackSlot(unsigned byteSize, StackSlotKind kind)
{
- StackSlot* result = m_stackSlots.addNew(byteSize, kind, b3Slot);
+ StackSlot* result = m_stackSlots.addNew(byteSize, kind);
if (m_stackIsAllocated) {
// FIXME: This is unnecessarily awful. Fortunately, it doesn't run often.
unsigned extent = WTF::roundUpToMultipleOf(result->alignment(), frameSize() + byteSize);
@@ -176,11 +175,6 @@
return result;
}
-StackSlot* Code::addStackSlot(B3::StackSlot* b3Slot)
-{
- return addStackSlot(b3Slot->byteSize(), StackSlotKind::Locked, b3Slot);
-}
-
Special* Code::addSpecial(std::unique_ptr<Special> special)
{
special->m_code = this;
Modified: trunk/Source/_javascript_Core/b3/air/AirCode.h (278380 => 278381)
--- trunk/Source/_javascript_Core/b3/air/AirCode.h 2021-06-02 23:10:10 UTC (rev 278380)
+++ trunk/Source/_javascript_Core/b3/air/AirCode.h 2021-06-02 23:28:30 UTC (rev 278381)
@@ -112,9 +112,7 @@
// Note that you can rely on stack slots always getting indices that are larger than the index
// of any prior stack slot. In fact, all stack slots you create in the future will have an index
// that is >= stackSlots().size().
- JS_EXPORT_PRIVATE StackSlot* addStackSlot(
- unsigned byteSize, StackSlotKind, B3::StackSlot* = nullptr);
- StackSlot* addStackSlot(B3::StackSlot*);
+ JS_EXPORT_PRIVATE StackSlot* addStackSlot(unsigned byteSize, StackSlotKind);
JS_EXPORT_PRIVATE Special* addSpecial(std::unique_ptr<Special>);
Modified: trunk/Source/_javascript_Core/b3/air/AirStackSlot.cpp (278380 => 278381)
--- trunk/Source/_javascript_Core/b3/air/AirStackSlot.cpp 2021-06-02 23:10:10 UTC (rev 278380)
+++ trunk/Source/_javascript_Core/b3/air/AirStackSlot.cpp 2021-06-02 23:28:30 UTC (rev 278381)
@@ -28,15 +28,11 @@
#if ENABLE(B3_JIT)
-#include "B3StackSlot.h"
-
namespace JSC { namespace B3 { namespace Air {
void StackSlot::setOffsetFromFP(intptr_t value)
{
m_offsetFromFP = value;
- if (m_b3Slot)
- m_b3Slot->m_offsetFromFP = value;
}
unsigned StackSlot::jsHash() const
@@ -56,17 +52,15 @@
void StackSlot::deepDump(PrintStream& out) const
{
out.print("byteSize = ", m_byteSize, ", offsetFromFP = ", m_offsetFromFP, ", kind = ", m_kind);
- if (m_b3Slot)
- out.print(", b3Slot = ", *m_b3Slot, ": (", B3::deepDump(m_b3Slot), ")");
}
-StackSlot::StackSlot(unsigned byteSize, StackSlotKind kind, B3::StackSlot* b3Slot)
- : m_byteSize(byteSize)
- , m_offsetFromFP(b3Slot ? b3Slot->offsetFromFP() : 0)
+StackSlot::StackSlot(unsigned byteSize, StackSlotKind kind, intptr_t offsetFromFP)
+ : m_byteSize(static_cast<uint16_t>(byteSize))
, m_kind(kind)
- , m_b3Slot(b3Slot)
+ , m_offsetFromFP(offsetFromFP)
{
ASSERT(byteSize);
+ RELEASE_ASSERT(byteSize <= std::numeric_limits<uint16_t>::max());
}
} } } // namespace JSC::B3::Air
Modified: trunk/Source/_javascript_Core/b3/air/AirStackSlot.h (278380 => 278381)
--- trunk/Source/_javascript_Core/b3/air/AirStackSlot.h 2021-06-02 23:10:10 UTC (rev 278380)
+++ trunk/Source/_javascript_Core/b3/air/AirStackSlot.h 2021-06-02 23:28:30 UTC (rev 278381)
@@ -53,7 +53,8 @@
void ensureSize(unsigned requestedSize)
{
ASSERT(!m_offsetFromFP);
- m_byteSize = std::max(m_byteSize, requestedSize);
+ RELEASE_ASSERT(requestedSize <= std::numeric_limits<uint16_t>::max());
+ m_byteSize = std::max(m_byteSize, static_cast<uint16_t>(requestedSize));
}
unsigned alignment() const
@@ -67,8 +68,6 @@
return 8;
}
- B3::StackSlot* b3Slot() const { return m_b3Slot; }
-
// Zero means that it's not yet assigned.
intptr_t offsetFromFP() const { return m_offsetFromFP; }
@@ -86,13 +85,12 @@
friend class Code;
friend class SparseCollection<StackSlot>;
- StackSlot(unsigned byteSize, StackSlotKind, B3::StackSlot*);
+ StackSlot(unsigned byteSize, StackSlotKind, intptr_t offsetFromFP = 0);
- unsigned m_byteSize { 0 };
+ uint16_t m_byteSize { 0 };
+ StackSlotKind m_kind { StackSlotKind::Locked };
unsigned m_index { UINT_MAX };
intptr_t m_offsetFromFP { 0 };
- StackSlotKind m_kind { StackSlotKind::Locked };
- B3::StackSlot* m_b3Slot { nullptr };
};
class DeepStackSlotDump {
Modified: trunk/Source/_javascript_Core/b3/testb3.h (278380 => 278381)
--- trunk/Source/_javascript_Core/b3/testb3.h 2021-06-02 23:10:10 UTC (rev 278380)
+++ trunk/Source/_javascript_Core/b3/testb3.h 2021-06-02 23:28:30 UTC (rev 278381)
@@ -27,6 +27,7 @@
#include "AirCode.h"
#include "AirInstInlines.h"
+#include "AirStackSlot.h"
#include "AirValidate.h"
#include "AllowMacroScratchRegisterUsage.h"
#include "B3ArgumentRegValue.h"
@@ -52,7 +53,6 @@
#include "B3ReduceLoopStrength.h"
#include "B3ReduceStrength.h"
#include "B3SlotBaseValue.h"
-#include "B3StackSlot.h"
#include "B3StackmapGenerationParams.h"
#include "B3SwitchValue.h"
#include "B3UpsilonValue.h"
Modified: trunk/Source/_javascript_Core/ftl/FTLCompile.cpp (278380 => 278381)
--- trunk/Source/_javascript_Core/ftl/FTLCompile.cpp 2021-06-02 23:10:10 UTC (rev 278380)
+++ trunk/Source/_javascript_Core/ftl/FTLCompile.cpp 2021-06-02 23:28:30 UTC (rev 278381)
@@ -30,8 +30,8 @@
#include "AirCode.h"
#include "AirDisassembler.h"
+#include "AirStackSlot.h"
#include "B3Generate.h"
-#include "B3StackSlot.h"
#include "B3Value.h"
#include "B3ValueInlines.h"
#include "CodeBlockWithJITType.h"
Modified: trunk/Source/_javascript_Core/ftl/FTLState.h (278380 => 278381)
--- trunk/Source/_javascript_Core/ftl/FTLState.h 2021-06-02 23:10:10 UTC (rev 278380)
+++ trunk/Source/_javascript_Core/ftl/FTLState.h 2021-06-02 23:28:30 UTC (rev 278381)
@@ -41,7 +41,9 @@
namespace B3 {
class PatchpointValue;
+namespace Air {
class StackSlot;
+} // namespace Air
} // namespace B3
namespace FTL {
@@ -79,7 +81,7 @@
// are no applicable catch blocks anywhere in the Graph.
RefPtr<PatchpointExceptionHandle> defaultExceptionHandle;
Box<CCallHelpers::Label> exceptionHandler { Box<CCallHelpers::Label>::create() };
- B3::StackSlot* capturedValue { nullptr };
+ B3::Air::StackSlot* capturedValue { nullptr };
};
} } // namespace JSC::FTL