summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/jit/JITStubRoutine.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/jit/JITStubRoutine.h')
-rw-r--r--Source/JavaScriptCore/jit/JITStubRoutine.h48
1 files changed, 13 insertions, 35 deletions
diff --git a/Source/JavaScriptCore/jit/JITStubRoutine.h b/Source/JavaScriptCore/jit/JITStubRoutine.h
index 020ef6907..2bf37fab4 100644
--- a/Source/JavaScriptCore/jit/JITStubRoutine.h
+++ b/Source/JavaScriptCore/jit/JITStubRoutine.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,17 +23,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef JITStubRoutine_h
-#define JITStubRoutine_h
-
-#include <wtf/Platform.h>
+#pragma once
#if ENABLE(JIT)
#include "ExecutableAllocator.h"
#include "MacroAssemblerCodeRef.h"
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
namespace JSC {
@@ -61,24 +56,22 @@ public:
// Use this if you want to pass a CodePtr to someone who insists on taking
// a RefPtr<JITStubRoutine>.
- static PassRefPtr<JITStubRoutine> createSelfManagedRoutine(
+ static Ref<JITStubRoutine> createSelfManagedRoutine(
MacroAssemblerCodePtr rawCodePointer)
{
- return adoptRef(new JITStubRoutine(MacroAssemblerCodeRef::createSelfManagedCodeRef(rawCodePointer)));
+ return adoptRef(*new JITStubRoutine(MacroAssemblerCodeRef::createSelfManagedCodeRef(rawCodePointer)));
}
virtual ~JITStubRoutine();
+ virtual void aboutToDie() { }
// MacroAssemblerCodeRef is copyable, but at the cost of reference
// counting churn. Returning a reference is a good way of reducing
// the churn.
const MacroAssemblerCodeRef& code() const { return m_code; }
- static MacroAssemblerCodePtr asCodePtr(PassRefPtr<JITStubRoutine> stubRoutine)
+ static MacroAssemblerCodePtr asCodePtr(Ref<JITStubRoutine>&& stubRoutine)
{
- if (!stubRoutine)
- return MacroAssemblerCodePtr();
-
MacroAssemblerCodePtr result = stubRoutine->code().code();
ASSERT(!!result);
return result;
@@ -104,29 +97,15 @@ public:
static bool canPerformRangeFilter()
{
-#if ENABLE(EXECUTABLE_ALLOCATOR_FIXED)
return true;
-#else
- return false;
-#endif
}
static uintptr_t filteringStartAddress()
{
-#if ENABLE(EXECUTABLE_ALLOCATOR_FIXED)
return startOfFixedExecutableMemoryPool;
-#else
- UNREACHABLE_FOR_PLATFORM();
- return 0;
-#endif
}
static size_t filteringExtentSize()
{
-#if ENABLE(EXECUTABLE_ALLOCATOR_FIXED)
return fixedExecutableMemoryPoolSize;
-#else
- UNREACHABLE_FOR_PLATFORM();
- return 0;
-#endif
}
static bool passesFilter(uintptr_t address)
{
@@ -141,6 +120,11 @@ public:
return true;
}
+
+ // Return true if you are still valid after. Return false if you are now invalid. If you return
+ // false, you will usually not do any clearing because the idea is that you will simply be
+ // destroyed.
+ virtual bool visitWeak(VM&);
protected:
virtual void observeZeroRefCount();
@@ -150,15 +134,9 @@ protected:
};
// Helper for the creation of simple stub routines that need no help from the GC.
-#define FINALIZE_CODE_FOR_STUB(patchBuffer, dataLogFArguments) \
- (adoptRef(new JITStubRoutine(FINALIZE_CODE((patchBuffer), dataLogFArguments))))
-
-#define FINALIZE_CODE_FOR_DFG_STUB(patchBuffer, dataLogFArguments) \
- (adoptRef(new JITStubRoutine(FINALIZE_DFG_CODE((patchBuffer), dataLogFArguments))))
+#define FINALIZE_CODE_FOR_STUB(codeBlock, patchBuffer, dataLogFArguments) \
+ (adoptRef(new JITStubRoutine(FINALIZE_CODE_FOR((codeBlock), (patchBuffer), dataLogFArguments))))
} // namespace JSC
#endif // ENABLE(JIT)
-
-#endif // JITStubRoutine_h
-