Commit 563fc0a7 authored by oliver@apple.com's avatar oliver@apple.com

2010-07-10 Oliver Hunt <oliver@apple.com>

        Reviewed by Maciej Stachowiak.

        HAVE_COMPUTED_GOTO is dependent on the interpreter being enabled
        https://bugs.webkit.org/show_bug.cgi?id=42039

        Separate the existence of computed goto support in the compiler
        from whether or not we are using the interpreter.  All the current
        HAVE(COMPUTED_GOTO) guards are for the interpreter, but I'd like
        the option of using it elsewhere.  The interpreter now uses
        ENABLE(COMPUTED_GOTO_INTERPRETER)

        * bytecode/Instruction.h:
        (JSC::Instruction::Instruction):
        * bytecode/Opcode.h:
        * interpreter/Interpreter.cpp:
        (JSC::Interpreter::Interpreter):
        (JSC::Interpreter::isOpcode):
        (JSC::Interpreter::privateExecute):
        * interpreter/Interpreter.h:
        (JSC::Interpreter::getOpcode):
        (JSC::Interpreter::getOpcodeID):
        * wtf/Platform.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63056 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e3c2546b
2010-07-10 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej Stachowiak.
HAVE_COMPUTED_GOTO is dependent on the interpreter being enabled
https://bugs.webkit.org/show_bug.cgi?id=42039
Separate the existence of computed goto support in the compiler
from whether or not we are using the interpreter. All the current
HAVE(COMPUTED_GOTO) guards are for the interpreter, but I'd like
the option of using it elsewhere. The interpreter now uses
ENABLE(COMPUTED_GOTO_INTERPRETER)
* bytecode/Instruction.h:
(JSC::Instruction::Instruction):
* bytecode/Opcode.h:
* interpreter/Interpreter.cpp:
(JSC::Interpreter::Interpreter):
(JSC::Interpreter::isOpcode):
(JSC::Interpreter::privateExecute):
* interpreter/Interpreter.h:
(JSC::Interpreter::getOpcode):
(JSC::Interpreter::getOpcodeID):
* wtf/Platform.h:
2010-07-10 Oliver Hunt <oliver@apple.com>
Reviewed by Gavin Barraclough.
......
......@@ -125,7 +125,7 @@ namespace JSC {
struct Instruction {
Instruction(Opcode opcode)
{
#if !HAVE(COMPUTED_GOTO)
#if !ENABLE(COMPUTED_GOTO_INTERPRETER)
// We have to initialize one of the pointer members to ensure that
// the entire struct is initialized, when opcode is not a pointer.
u.jsCell = 0;
......
......@@ -210,7 +210,7 @@ namespace JSC {
FOR_EACH_OPCODE_ID(VERIFY_OPCODE_ID);
#undef VERIFY_OPCODE_ID
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
#if COMPILER(RVCT) || COMPILER(INTEL)
typedef void* Opcode;
#else
......
......@@ -384,12 +384,12 @@ Interpreter::Interpreter()
: m_sampleEntryDepth(0)
, m_reentryDepth(0)
{
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
privateExecute(InitializeAndReturn, 0, 0, 0);
for (int i = 0; i < numOpcodeIDs; ++i)
m_opcodeIDTable.add(m_opcodeTable[i], static_cast<OpcodeID>(i));
#endif // HAVE(COMPUTED_GOTO)
#endif // ENABLE(COMPUTED_GOTO_INTERPRETER)
#if ENABLE(OPCODE_SAMPLING)
enableSampler();
......@@ -497,7 +497,7 @@ void Interpreter::dumpRegisters(CallFrame* callFrame)
bool Interpreter::isOpcode(Opcode opcode)
{
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
return opcode != HashTraits<Opcode>::emptyValue()
&& !HashTraits<Opcode>::isDeletedValue(opcode)
&& m_opcodeIDTable.contains(opcode);
......@@ -1385,13 +1385,13 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
// One-time initialization of our address tables. We have to put this code
// here because our labels are only in scope inside this function.
if (UNLIKELY(flag == InitializeAndReturn)) {
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
#define LIST_OPCODE_LABEL(id, length) &&id,
static Opcode labels[] = { FOR_EACH_OPCODE_ID(LIST_OPCODE_LABEL) };
for (size_t i = 0; i < sizeof(labels) / sizeof(Opcode); ++i)
m_opcodeTable[i] = labels[i];
#undef LIST_OPCODE_LABEL
#endif // HAVE(COMPUTED_GOTO)
#endif // ENABLE(COMPUTED_GOTO_INTERPRETER)
return JSValue();
}
......@@ -1447,7 +1447,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
#define SAMPLE(codeBlock, vPC)
#endif
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
#define NEXT_INSTRUCTION() SAMPLE(codeBlock, vPC); goto *vPC->u.opcode
#if ENABLE(OPCODE_STATS)
#define DEFINE_OPCODE(opcode) opcode: OpcodeStats::recordInstruction(opcode);
......@@ -2479,7 +2479,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
uncacheGetByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
goto *(&&skip_id_getter_proto);
#endif
DEFINE_OPCODE(op_get_by_id_getter_proto) {
......@@ -2521,10 +2521,10 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
uncacheGetByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
skip_id_getter_proto:
#endif
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
goto *(&&skip_id_custom_proto);
#endif
DEFINE_OPCODE(op_get_by_id_custom_proto) {
......@@ -2563,7 +2563,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
uncacheGetByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
skip_id_custom_proto:
#endif
DEFINE_OPCODE(op_get_by_id_self_list) {
......@@ -2654,7 +2654,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
uncacheGetByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
goto *(&&skip_id_getter_self);
#endif
DEFINE_OPCODE(op_get_by_id_getter_self) {
......@@ -2694,10 +2694,10 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
uncacheGetByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
skip_id_getter_self:
#endif
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
goto *(&&skip_id_custom_self);
#endif
DEFINE_OPCODE(op_get_by_id_custom_self) {
......@@ -2731,7 +2731,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
uncacheGetByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
skip_id_custom_self:
#endif
DEFINE_OPCODE(op_get_by_id_generic) {
......@@ -2754,7 +2754,7 @@ skip_id_custom_self:
vPC += OPCODE_LENGTH(op_get_by_id_generic);
NEXT_INSTRUCTION();
}
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
goto *(&&skip_id_getter_chain);
#endif
DEFINE_OPCODE(op_get_by_id_getter_chain) {
......@@ -2806,10 +2806,10 @@ skip_id_custom_self:
uncacheGetByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
skip_id_getter_chain:
#endif
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
goto *(&&skip_id_custom_chain);
#endif
DEFINE_OPCODE(op_get_by_id_custom_chain) {
......@@ -2858,7 +2858,7 @@ skip_id_custom_self:
uncacheGetByID(codeBlock, vPC);
NEXT_INSTRUCTION();
}
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
skip_id_custom_chain:
#endif
DEFINE_OPCODE(op_get_array_length) {
......@@ -4375,7 +4375,7 @@ skip_id_custom_self:
vPC += target;
NEXT_INSTRUCTION();
}
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
// Appease GCC
goto *(&&skip_new_scope);
#endif
......@@ -4391,7 +4391,7 @@ skip_id_custom_self:
vPC += OPCODE_LENGTH(op_push_new_scope);
NEXT_INSTRUCTION();
}
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
skip_new_scope:
#endif
DEFINE_OPCODE(op_catch) {
......@@ -4605,7 +4605,7 @@ skip_id_custom_self:
NEXT_INSTRUCTION();
}
}
#if !HAVE(COMPUTED_GOTO)
#if !ENABLE(COMPUTED_GOTO_INTERPRETER)
} // iterator loop ends
#endif
#undef NEXT_INSTRUCTION
......
......@@ -75,7 +75,7 @@ namespace JSC {
Opcode getOpcode(OpcodeID id)
{
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
return m_opcodeTable[id];
#else
return id;
......@@ -84,7 +84,7 @@ namespace JSC {
OpcodeID getOpcodeID(Opcode opcode)
{
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
ASSERT(isOpcode(opcode));
return m_opcodeIDTable.get(opcode);
#else
......@@ -159,7 +159,7 @@ namespace JSC {
RegisterFile m_registerFile;
#if HAVE(COMPUTED_GOTO)
#if ENABLE(COMPUTED_GOTO_INTERPRETER)
Opcode m_opcodeTable[numOpcodeIDs]; // Maps OpcodeID => Opcode for compiling
HashMap<Opcode, OpcodeID> m_opcodeIDTable; // Maps Opcode => OpcodeID for decompiling
#endif
......
......@@ -1020,10 +1020,14 @@ on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
#define JSC_HOST_CALL
#endif
#if COMPILER(GCC) && ENABLE(INTERPRETER)
#if COMPILER(GCC)
#define HAVE_COMPUTED_GOTO 1
#endif
#if HAVE(COMPUTED_GOTO) && ENABLE(INTERPRETER)
#define ENABLE_COMPUTED_GOTO_INTERPRETER 1
#endif
/* Yet Another Regex Runtime. */
#if !defined(ENABLE_YARR_JIT)
......
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