/*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#ifndef JITCode_h
#define JITCode_h
-#if ENABLE(JIT)
+#if ENABLE(JIT) || ENABLE(LLINT)
#include "CallFrame.h"
-#include "JSValue.h"
+#include "Disassembler.h"
+#include "JITStubs.h"
+#include "JSCJSValue.h"
+#include "LegacyProfiler.h"
#include "MacroAssemblerCodeRef.h"
-#include "Profiler.h"
#endif
namespace JSC {
#if ENABLE(JIT)
- class JSGlobalData;
- class RegisterFile;
+ class VM;
+ class JSStack;
#endif
class JITCode {
-#if ENABLE(JIT)
+#if ENABLE(JIT) || ENABLE(LLINT)
typedef MacroAssemblerCodeRef CodeRef;
typedef MacroAssemblerCodePtr CodePtr;
#else
return jitType == InterpreterThunk || jitType == BaselineJIT;
}
-#if ENABLE(JIT)
+#if ENABLE(JIT) || ENABLE(LLINT)
JITCode()
: m_jitType(None)
{
return reinterpret_cast<char*>(m_ref.code().executableAddress()) + offset;
}
+ void* executableAddress() const
+ {
+ return executableAddressAtOffset(0);
+ }
+
void* dataAddressAtOffset(size_t offset) const
{
- ASSERT(offset < size());
+ ASSERT(offset <= size()); // use <= instead of < because it is valid to ask for an address at the exclusive end of the code.
return reinterpret_cast<char*>(m_ref.code().dataLocation()) + offset;
}
return static_cast<unsigned>(result);
}
+#if ENABLE(JIT)
// Execute the code!
- inline JSValue execute(RegisterFile* registerFile, CallFrame* callFrame, JSGlobalData* globalData)
+ inline JSValue execute(JSStack* stack, CallFrame* callFrame, VM* vm)
{
- JSValue result = JSValue::decode(ctiTrampoline(m_ref.code().executableAddress(), registerFile, callFrame, 0, Profiler::enabledProfilerReference(), globalData));
- return globalData->exception ? jsNull() : result;
+ JSValue result = JSValue::decode(ctiTrampoline(m_ref.code().executableAddress(), stack, callFrame, 0, 0, vm));
+ return vm->exception ? jsNull() : result;
}
+#endif
void* start() const
{
ASSERT(m_ref.code().executableAddress());
return m_ref.size();
}
+
+ bool tryToDisassemble(const char* prefix) const
+ {
+ return m_ref.tryToDisassemble(prefix);
+ }
ExecutableMemoryHandle* getExecutableMemory()
{
return m_ref.executableMemory();
}
- JITType jitType()
+ JITType jitType() const
{
return m_jitType;
}
CodeRef m_ref;
JITType m_jitType;
-#endif // ENABLE(JIT)
+#endif // ENABLE(JIT) || ENABLE(LLINT)
};
-};
+} // namespace JSC
+
+namespace WTF {
+
+class PrintStream;
+void printInternal(PrintStream&, JSC::JITCode::JITType);
+
+} // namespace WTF
#endif