Render unto #ifdef's that which belong to them.

https://bugs.webkit.org/show_bug.cgi?id=95482.

Patch by Mark Lam <mark.lam@apple.com> on 2012-08-30
Reviewed by Filip Pizlo.

Source/JavaScriptCore:

Refining / disambiguating between #ifdefs and adding some. For
example, ENABLE(JIT) is conflated with ENABLE(LLINT) in some places.
Also, we need to add ENABLE(COMPUTED_GOTO_OPCODES) to indicate that we
want interpreted opcodes to use COMPUTED GOTOs apart from ENABLE(LLINT)
and ENABLE(COMPUTED_GOTO_CLASSIC_INTERPRETER). Also cleaned up #ifdefs
in certain places which were previously incorrect.

* bytecode/CodeBlock.cpp:
(JSC):
(JSC::CodeBlock::bytecodeOffset):
* bytecode/CodeBlock.h:
(CodeBlock):
* bytecode/Opcode.h:
(JSC::padOpcodeName):
* config.h:
* dfg/DFGOperations.cpp:
* interpreter/AbstractPC.cpp:
(JSC::AbstractPC::AbstractPC):
* interpreter/CallFrame.h:
(ExecState):
* interpreter/Interpreter.cpp:
(JSC::Interpreter::~Interpreter):
(JSC::Interpreter::initialize):
(JSC::Interpreter::isOpcode):
(JSC::Interpreter::unwindCallFrame):
(JSC::getLineNumberForCallFrame):
(JSC::getCallerInfo):
(JSC::Interpreter::execute):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::privateExecute):
* interpreter/Interpreter.h:
(JSC::Interpreter::getOpcode):
(JSC::Interpreter::getOpcodeID):
(Interpreter):
* jit/HostCallReturnValue.h:
* jit/JITCode.h:
(JITCode):
* jit/JITExceptions.cpp:
* jit/JITExceptions.h:
* jit/JSInterfaceJIT.h:
* llint/LLIntData.h:
(JSC::LLInt::getOpcode):
* llint/LLIntEntrypoints.cpp:
(JSC::LLInt::getFunctionEntrypoint):
(JSC::LLInt::getEvalEntrypoint):
(JSC::LLInt::getProgramEntrypoint):
* llint/LLIntOffsetsExtractor.cpp:
(JSC::LLIntOffsetsExtractor::dummy):
* llint/LLIntSlowPaths.cpp:
(LLInt):
* runtime/JSGlobalData.cpp:
(JSC):

Source/WTF:

* wtf/Platform.h: Added ENABLE(COMPUTED_GOTO_OPCODES).

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127199 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2d86ed26
2012-08-30 Mark Lam <mark.lam@apple.com>
Render unto #ifdef's that which belong to them.
https://bugs.webkit.org/show_bug.cgi?id=95482.
Reviewed by Filip Pizlo.
Refining / disambiguating between #ifdefs and adding some. For
example, ENABLE(JIT) is conflated with ENABLE(LLINT) in some places.
Also, we need to add ENABLE(COMPUTED_GOTO_OPCODES) to indicate that we
want interpreted opcodes to use COMPUTED GOTOs apart from ENABLE(LLINT)
and ENABLE(COMPUTED_GOTO_CLASSIC_INTERPRETER). Also cleaned up #ifdefs
in certain places which were previously incorrect.
* bytecode/CodeBlock.cpp:
(JSC):
(JSC::CodeBlock::bytecodeOffset):
* bytecode/CodeBlock.h:
(CodeBlock):
* bytecode/Opcode.h:
(JSC::padOpcodeName):
* config.h:
* dfg/DFGOperations.cpp:
* interpreter/AbstractPC.cpp:
(JSC::AbstractPC::AbstractPC):
* interpreter/CallFrame.h:
(ExecState):
* interpreter/Interpreter.cpp:
(JSC::Interpreter::~Interpreter):
(JSC::Interpreter::initialize):
(JSC::Interpreter::isOpcode):
(JSC::Interpreter::unwindCallFrame):
(JSC::getLineNumberForCallFrame):
(JSC::getCallerInfo):
(JSC::Interpreter::execute):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::privateExecute):
* interpreter/Interpreter.h:
(JSC::Interpreter::getOpcode):
(JSC::Interpreter::getOpcodeID):
(Interpreter):
* jit/HostCallReturnValue.h:
* jit/JITCode.h:
(JITCode):
* jit/JITExceptions.cpp:
* jit/JITExceptions.h:
* jit/JSInterfaceJIT.h:
* llint/LLIntData.h:
(JSC::LLInt::getOpcode):
* llint/LLIntEntrypoints.cpp:
(JSC::LLInt::getFunctionEntrypoint):
(JSC::LLInt::getEvalEntrypoint):
(JSC::LLInt::getProgramEntrypoint):
* llint/LLIntOffsetsExtractor.cpp:
(JSC::LLIntOffsetsExtractor::dummy):
* llint/LLIntSlowPaths.cpp:
(LLInt):
* runtime/JSGlobalData.cpp:
(JSC):
2012-08-30 JungJik Lee <jungjik.lee@samsung.com>
[EFL][WK2] Add WebMemorySampler feature.
......
......@@ -2577,6 +2577,7 @@ void CodeBlock::unlinkIncomingCalls()
while (m_incomingCalls.begin() != m_incomingCalls.end())
m_incomingCalls.begin()->unlink(*m_globalData, repatchBuffer);
}
#endif // ENABLE(JIT)
#if ENABLE(LLINT)
Instruction* CodeBlock::adjustPCIfAtCallSite(Instruction* potentialReturnPC)
......@@ -2630,10 +2631,12 @@ Instruction* CodeBlock::adjustPCIfAtCallSite(Instruction* potentialReturnPC)
// Not a call site. No need to adjust PC. Just return the original.
return potentialReturnPC;
}
#endif
#endif // ENABLE(LLINT)
unsigned CodeBlock::bytecodeOffset(ExecState* exec, ReturnAddressPtr returnAddress)
{
UNUSED_PARAM(exec);
UNUSED_PARAM(returnAddress);
#if ENABLE(LLINT)
if (returnAddress.value() >= LLInt::getCodePtr(llint_begin)
&& returnAddress.value() <= LLInt::getCodePtr(llint_end)) {
......@@ -2644,20 +2647,23 @@ unsigned CodeBlock::bytecodeOffset(ExecState* exec, ReturnAddressPtr returnAddre
ASSERT(instruction);
instruction = adjustPCIfAtCallSite(instruction);
return bytecodeOffset(instruction);
}
#else
UNUSED_PARAM(exec);
#endif
#endif // !ENABLE(LLINT)
#if ENABLE(JIT)
if (!m_rareData)
return 1;
Vector<CallReturnOffsetToBytecodeOffset>& callIndices = m_rareData->m_callReturnIndexVector;
if (!callIndices.size())
return 1;
return binarySearch<CallReturnOffsetToBytecodeOffset, unsigned, getCallReturnOffset>(callIndices.begin(), callIndices.size(), getJITCode().offsetOf(returnAddress.value()))->bytecodeOffset;
}
#endif // ENABLE(JIT)
#if !ENABLE(LLINT) && !ENABLE(JIT)
return 1;
#endif
}
void CodeBlock::clearEvalCache()
{
......
......@@ -229,12 +229,14 @@ namespace JSC {
{
return *(binarySearch<MethodCallLinkInfo, unsigned, getMethodCallLinkInfoBytecodeIndex>(m_methodCallLinkInfos.begin(), m_methodCallLinkInfos.size(), bytecodeIndex));
}
#endif // ENABLE(JIT)
#if ENABLE(LLINT)
Instruction* adjustPCIfAtCallSite(Instruction*);
#endif
unsigned bytecodeOffset(ExecState*, ReturnAddressPtr);
#if ENABLE(JIT)
unsigned bytecodeOffsetForCallAtIndex(unsigned index)
{
if (!m_rareData)
......@@ -254,6 +256,8 @@ namespace JSC {
{
m_incomingCalls.push(incoming);
}
#endif // ENABLE(JIT)
#if ENABLE(LLINT)
void linkIncomingCall(LLIntCallLinkInfo* incoming)
{
......@@ -262,7 +266,6 @@ namespace JSC {
#endif // ENABLE(LLINT)
void unlinkIncomingCalls();
#endif // ENABLE(JIT)
#if ENABLE(DFG_JIT) || ENABLE(LLINT)
void setJITCodeMap(PassOwnPtr<CompactJITCodeMap> jitCodeMap)
......
......@@ -225,7 +225,7 @@ namespace JSC {
FOR_EACH_OPCODE_ID(VERIFY_OPCODE_ID);
#undef VERIFY_OPCODE_ID
#if ENABLE(COMPUTED_GOTO_CLASSIC_INTERPRETER) || ENABLE(LLINT)
#if ENABLE(COMPUTED_GOTO_OPCODES)
typedef void* Opcode;
#else
typedef OpcodeID Opcode;
......
......@@ -57,9 +57,9 @@
#ifndef _CRT_RAND_S
#define _CRT_RAND_S
#endif
#endif
#endif // !COMPILER(MSVC7_OR_LOWER) && !OS(WINCE)
#endif
#endif // OS(WINDOWS)
#define WTF_CHANGES 1
......
......@@ -44,6 +44,8 @@
#include "Operations.h"
#include <wtf/InlineASM.h>
#if ENABLE(JIT)
#if ENABLE(DFG_JIT)
#if CPU(X86_64)
......@@ -1388,7 +1390,7 @@ extern "C" void DFG_OPERATION triggerReoptimizationNow(CodeBlock* codeBlock)
} // extern "C"
} } // namespace JSC::DFG
#endif
#endif // ENABLE(DFG_JIT)
#if COMPILER(GCC)
......@@ -1450,3 +1452,4 @@ extern "C" EncodedJSValue HOST_CALL_RETURN_VALUE_OPTION getHostCallReturnValueWi
#endif // COMPILER(GCC)
#endif // ENABLE(JIT)
......@@ -36,6 +36,7 @@ namespace JSC {
AbstractPC::AbstractPC(JSGlobalData& globalData, ExecState* exec)
{
UNUSED_PARAM(globalData);
UNUSED_PARAM(exec);
#if ENABLE(JIT)
if (globalData.canUseJIT()) {
......
......@@ -103,7 +103,7 @@ namespace JSC {
CallFrame& operator=(const Register& r) { *static_cast<Register*>(this) = r; return *this; }
CallFrame* callerFrame() const { return this[RegisterFile::CallerFrame].callFrame(); }
#if ENABLE(JIT)
#if ENABLE(JIT) || ENABLE(LLINT)
ReturnAddressPtr returnPC() const { return ReturnAddressPtr(this[RegisterFile::ReturnPC].vPC()); }
bool hasReturnPC() const { return !!this[RegisterFile::ReturnPC].vPC(); }
void clearReturnPC() { registers()[RegisterFile::ReturnPC] = static_cast<Instruction*>(0); }
......
......@@ -278,7 +278,7 @@ Interpreter::Interpreter()
Interpreter::~Interpreter()
{
#if ENABLE(LLINT)
#if ENABLE(LLINT) && ENABLE(COMPUTED_GOTO_OPCODES)
if (m_classicEnabled)
delete[] m_opcodeTable;
#endif
......@@ -293,15 +293,16 @@ void Interpreter::initialize(bool canUseJIT)
#error "Building both LLInt and the Classic Interpreter is not supported because it doesn't make sense."
#endif
#if ENABLE(COMPUTED_GOTO_OPCODES)
#if ENABLE(LLINT)
m_opcodeTable = LLInt::opcodeMap();
for (int i = 0; i < numOpcodeIDs; ++i)
m_opcodeIDTable.add(m_opcodeTable[i], static_cast<OpcodeID>(i));
m_classicEnabled = false;
#elif ENABLE(COMPUTED_GOTO_CLASSIC_INTERPRETER)
if (canUseJIT) {
// If the JIT is present, don't use jump destinations for opcodes.
for (int i = 0; i < numOpcodeIDs; ++i) {
Opcode opcode = bitwise_cast<void*>(static_cast<uintptr_t>(i));
m_opcodeTable[i] = opcode;
......@@ -315,13 +316,16 @@ void Interpreter::initialize(bool canUseJIT)
m_classicEnabled = true;
}
#else
#endif // ENABLE(COMPUTED_GOTO_CLASSIC_INTERPRETER)
#else // !ENABLE(COMPUTED_GOTO_OPCODES)
#if ENABLE(CLASSIC_INTERPRETER)
m_classicEnabled = true;
#else
m_classicEnabled = false;
#endif
#endif // ENABLE(COMPUTED_GOTO_CLASSIC_INTERPRETER)
#endif // !ENABLE(COMPUTED_GOTO_OPCODES)
#if !ASSERT_DISABLED
m_initialized = true;
#endif
......@@ -432,7 +436,7 @@ void Interpreter::dumpRegisters(CallFrame* callFrame)
bool Interpreter::isOpcode(Opcode opcode)
{
#if ENABLE(COMPUTED_GOTO_CLASSIC_INTERPRETER) || ENABLE(LLINT)
#if ENABLE(COMPUTED_GOTO_OPCODES)
#if !ENABLE(LLINT)
if (!m_classicEnabled)
return static_cast<OpcodeID>(bitwise_cast<uintptr_t>(opcode)) <= op_end;
......@@ -496,7 +500,7 @@ NEVER_INLINE bool Interpreter::unwindCallFrame(CallFrame*& callFrame, JSValue ex
bytecodeOffset = codeBlock->bytecodeOffset(callerFrame, callFrame->returnPC());
else
bytecodeOffset = codeBlock->bytecodeOffset(callFrame->returnVPC()) - 1;
#elif ENABLE(JIT)
#elif ENABLE(JIT) || ENABLE(LLINT)
bytecodeOffset = codeBlock->bytecodeOffset(callerFrame, callFrame->returnPC());
#else
bytecodeOffset = codeBlock->bytecodeOffset(callFrame->returnVPC()) - 1;
......@@ -568,7 +572,7 @@ static int getLineNumberForCallFrame(JSGlobalData* globalData, CallFrame* callFr
if (!globalData->canUseJIT())
return codeBlock->lineNumberForBytecodeOffset(callFrame->bytecodeOffsetForNonDFGCode() - 1);
#endif
#if ENABLE(JIT)
#if ENABLE(JIT) || ENABLE(LLINT)
#if ENABLE(DFG_JIT)
if (codeBlock->getJITType() == JITCode::DFGJIT)
return codeBlock->lineNumberForBytecodeOffset(codeBlock->codeOrigin(callFrame->codeOriginIndexForDFG()).bytecodeIndex);
......@@ -594,7 +598,7 @@ static CallFrame* getCallerInfo(JSGlobalData* globalData, CallFrame* callFrame,
CodeBlock* callerCodeBlock = callerFrame->codeBlock();
#if ENABLE(JIT)
#if ENABLE(JIT) || ENABLE(LLINT)
if (!callFrame->hasReturnPC())
callframeIsHost = true;
#endif
......@@ -613,7 +617,7 @@ static CallFrame* getCallerInfo(JSGlobalData* globalData, CallFrame* callFrame,
return callerFrame;
}
#endif
#if ENABLE(JIT)
#if ENABLE(JIT) || ENABLE(LLINT)
#if ENABLE(DFG_JIT)
if (callerCodeBlock && callerCodeBlock->getJITType() == JITCode::DFGJIT) {
unsigned codeOriginIndex = callerFrame->codeOriginIndexForDFG();
......@@ -630,7 +634,7 @@ static CallFrame* getCallerInfo(JSGlobalData* globalData, CallFrame* callFrame,
return callerFrame;
}
#endif
#if ENABLE(JIT)
#if ENABLE(JIT) || ENABLE(LLINT)
#if ENABLE(DFG_JIT)
if (callFrame->isInlineCallFrame()) {
InlineCallFrame* icf = callFrame->inlineCallFrame();
......@@ -844,6 +848,9 @@ JSValue Interpreter::execute(ProgramExecutable* program, CallFrame* callFrame, S
if (m_reentryDepth >= MaxSmallThreadReentryDepth && m_reentryDepth >= callFrame->globalData().maxReentryDepth)
return checkedReturn(throwStackOverflowError(callFrame));
// First check if the "program" is actually just a JSON object. If so,
// we'll handle the JSON object here. Else, we'll handle real JS code
// below at failedJSONP.
DynamicGlobalObjectScope globalObjectScope(*scopeChain->globalData, scopeChain->globalObject.get());
Vector<JSONPData> JSONPData;
bool parseResult;
......@@ -944,16 +951,22 @@ JSValue Interpreter::execute(ProgramExecutable* program, CallFrame* callFrame, S
return result;
}
failedJSONP:
// If we get here, then we have already proven that the script is not a JSON
// object.
// Compile source to bytecode if necessary:
JSObject* error = program->compile(callFrame, scopeChain);
if (error)
return checkedReturn(throwError(callFrame, error));
CodeBlock* codeBlock = &program->generatedBytecode();
// Reserve stack space for this invocation:
Register* oldEnd = m_registerFile.end();
Register* newEnd = oldEnd + codeBlock->numParameters() + RegisterFile::CallFrameHeaderSize + codeBlock->m_numCalleeRegisters;
if (!m_registerFile.grow(newEnd))
return checkedReturn(throwStackOverflowError(callFrame));
// Push the call frame for this invocation:
CallFrame* newCallFrame = CallFrame::create(oldEnd + codeBlock->numParameters() + RegisterFile::CallFrameHeaderSize);
ASSERT(codeBlock->numParameters() == 1); // 1 parameter for 'this'.
newCallFrame->init(codeBlock, 0, scopeChain, CallFrame::noCaller(), codeBlock->numParameters(), 0);
......@@ -963,6 +976,7 @@ failedJSONP:
if (Profiler* profiler = callFrame->globalData().enabledProfiler())
profiler->willExecute(callFrame, program->sourceURL(), program->lineNo());
// Execute the code:
JSValue result;
{
SamplingTool::CallRecord callRecord(m_sampler.get());
......@@ -972,7 +986,7 @@ failedJSONP:
if (!classicEnabled())
result = program->generatedJITCode().execute(&m_registerFile, newCallFrame, scopeChain->globalData);
else
#endif
#endif // ENABLE(JIT)
result = privateExecute(Normal, &m_registerFile, newCallFrame);
m_reentryDepth--;
......@@ -1044,7 +1058,7 @@ JSValue Interpreter::executeCall(CallFrame* callFrame, JSObject* function, CallT
if (!classicEnabled())
result = callData.js.functionExecutable->generatedJITCodeForCall().execute(&m_registerFile, newCallFrame, callDataScopeChain->globalData);
else
#endif
#endif // ENABLE(JIT)
result = privateExecute(Normal, &m_registerFile, newCallFrame);
m_reentryDepth--;
}
......@@ -1138,7 +1152,7 @@ JSObject* Interpreter::executeConstruct(CallFrame* callFrame, JSObject* construc
if (!classicEnabled())
result = constructData.js.functionExecutable->generatedJITCodeForConstruct().execute(&m_registerFile, newCallFrame, constructDataScopeChain->globalData);
else
#endif
#endif // ENABLE(JIT)
result = privateExecute(Normal, &m_registerFile, newCallFrame);
m_reentryDepth--;
}
......@@ -1245,7 +1259,7 @@ JSValue Interpreter::execute(CallFrameClosure& closure)
#if ENABLE(CLASSIC_INTERPRETER)
else
#endif
#endif
#endif // ENABLE(JIT)
#if ENABLE(CLASSIC_INTERPRETER)
result = privateExecute(Normal, &m_registerFile, closure.newCallFrame);
#endif
......@@ -1350,7 +1364,7 @@ JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSValue
#if ENABLE(CLASSIC_INTERPRETER)
else
#endif
#endif
#endif // ENABLE(JIT)
#if ENABLE(CLASSIC_INTERPRETER)
result = privateExecute(Normal, &m_registerFile, newCallFrame);
#endif
......@@ -1714,9 +1728,9 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
UPDATE_BYTECODE_OFFSET();
#else
#define DEFINE_OPCODE(opcode) opcode: UPDATE_BYTECODE_OFFSET();
#endif
#endif // !ENABLE(OPCODE_STATS)
NEXT_INSTRUCTION();
#else
#else // !ENABLE(COMPUTED_GOTO_CLASSIC_INTERPRETER)
#define NEXT_INSTRUCTION() SAMPLE(codeBlock, vPC); goto interpreterLoopStart
#if ENABLE(OPCODE_STATS)
#define DEFINE_OPCODE(opcode) \
......@@ -1729,7 +1743,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
while (1) { // iterator loop begins
interpreterLoopStart:;
switch (vPC->u.opcode)
#endif
#endif // !ENABLE(COMPUTED_GOTO_CLASSIC_INTERPRETER)
{
DEFINE_OPCODE(op_new_object) {
/* new_object dst(r)
......
......@@ -194,7 +194,7 @@ namespace JSC {
Opcode getOpcode(OpcodeID id)
{
ASSERT(m_initialized);
#if ENABLE(COMPUTED_GOTO_CLASSIC_INTERPRETER) || ENABLE(LLINT)
#if ENABLE(COMPUTED_GOTO_OPCODES)
return m_opcodeTable[id];
#else
return id;
......@@ -204,6 +204,7 @@ namespace JSC {
OpcodeID getOpcodeID(Opcode opcode)
{
ASSERT(m_initialized);
#if ENABLE(COMPUTED_GOTO_OPCODES)
#if ENABLE(LLINT)
ASSERT(isOpcode(opcode));
return m_opcodeIDTable.get(opcode);
......@@ -213,9 +214,10 @@ namespace JSC {
return static_cast<OpcodeID>(bitwise_cast<uintptr_t>(opcode));
return m_opcodeIDTable.get(opcode);
#else
#endif // ENABLE(COMPUTED_GOTO_CLASSIC_INTERPRETER)
#else // !ENABLE(COMPUTED_GOTO_OPCODES)
return opcode;
#endif
#endif // !ENABLE(COMPUTED_GOTO_OPCODES)
}
bool classicEnabled()
......@@ -287,6 +289,7 @@ namespace JSC {
RegisterFile m_registerFile;
#if ENABLE(COMPUTED_GOTO_OPCODES)
#if ENABLE(LLINT)
Opcode* m_opcodeTable; // Maps OpcodeID => Opcode for compiling
HashMap<Opcode, OpcodeID> m_opcodeIDTable; // Maps Opcode => OpcodeID for decompiling
......@@ -294,6 +297,7 @@ namespace JSC {
Opcode m_opcodeTable[numOpcodeIDs]; // Maps OpcodeID => Opcode for compiling
HashMap<Opcode, OpcodeID> m_opcodeIDTable; // Maps Opcode => OpcodeID for decompiling
#endif
#endif // ENABLE(COMPUTED_GOTO_OPCODES)
#if !ASSERT_DISABLED
bool m_initialized;
......
......@@ -33,7 +33,7 @@
// Unfortunately this only works on GCC-like compilers. And it's currently only used
// by LLInt and DFG, which also are restricted to GCC-like compilers. We should
// probably fix that at some point.
#if COMPILER(GCC)
#if COMPILER(GCC) && ENABLE(JIT)
#if CALLING_CONVENTION_IS_STDCALL
#define HOST_CALL_RETURN_VALUE_OPTION CDECL
......
......@@ -26,7 +26,7 @@
#ifndef JITCode_h
#define JITCode_h
#if ENABLE(JIT)
#if ENABLE(JIT) || ENABLE(LLINT)
#include "CallFrame.h"
#include "JSValue.h"
#include "Disassembler.h"
......@@ -42,7 +42,7 @@ namespace JSC {
#endif
class JITCode {
#if ENABLE(JIT)
#if ENABLE(JIT) || ENABLE(LLINT)
typedef MacroAssemblerCodeRef CodeRef;
typedef MacroAssemblerCodePtr CodePtr;
#else
......@@ -77,7 +77,7 @@ namespace JSC {
return jitType == InterpreterThunk || jitType == BaselineJIT;
}
#if ENABLE(JIT)
#if ENABLE(JIT) || ENABLE(LLINT)
JITCode()
: m_jitType(None)
{
......@@ -127,12 +127,14 @@ namespace JSC {
return static_cast<unsigned>(result);
}
#if ENABLE(JIT)
// Execute the code!
inline JSValue execute(RegisterFile* registerFile, CallFrame* callFrame, JSGlobalData* globalData)
{
JSValue result = JSValue::decode(ctiTrampoline(m_ref.code().executableAddress(), registerFile, callFrame, 0, 0, globalData));
return globalData->exception ? jsNull() : result;
}
#endif
void* start() const
{
......@@ -182,7 +184,7 @@ namespace JSC {
CodeRef m_ref;
JITType m_jitType;
#endif // ENABLE(JIT)
#endif // ENABLE(JIT) || ENABLE(LLINT)
};
};
......
......@@ -32,7 +32,7 @@
#include "JSGlobalData.h"
#include "JSValue.h"
#if ENABLE(JIT)
#if ENABLE(JIT) || ENABLE(LLINT)
namespace JSC {
......
......@@ -29,7 +29,7 @@
#include "JSValue.h"
#include "MacroAssemblerCodeRef.h"
#if ENABLE(ASSEMBLER)
#if ENABLE(JIT) || ENABLE(LLINT)
namespace JSC {
......@@ -50,7 +50,7 @@ ExceptionHandler jitThrow(JSGlobalData*, ExecState*, JSValue exceptionValue, Ret
} // namespace JSC
#endif
#endif // ENABLE(JIT) || ENABLE(LLINT)
#endif // JITExceptions_h
......@@ -36,6 +36,8 @@
#include <wtf/AlwaysInline.h>
#include <wtf/Vector.h>
#if ENABLE(JIT)
namespace JSC {
class JSInterfaceJIT : public MacroAssembler {
public:
......@@ -333,6 +335,8 @@ namespace JSC {
return Address(base, (static_cast<unsigned>(virtualRegisterIndex) * sizeof(Register)));
}
}
} // namespace JSC
#endif // ENABLE(JIT)
#endif // JSInterfaceJIT_h
......@@ -71,7 +71,7 @@ inline Opcode* opcodeMap()
inline Opcode getOpcode(OpcodeID id)
{
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_OPCODES)
return Data::s_opcodeMap[id];
#else
return static_cast<Opcode>(id);
......
......@@ -52,6 +52,7 @@ void getFunctionEntrypoint(JSGlobalData& globalData, CodeSpecializationKind kind
return;
}
#if ENABLE(JIT)
if (kind == CodeForCall) {
jitCode = JITCode(globalData.getCTIStub(functionForCallEntryThunkGenerator), JITCode::InterpreterThunk);
arityCheck = globalData.getCTIStub(functionForCallArityCheckThunkGenerator).code();
......@@ -61,6 +62,7 @@ void getFunctionEntrypoint(JSGlobalData& globalData, CodeSpecializationKind kind
ASSERT(kind == CodeForConstruct);
jitCode = JITCode(globalData.getCTIStub(functionForConstructEntryThunkGenerator), JITCode::InterpreterThunk);
arityCheck = globalData.getCTIStub(functionForConstructArityCheckThunkGenerator).code();
#endif // ENABLE(JIT)
}
void getEvalEntrypoint(JSGlobalData& globalData, JITCode& jitCode)
......@@ -69,8 +71,9 @@ void getEvalEntrypoint(JSGlobalData& globalData, JITCode& jitCode)
jitCode = JITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_eval_prologue), JITCode::InterpreterThunk);
return;
}
#if ENABLE(JIT)
jitCode = JITCode(globalData.getCTIStub(evalEntryThunkGenerator), JITCode::InterpreterThunk);
#endif
}
void getProgramEntrypoint(JSGlobalData& globalData, JITCode& jitCode)
......@@ -79,8 +82,9 @@ void getProgramEntrypoint(JSGlobalData& globalData, JITCode& jitCode)
jitCode = JITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_program_prologue), JITCode::InterpreterThunk);
return;
}
#if ENABLE(JIT)
jitCode = JITCode(globalData.getCTIStub(programEntryThunkGenerator), JITCode::InterpreterThunk);
#endif
}
} } // namespace JSC::LLInt
......
......@@ -62,7 +62,7 @@ public:
const unsigned* LLIntOffsetsExtractor::dummy()
{
#if ENABLE(JIT)
#if ENABLE(LLINT)
// This is a file generated by offlineasm/generate_offsets_extractor.rb, and contains code
// to create a table of offsets, sizes, and a header identifying what combination of
// Platform.h macros we have set. We include it inside of a method on LLIntOffsetsExtractor
......
......@@ -256,6 +256,7 @@ LLINT_SLOW_PATH_DECL(special_trace)
LLINT_END_IMPL();
}
#if ENABLE(JIT)
inline bool shouldJIT(ExecState* exec)
{
// You can modify this to turn off JITting without rebuilding the world.
......@@ -391,6 +392,7 @@ LLINT_SLOW_PATH_DECL(replace)
codeBlock->dontJITAnytimeSoon();
LLINT_END_IMPL();
}
#endif // ENABLE(JIT)
LLINT_SLOW_PATH_DECL(register_file_check)
{
......
......@@ -375,12 +375,13 @@ NativeExecutable* JSGlobalData::getHostFunction(NativeFunction function, Intrins
ASSERT(canUseJIT());
return jitStubs->hostFunctionStub(this, function, intrinsic != NoIntrinsic ? thunkGeneratorForIntrinsic(intrinsic) : 0, intrinsic);
}
#else
#else // !ENABLE(JIT)
NativeExecutable* JSGlobalData::getHostFunction(NativeFunction function, NativeFunction constructor)
{
return NativeExecutable::create(*this, function, constructor);
}
#endif
#endif // !ENABLE(JIT)
JSGlobalData::ClientData::~ClientData()
{
......
2012-08-30 Mark Lam <mark.lam@apple.com>
Render unto #ifdef's that which belong to them.
https://bugs.webkit.org/show_bug.cgi?id=95482.
Reviewed by Filip Pizlo.
* wtf/Platform.h: Added ENABLE(COMPUTED_GOTO_OPCODES).
2012-08-30 Pratik Solanki <psolanki@apple.com>
objc_msgSend and IMP should be cast appropriately before using
......
......@@ -978,6 +978,10 @@
#define ENABLE_COMPUTED_GOTO_CLASSIC_INTERPRETER 1
#endif
#if (HAVE(COMPUTED_GOTO) && ENABLE(LLINT)) || ENABLE(COMPUTED_GOTO_CLASSIC_INTERPRETER)
#define ENABLE_COMPUTED_GOTO_OPCODES 1
#endif
/* Regular Expression Tracing - Set to 1 to trace RegExp's in jsc. Results dumped at exit */
#define ENABLE_REGEXP_TRACING 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment