Diff
Modified: branches/jsCStack/Source/_javascript_Core/ChangeLog (160981 => 160982)
--- branches/jsCStack/Source/_javascript_Core/ChangeLog 2013-12-22 22:26:23 UTC (rev 160981)
+++ branches/jsCStack/Source/_javascript_Core/ChangeLog 2013-12-23 00:02:40 UTC (rev 160982)
@@ -1,5 +1,26 @@
2013-12-22 Mark Lam <[email protected]>
+ CStack: Add #if ENABLE(LLINT_C_LOOP) to C loop LLINT only parts of JSStack.
+ https://bugs.webkit.org/show_bug.cgi?id=126140.
+
+ Not yet reviewed.
+
+ Also moved startOfFrameFor() to the ENABLE(DEBUG_JSSTACK) section because
+ it's only needed there.
+
+ * interpreter/JSStack.cpp:
+ (JSC::JSStack::JSStack):
+ (JSC::JSStack::gatherConservativeRoots):
+ (JSC::JSStack::sanitizeStack):
+ * interpreter/JSStack.h:
+ (JSC::JSStack::gatherConservativeRoots):
+ (JSC::JSStack::sanitizeStack):
+ (JSC::JSStack::initializeThreading):
+ * interpreter/JSStackInlines.h:
+ (JSC::JSStack::topOfFrameFor):
+
+2013-12-22 Mark Lam <[email protected]>
+
CStack: Fixed some JSStack on C Stack boundary computations.
https://bugs.webkit.org/show_bug.cgi?id=126139.
Modified: branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.cpp (160981 => 160982)
--- branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.cpp 2013-12-22 22:26:23 UTC (rev 160981)
+++ branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.cpp 2013-12-23 00:02:40 UTC (rev 160982)
@@ -35,6 +35,7 @@
namespace JSC {
+#if ENABLE(LLINT_C_LOOP)
static size_t committedBytesCount = 0;
static Mutex& stackStatisticsMutex()
@@ -42,12 +43,17 @@
DEFINE_STATIC_LOCAL(Mutex, staticMutex, ());
return staticMutex;
}
+#endif // ENABLE(LLINT_C_LOOP)
-JSStack::JSStack(VM& vm, size_t capacity)
+JSStack::JSStack(VM& vm)
: m_vm(vm)
- , m_end(0)
, m_topCallFrame(vm.topCallFrame)
+#if ENABLE(LLINT_C_LOOP)
+ , m_end(0)
+#endif
{
+#if ENABLE(LLINT_C_LOOP)
+ size_t capacity = defaultCapacity;
ASSERT(capacity && isPageAligned(capacity));
m_reservation = PageReservation::reserve(roundUpAllocationSize(capacity * sizeof(Register), commitSize), OSAllocator::JSVMStackPages);
@@ -57,10 +63,12 @@
m_lastStackTop = baseOfStack();
disableErrorStackReserve();
+#endif // ENABLE(LLINT_C_LOOP)
m_topCallFrame = 0;
}
+#if ENABLE(LLINT_C_LOOP)
JSStack::~JSStack()
{
void* highAddress = reinterpret_cast<void*>(static_cast<char*>(m_reservation.base()) + m_reservation.size());
@@ -96,27 +104,16 @@
void JSStack::gatherConservativeRoots(ConservativeRoots& conservativeRoots)
{
-#if ENABLE(LLINT_CLOOP)
conservativeRoots.add(baseOfStack(), topOfStack());
-#else
- UNUSED_PARAM(conservativeRoots);
-#endif
}
void JSStack::gatherConservativeRoots(ConservativeRoots& conservativeRoots, JITStubRoutineSet& jitStubRoutines, CodeBlockSet& codeBlocks)
{
-#if ENABLE(LLINT_CLOOP)
conservativeRoots.add(baseOfStack(), topOfStack(), jitStubRoutines, codeBlocks);
-#else
- UNUSED_PARAM(conservativeRoots);
- UNUSED_PARAM(jitStubRoutines);
- UNUSED_PARAM(codeBlocks);
-#endif
}
void JSStack::sanitizeStack()
{
-#if ENABLE(LLINT_CLOOP)
ASSERT(topOfStack() <= baseOfStack());
if (m_lastStackTop < topOfStack()) {
@@ -126,7 +123,6 @@
}
m_lastStackTop = topOfStack();
-#endif
}
void JSStack::releaseExcessCapacity()
@@ -169,6 +165,7 @@
shrink(m_useableEnd);
}
}
+#endif // ENABLE(LLINT_C_LOOP)
#if !ENABLE(LLINT_C_LOOP)
Register* JSStack::lowAddress() const
Modified: branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.h (160981 => 160982)
--- branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.h 2013-12-22 22:26:23 UTC (rev 160981)
+++ branches/jsCStack/Source/_javascript_Core/interpreter/JSStack.h 2013-12-23 00:02:40 UTC (rev 160982)
@@ -35,10 +35,12 @@
#include <wtf/PageReservation.h>
#include <wtf/VMTags.h>
+#if ENABLE(LLINT_C_LOOP)
#define ENABLE_DEBUG_JSSTACK 0
#if !defined(NDEBUG) && !defined(ENABLE_DEBUG_JSSTACK)
#define ENABLE_DEBUG_JSSTACK 1
#endif
+#endif // ENABLE(LLINT_C_LOOP)
namespace JSC {
@@ -78,8 +80,7 @@
// Allow 8k of excess registers before we start trying to reap the stack
static const ptrdiff_t maxExcessCapacity = 8 * 1024;
- JSStack(VM&, size_t capacity = defaultCapacity);
- ~JSStack();
+ JSStack(VM&);
bool ensureCapacityFor(Register* newTopOfStack);
@@ -88,6 +89,14 @@
bool containsAddress(Register* address) { return (lowAddress() <= address && address < highAddress()); }
static size_t committedByteCount();
+#if !ENABLE(LLINT_C_LOOP)
+ void gatherConservativeRoots(ConservativeRoots&) { }
+ void gatherConservativeRoots(ConservativeRoots&, JITStubRoutineSet&, CodeBlockSet&) { }
+ void sanitizeStack() { }
+ static void initializeThreading() { }
+#else
+ ~JSStack();
+
void gatherConservativeRoots(ConservativeRoots&);
void gatherConservativeRoots(ConservativeRoots&, JITStubRoutineSet&, CodeBlockSet&);
void sanitizeStack();
@@ -101,8 +110,6 @@
static void initializeThreading();
- Register* startOfFrameFor(CallFrame*);
-
CallFrame* pushFrame(class CodeBlock*, JSScope*, int argsCount, JSObject* callee);
void popFrame(CallFrame*);
@@ -115,6 +122,7 @@
void installFence(CallFrame*, const char* = "", int = 0) { }
void validateFence(CallFrame*, const char* = "", int = 0) { }
#endif // !ENABLE(DEBUG_JSSTACK)
+#endif // ENABLE(LLINT_C_LOOP)
private:
@@ -137,6 +145,7 @@
Register* highAddress() const;
#endif // ENABLE(LLINT_C_LOOP)
+#if ENABLE(LLINT_C_LOOP)
Register* reservationEnd() const
{
char* reservationEnd = static_cast<char*>(m_reservation.base());
@@ -146,6 +155,7 @@
#if ENABLE(DEBUG_JSSTACK)
static JSValue generateFenceValue(size_t argIndex);
void installTrapsAfterFrame(CallFrame*);
+ Register* startOfFrameFor(CallFrame*);
#else
void installTrapsAfterFrame(CallFrame*) { }
#endif
@@ -157,17 +167,20 @@
void addToCommittedByteCount(long);
void setStackLimit(Register* newEnd);
+#endif // ENABLE(LLINT_C_LOOP)
void enableErrorStackReserve();
void disableErrorStackReserve();
VM& m_vm;
+ CallFrame*& m_topCallFrame;
+#if ENABLE(LLINT_C_LOOP)
Register* m_end;
Register* m_commitEnd;
Register* m_useableEnd;
PageReservation m_reservation;
- CallFrame*& m_topCallFrame;
Register* m_lastStackTop;
+#endif // ENABLE(LLINT_C_LOOP)
friend class LLIntOffsetsExtractor;
};
Modified: branches/jsCStack/Source/_javascript_Core/interpreter/JSStackInlines.h (160981 => 160982)
--- branches/jsCStack/Source/_javascript_Core/interpreter/JSStackInlines.h 2013-12-22 22:26:23 UTC (rev 160981)
+++ branches/jsCStack/Source/_javascript_Core/interpreter/JSStackInlines.h 2013-12-23 00:02:40 UTC (rev 160982)
@@ -65,8 +65,10 @@
inline Register* JSStack::topOfFrameFor(CallFrame* frame)
{
+#if ENABLE(LLINT_C_LOOP)
if (UNLIKELY(!frame))
return baseOfStack();
+#endif
return frame->topOfFrame() - 1;
}
@@ -75,11 +77,15 @@
return topOfFrameFor(m_topCallFrame);
}
+#if ENABLE(LLINT_C_LOOP)
+
+#if ENABLE(DEBUG_JSSTACK)
inline Register* JSStack::startOfFrameFor(CallFrame* frame)
{
CallFrame* callerFrame = frame->callerFrameSkippingVMEntrySentinel();
return topOfFrameFor(callerFrame);
}
+#endif // ENABLE(DEBUG_JSSTACK)
inline CallFrame* JSStack::pushFrame(class CodeBlock* codeBlock, JSScope* scope, int argsCount, JSObject* callee)
{
@@ -291,6 +297,7 @@
*p-- = 0xabadcafe; // A bad word to trigger a crash if deref'ed.
}
#endif // ENABLE(DEBUG_JSSTACK)
+#endif // ENABLE(LLINT_C_LOOP)
} // namespace JSC