X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/6fe7ccc865dc7d7541b93c5bcaf6368d2c98a174..4be4e30906bcb8ee30b4d189205cb70bad6707ce:/jit/JITCode.h?ds=inline diff --git a/jit/JITCode.h b/jit/JITCode.h index 3ae5ff2..b7521fb 100644 --- a/jit/JITCode.h +++ b/jit/JITCode.h @@ -1,5 +1,5 @@ /* - * 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 @@ -26,22 +26,24 @@ #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 @@ -76,7 +78,7 @@ namespace JSC { return jitType == InterpreterThunk || jitType == BaselineJIT; } -#if ENABLE(JIT) +#if ENABLE(JIT) || ENABLE(LLINT) JITCode() : m_jitType(None) { @@ -105,9 +107,14 @@ namespace JSC { return reinterpret_cast(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(m_ref.code().dataLocation()) + offset; } @@ -121,12 +128,14 @@ namespace JSC { return static_cast(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 { @@ -138,13 +147,18 @@ namespace JSC { 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; } @@ -171,9 +185,16 @@ namespace JSC { 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