Title: [127199] trunk/Source
Revision
127199
Author
[email protected]
Date
2012-08-30 15:21:48 -0700 (Thu, 30 Aug 2012)

Log Message

Render unto #ifdef's that which belong to them.
https://bugs.webkit.org/show_bug.cgi?id=95482.

Patch by Mark Lam <[email protected]> on 2012-08-30
Reviewed by Filip Pizlo.

Source/_javascript_Core:

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).

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (127198 => 127199)


--- trunk/Source/_javascript_Core/ChangeLog	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-08-30 22:21:48 UTC (rev 127199)
@@ -1,3 +1,64 @@
+2012-08-30  Mark Lam  <[email protected]>
+
+        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  <[email protected]>
 
         [EFL][WK2] Add WebMemorySampler feature.

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (127198 => 127199)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2012-08-30 22:21:48 UTC (rev 127199)
@@ -2577,6 +2577,7 @@
     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 @@
     // 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 @@
         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
 }
-#endif
 
 void CodeBlock::clearEvalCache()
 {

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.h (127198 => 127199)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2012-08-30 22:21:48 UTC (rev 127199)
@@ -229,12 +229,14 @@
         {
             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 @@
         {
             m_incomingCalls.push(incoming);
         }
+#endif // ENABLE(JIT)
+
 #if ENABLE(LLINT)
         void linkIncomingCall(LLIntCallLinkInfo* incoming)
         {
@@ -262,7 +266,6 @@
 #endif // ENABLE(LLINT)
         
         void unlinkIncomingCalls();
-#endif // ENABLE(JIT)
 
 #if ENABLE(DFG_JIT) || ENABLE(LLINT)
         void setJITCodeMap(PassOwnPtr<CompactJITCodeMap> jitCodeMap)

Modified: trunk/Source/_javascript_Core/bytecode/Opcode.h (127198 => 127199)


--- trunk/Source/_javascript_Core/bytecode/Opcode.h	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/_javascript_Core/bytecode/Opcode.h	2012-08-30 22:21:48 UTC (rev 127199)
@@ -225,7 +225,7 @@
         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;

Modified: trunk/Source/_javascript_Core/config.h (127198 => 127199)


--- trunk/Source/_javascript_Core/config.h	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/_javascript_Core/config.h	2012-08-30 22:21:48 UTC (rev 127199)
@@ -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
 

Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.cpp (127198 => 127199)


--- trunk/Source/_javascript_Core/dfg/DFGOperations.cpp	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.cpp	2012-08-30 22:21:48 UTC (rev 127199)
@@ -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"
 } } // namespace JSC::DFG
 
-#endif
+#endif // ENABLE(DFG_JIT)
 
 #if COMPILER(GCC)
 
@@ -1450,3 +1452,4 @@
 
 #endif // COMPILER(GCC)
 
+#endif // ENABLE(JIT)

Modified: trunk/Source/_javascript_Core/interpreter/AbstractPC.cpp (127198 => 127199)


--- trunk/Source/_javascript_Core/interpreter/AbstractPC.cpp	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/_javascript_Core/interpreter/AbstractPC.cpp	2012-08-30 22:21:48 UTC (rev 127199)
@@ -36,6 +36,7 @@
 AbstractPC::AbstractPC(JSGlobalData& globalData, ExecState* exec)
 {
     UNUSED_PARAM(globalData);
+    UNUSED_PARAM(exec);
     
 #if ENABLE(JIT)
     if (globalData.canUseJIT()) {

Modified: trunk/Source/_javascript_Core/interpreter/CallFrame.h (127198 => 127199)


--- trunk/Source/_javascript_Core/interpreter/CallFrame.h	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/_javascript_Core/interpreter/CallFrame.h	2012-08-30 22:21:48 UTC (rev 127199)
@@ -103,7 +103,7 @@
         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); }

Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.cpp (127198 => 127199)


--- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2012-08-30 22:21:48 UTC (rev 127199)
@@ -278,7 +278,7 @@
 
 Interpreter::~Interpreter()
 {
-#if ENABLE(LLINT)
+#if ENABLE(LLINT) && ENABLE(COMPUTED_GOTO_OPCODES)
     if (m_classicEnabled)
         delete[] m_opcodeTable;
 #endif
@@ -293,15 +293,16 @@
 #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 @@
         
         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 @@
 
 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 @@
         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 @@
     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 @@
     
     CodeBlock* callerCodeBlock = callerFrame->codeBlock();
     
-#if ENABLE(JIT)
+#if ENABLE(JIT) || ENABLE(LLINT)
     if (!callFrame->hasReturnPC())
         callframeIsHost = true;
 #endif
@@ -613,7 +617,7 @@
             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 @@
             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 @@
     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 @@
         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 @@
     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 @@
         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 @@
             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 @@
             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 @@
 #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 @@
 #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 @@
             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 @@
     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)

Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.h (127198 => 127199)


--- trunk/Source/_javascript_Core/interpreter/Interpreter.h	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.h	2012-08-30 22:21:48 UTC (rev 127199)
@@ -194,7 +194,7 @@
         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 @@
         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 @@
                 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 @@
 
         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 @@
         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;

Modified: trunk/Source/_javascript_Core/jit/HostCallReturnValue.h (127198 => 127199)


--- trunk/Source/_javascript_Core/jit/HostCallReturnValue.h	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/_javascript_Core/jit/HostCallReturnValue.h	2012-08-30 22:21:48 UTC (rev 127199)
@@ -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

Modified: trunk/Source/_javascript_Core/jit/JITCode.h (127198 => 127199)


--- trunk/Source/_javascript_Core/jit/JITCode.h	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/_javascript_Core/jit/JITCode.h	2012-08-30 22:21:48 UTC (rev 127199)
@@ -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 @@
 #endif
     
     class JITCode {
-#if ENABLE(JIT)
+#if ENABLE(JIT) || ENABLE(LLINT)
         typedef MacroAssemblerCodeRef CodeRef;
         typedef MacroAssemblerCodePtr CodePtr;
 #else
@@ -77,7 +77,7 @@
             return jitType == InterpreterThunk || jitType == BaselineJIT;
         }
         
-#if ENABLE(JIT)
+#if ENABLE(JIT) || ENABLE(LLINT)
         JITCode()
             : m_jitType(None)
         {
@@ -127,12 +127,14 @@
             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 @@
 
         CodeRef m_ref;
         JITType m_jitType;
-#endif // ENABLE(JIT)
+#endif // ENABLE(JIT) || ENABLE(LLINT)
     };
 
 };

Modified: trunk/Source/_javascript_Core/jit/JITExceptions.cpp (127198 => 127199)


--- trunk/Source/_javascript_Core/jit/JITExceptions.cpp	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/_javascript_Core/jit/JITExceptions.cpp	2012-08-30 22:21:48 UTC (rev 127199)
@@ -32,7 +32,7 @@
 #include "JSGlobalData.h"
 #include "JSValue.h"
 
-#if ENABLE(JIT)
+#if ENABLE(JIT) || ENABLE(LLINT)
 
 namespace JSC {
 

Modified: trunk/Source/_javascript_Core/jit/JITExceptions.h (127198 => 127199)


--- trunk/Source/_javascript_Core/jit/JITExceptions.h	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/_javascript_Core/jit/JITExceptions.h	2012-08-30 22:21:48 UTC (rev 127199)
@@ -29,7 +29,7 @@
 #include "JSValue.h"
 #include "MacroAssemblerCodeRef.h"
 
-#if ENABLE(ASSEMBLER)
+#if ENABLE(JIT) || ENABLE(LLINT)
 
 namespace JSC {
 
@@ -50,7 +50,7 @@
 
 } // namespace JSC
 
-#endif
+#endif // ENABLE(JIT) || ENABLE(LLINT)
 
 #endif // JITExceptions_h
 

Modified: trunk/Source/_javascript_Core/jit/JSInterfaceJIT.h (127198 => 127199)


--- trunk/Source/_javascript_Core/jit/JSInterfaceJIT.h	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/_javascript_Core/jit/JSInterfaceJIT.h	2012-08-30 22:21:48 UTC (rev 127199)
@@ -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 @@
         return Address(base, (static_cast<unsigned>(virtualRegisterIndex) * sizeof(Register)));
     }
 
-}
+} // namespace JSC
 
+#endif // ENABLE(JIT)
+
 #endif // JSInterfaceJIT_h

Modified: trunk/Source/_javascript_Core/llint/LLIntData.h (127198 => 127199)


--- trunk/Source/_javascript_Core/llint/LLIntData.h	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/_javascript_Core/llint/LLIntData.h	2012-08-30 22:21:48 UTC (rev 127199)
@@ -71,7 +71,7 @@
 
 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);

Modified: trunk/Source/_javascript_Core/llint/LLIntEntrypoints.cpp (127198 => 127199)


--- trunk/Source/_javascript_Core/llint/LLIntEntrypoints.cpp	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/_javascript_Core/llint/LLIntEntrypoints.cpp	2012-08-30 22:21:48 UTC (rev 127199)
@@ -52,6 +52,7 @@
         return;
     }
     
+#if ENABLE(JIT)
     if (kind == CodeForCall) {
         jitCode = JITCode(globalData.getCTIStub(functionForCallEntryThunkGenerator), JITCode::InterpreterThunk);
         arityCheck = globalData.getCTIStub(functionForCallArityCheckThunkGenerator).code();
@@ -61,6 +62,7 @@
     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 @@
         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 @@
         jitCode = JITCode(MacroAssemblerCodeRef::createLLIntCodeRef(llint_program_prologue), JITCode::InterpreterThunk);
         return;
     }
-    
+#if ENABLE(JIT)
     jitCode = JITCode(globalData.getCTIStub(programEntryThunkGenerator), JITCode::InterpreterThunk);
+#endif
 }
 
 } } // namespace JSC::LLInt

Modified: trunk/Source/_javascript_Core/llint/LLIntOffsetsExtractor.cpp (127198 => 127199)


--- trunk/Source/_javascript_Core/llint/LLIntOffsetsExtractor.cpp	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/_javascript_Core/llint/LLIntOffsetsExtractor.cpp	2012-08-30 22:21:48 UTC (rev 127199)
@@ -62,7 +62,7 @@
 
 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

Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (127198 => 127199)


--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2012-08-30 22:21:48 UTC (rev 127199)
@@ -256,6 +256,7 @@
     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 @@
         codeBlock->dontJITAnytimeSoon();
     LLINT_END_IMPL();
 }
+#endif // ENABLE(JIT)
 
 LLINT_SLOW_PATH_DECL(register_file_check)
 {

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalData.cpp (127198 => 127199)


--- trunk/Source/_javascript_Core/runtime/JSGlobalData.cpp	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalData.cpp	2012-08-30 22:21:48 UTC (rev 127199)
@@ -375,12 +375,13 @@
     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()
 {

Modified: trunk/Source/WTF/ChangeLog (127198 => 127199)


--- trunk/Source/WTF/ChangeLog	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/WTF/ChangeLog	2012-08-30 22:21:48 UTC (rev 127199)
@@ -1,3 +1,12 @@
+2012-08-30  Mark Lam  <[email protected]>
+
+        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  <[email protected]>
 
         objc_msgSend and IMP should be cast appropriately before using

Modified: trunk/Source/WTF/wtf/Platform.h (127198 => 127199)


--- trunk/Source/WTF/wtf/Platform.h	2012-08-30 22:13:25 UTC (rev 127198)
+++ trunk/Source/WTF/wtf/Platform.h	2012-08-30 22:21:48 UTC (rev 127199)
@@ -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
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to