summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/jit/GCAwareJITStubRoutine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/jit/GCAwareJITStubRoutine.cpp')
-rw-r--r--Source/JavaScriptCore/jit/GCAwareJITStubRoutine.cpp61
1 files changed, 47 insertions, 14 deletions
diff --git a/Source/JavaScriptCore/jit/GCAwareJITStubRoutine.cpp b/Source/JavaScriptCore/jit/GCAwareJITStubRoutine.cpp
index f681dd847..60c0c5514 100644
--- a/Source/JavaScriptCore/jit/GCAwareJITStubRoutine.cpp
+++ b/Source/JavaScriptCore/jit/GCAwareJITStubRoutine.cpp
@@ -28,24 +28,25 @@
#if ENABLE(JIT)
+#include "CodeBlock.h"
+#include "DFGCommonData.h"
#include "Heap.h"
#include "VM.h"
-#include "Operations.h"
+#include "JSCInlines.h"
#include "SlotVisitor.h"
#include "Structure.h"
namespace JSC {
GCAwareJITStubRoutine::GCAwareJITStubRoutine(
- const MacroAssemblerCodeRef& code, VM& vm, bool isClosureCall)
+ const MacroAssemblerCodeRef& code, VM& vm)
: JITStubRoutine(code)
, m_mayBeExecuting(false)
, m_isJettisoned(false)
- , m_isClosureCall(isClosureCall)
{
vm.heap.m_jitStubRoutines.add(this);
}
-
+
GCAwareJITStubRoutine::~GCAwareJITStubRoutine() { }
void GCAwareJITStubRoutine::observeZeroRefCount()
@@ -95,29 +96,61 @@ void MarkingGCAwareJITStubRoutineWithOneObject::markRequiredObjectsInternal(Slot
visitor.append(&m_object);
}
-PassRefPtr<JITStubRoutine> createJITStubRoutine(
- const MacroAssemblerCodeRef& code,
- VM& vm,
- const JSCell*,
- bool makesCalls)
+
+GCAwareJITStubRoutineWithExceptionHandler::GCAwareJITStubRoutineWithExceptionHandler(
+ const MacroAssemblerCodeRef& code, VM& vm,
+ CodeBlock* codeBlockForExceptionHandlers, CallSiteIndex exceptionHandlerCallSiteIndex)
+ : GCAwareJITStubRoutine(code, vm)
+ , m_codeBlockWithExceptionHandler(codeBlockForExceptionHandlers)
+ , m_exceptionHandlerCallSiteIndex(exceptionHandlerCallSiteIndex)
{
- if (!makesCalls)
- return adoptRef(new JITStubRoutine(code));
+ RELEASE_ASSERT(m_codeBlockWithExceptionHandler);
+ ASSERT(!!m_codeBlockWithExceptionHandler->handlerForIndex(exceptionHandlerCallSiteIndex.bits()));
+}
- return static_pointer_cast<JITStubRoutine>(
- adoptRef(new GCAwareJITStubRoutine(code, vm)));
+void GCAwareJITStubRoutineWithExceptionHandler::aboutToDie()
+{
+ m_codeBlockWithExceptionHandler = nullptr;
}
+void GCAwareJITStubRoutineWithExceptionHandler::observeZeroRefCount()
+{
+#if ENABLE(DFG_JIT)
+ if (m_codeBlockWithExceptionHandler) {
+ m_codeBlockWithExceptionHandler->jitCode()->dfgCommon()->removeCallSiteIndex(m_exceptionHandlerCallSiteIndex);
+ m_codeBlockWithExceptionHandler->removeExceptionHandlerForCallSite(m_exceptionHandlerCallSiteIndex);
+ m_codeBlockWithExceptionHandler = nullptr;
+ }
+#endif
+
+ Base::observeZeroRefCount();
+}
+
+
PassRefPtr<JITStubRoutine> createJITStubRoutine(
const MacroAssemblerCodeRef& code,
VM& vm,
const JSCell* owner,
bool makesCalls,
- JSCell* object)
+ JSCell* object,
+ CodeBlock* codeBlockForExceptionHandlers,
+ CallSiteIndex exceptionHandlerCallSiteIndex)
{
if (!makesCalls)
return adoptRef(new JITStubRoutine(code));
+ if (codeBlockForExceptionHandlers) {
+ RELEASE_ASSERT(!object); // We're not a marking stub routine.
+ RELEASE_ASSERT(JITCode::isOptimizingJIT(codeBlockForExceptionHandlers->jitType()));
+ return static_pointer_cast<JITStubRoutine>(
+ adoptRef(new GCAwareJITStubRoutineWithExceptionHandler(code, vm, codeBlockForExceptionHandlers, exceptionHandlerCallSiteIndex)));
+ }
+
+ if (!object) {
+ return static_pointer_cast<JITStubRoutine>(
+ adoptRef(new GCAwareJITStubRoutine(code, vm)));
+ }
+
return static_pointer_cast<JITStubRoutine>(
adoptRef(new MarkingGCAwareJITStubRoutineWithOneObject(code, vm, owner, object)));
}