summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/interpreter/JSStack.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2015-05-20 09:56:07 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2015-05-20 09:56:07 +0000
commit41386e9cb918eed93b3f13648cbef387e371e451 (patch)
treea97f9d7bd1d9d091833286085f72da9d83fd0606 /Source/JavaScriptCore/interpreter/JSStack.h
parente15dd966d523731101f70ccf768bba12435a0208 (diff)
downloadWebKitGtk-tarball-41386e9cb918eed93b3f13648cbef387e371e451.tar.gz
webkitgtk-2.4.9webkitgtk-2.4.9
Diffstat (limited to 'Source/JavaScriptCore/interpreter/JSStack.h')
-rw-r--r--Source/JavaScriptCore/interpreter/JSStack.h103
1 files changed, 57 insertions, 46 deletions
diff --git a/Source/JavaScriptCore/interpreter/JSStack.h b/Source/JavaScriptCore/interpreter/JSStack.h
index 07cbbe69b..adf825d98 100644
--- a/Source/JavaScriptCore/interpreter/JSStack.h
+++ b/Source/JavaScriptCore/interpreter/JSStack.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008, 2009, 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,7 +10,7 @@
* 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.
- * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
@@ -35,6 +35,11 @@
#include <wtf/PageReservation.h>
#include <wtf/VMTags.h>
+#define ENABLE_DEBUG_JSSTACK 0
+#if !defined(NDEBUG) && !defined(ENABLE_DEBUG_JSSTACK)
+#define ENABLE_DEBUG_JSSTACK 1
+#endif
+
namespace JSC {
class CodeBlockSet;
@@ -56,8 +61,8 @@ namespace JSC {
WTF_MAKE_NONCOPYABLE(JSStack);
public:
enum CallFrameHeaderEntry {
- CallerFrameAndPCSize = sizeof(CallerFrameAndPC) / sizeof(Register),
- CodeBlock = CallerFrameAndPCSize,
+ CodeBlock = sizeof(CallerFrameAndPC) / sizeof(Register),
+ ScopeChain,
Callee,
ArgumentCount,
CallFrameHeaderSize,
@@ -67,84 +72,90 @@ namespace JSC {
FirstArgument,
};
+ static const size_t defaultCapacity = 512 * 1024;
static const size_t commitSize = 16 * 1024;
// Allow 8k of excess registers before we start trying to reap the stack
static const ptrdiff_t maxExcessCapacity = 8 * 1024;
- JSStack(VM&);
-
- bool ensureCapacityFor(Register* newTopOfStack);
-
- bool containsAddress(Register* address) { return (lowAddress() <= address && address < highAddress()); }
- static size_t committedByteCount();
-
-#if ENABLE(JIT)
- void gatherConservativeRoots(ConservativeRoots&) { }
- void gatherConservativeRoots(ConservativeRoots&, JITStubRoutineSet&, CodeBlockSet&) { }
- void sanitizeStack() { }
-#else
+ JSStack(VM&, size_t capacity = defaultCapacity);
~JSStack();
-
+
void gatherConservativeRoots(ConservativeRoots&);
void gatherConservativeRoots(ConservativeRoots&, JITStubRoutineSet&, CodeBlockSet&);
- void sanitizeStack();
- Register* baseOfStack() const
+ Register* getBaseOfStack() const
{
return highAddress() - 1;
}
size_t size() const { return highAddress() - lowAddress(); }
- void setReservedZoneSize(size_t);
+ bool grow(Register*);
+
+ static size_t committedByteCount();
+ static void initializeThreading();
+
+ Register* getTopOfFrame(CallFrame*);
+ Register* getStartOfFrame(CallFrame*);
+ Register* getTopOfStack();
- inline Register* topOfStack();
-#endif // ENABLE(JIT)
+ bool entryCheck(class CodeBlock*, int);
- private:
+ CallFrame* pushFrame(class CodeBlock*, JSScope*, int argsCount, JSObject* callee);
-#if !ENABLE(JIT)
+ void popFrame(CallFrame*);
+
+ bool containsAddress(Register* address) { return (lowAddress() <= address && address <= highAddress()); }
+
+ void enableErrorStackReserve();
+ void disableErrorStackReserve();
+
+#if ENABLE(DEBUG_JSSTACK)
+ void installFence(CallFrame*, const char *function = "", int lineNo = 0);
+ void validateFence(CallFrame*, const char *function = "", int lineNo = 0);
+ static const int FenceSize = 4;
+#else // !ENABLE(DEBUG_JSSTACK)
+ void installFence(CallFrame*, const char* = "", int = 0) { }
+ void validateFence(CallFrame*, const char* = "", int = 0) { }
+#endif // !ENABLE(DEBUG_JSSTACK)
+
+ private:
Register* lowAddress() const
{
- return m_end + 1;
+ return m_end;
}
Register* highAddress() const
{
return reinterpret_cast_ptr<Register*>(static_cast<char*>(m_reservation.base()) + m_reservation.size());
}
-#else
- Register* lowAddress() const;
- Register* highAddress() const;
-#endif // !ENABLE(JIT)
-#if !ENABLE(JIT)
- inline Register* topOfFrameFor(CallFrame*);
-
- Register* reservationTop() const
+ Register* reservationEnd() const
{
- char* reservationTop = static_cast<char*>(m_reservation.base());
- return reinterpret_cast_ptr<Register*>(reservationTop);
+ char* reservationEnd = static_cast<char*>(m_reservation.base());
+ return reinterpret_cast_ptr<Register*>(reservationEnd);
}
- bool grow(Register* newTopOfStack);
- bool growSlowCase(Register* newTopOfStack);
- void shrink(Register* newTopOfStack);
+#if ENABLE(DEBUG_JSSTACK)
+ static JSValue generateFenceValue(size_t argIndex);
+ void installTrapsAfterFrame(CallFrame*);
+#else
+ void installTrapsAfterFrame(CallFrame*) { }
+#endif
+
+ bool growSlowCase(Register*);
+ void shrink(Register*);
void releaseExcessCapacity();
void addToCommittedByteCount(long);
- void setStackLimit(Register* newTopOfStack);
-#endif // !ENABLE(JIT)
+ void updateStackLimit(Register* newEnd);
VM& m_vm;
- CallFrame*& m_topCallFrame;
-#if !ENABLE(JIT)
Register* m_end;
- Register* m_commitTop;
+ Register* m_commitEnd;
+ Register* m_useableEnd;
PageReservation m_reservation;
- Register* m_lastStackTop;
- ptrdiff_t m_reservedZoneSizeInRegisters;
-#endif // !ENABLE(JIT)
+ CallFrame*& m_topCallFrame;
friend class LLIntOffsetsExtractor;
};