LLInt C loop backend.
https://bugs.webkit.org/show_bug.cgi?id=91052.

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

Source/JavaScriptCore:

* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dump):
(JSC::CodeBlock::bytecodeOffset):
* interpreter/Interpreter.cpp:
(JSC::Interpreter::execute):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC):
* interpreter/Interpreter.h:
* jit/JITStubs.h:
(JITStackFrame):
(JSC):
* llint/LLIntCLoop.cpp: Added.
(JSC):
(LLInt):
(JSC::LLInt::CLoop::initialize):
(JSC::LLInt::CLoop::catchRoutineFor):
(JSC::LLInt::CLoop::hostCodeEntryFor):
(JSC::LLInt::CLoop::jsCodeEntryWithArityCheckFor):
(JSC::LLInt::CLoop::jsCodeEntryFor):
* llint/LLIntCLoop.h: Added.
(JSC):
(LLInt):
(CLoop):
* llint/LLIntData.cpp:
(JSC::LLInt::initialize):
* llint/LLIntData.h:
(JSC):
* llint/LLIntOfflineAsmConfig.h:
* llint/LLIntOpcode.h:
* llint/LLIntThunks.cpp:
(LLInt):
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter.cpp:
(LLInt):
(JSC::LLInt::Ints2Double):
(JSC):
(JSC::CLoop::execute):
* llint/LowLevelInterpreter.h:
(JSC):
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* offlineasm/asm.rb:
* offlineasm/backends.rb:
* offlineasm/cloop.rb: Added.
* offlineasm/instructions.rb:
* runtime/Executable.h:
(ExecutableBase):
(JSC::ExecutableBase::hostCodeEntryFor):
(JSC::ExecutableBase::jsCodeEntryFor):
(JSC::ExecutableBase::jsCodeWithArityCheckEntryFor):
(JSC::ExecutableBase::catchRoutineFor):
(NativeExecutable):
* runtime/JSValue.h:
(JSC):
(LLInt):
(JSValue):
* runtime/JSValueInlineMethods.h:
(JSC):
(JSC::JSValue::JSValue):
* runtime/Options.cpp:
(JSC::Options::initialize):

Source/WTF:

Added configs for the llint C loop backend.

* wtf/Platform.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127374 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp
index f2a0fa5..2e860de 100644
--- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp
+++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp
@@ -1550,6 +1550,10 @@
             dumpBytecodeCommentAndNewLine(location);
             break;
         }
+#if ENABLE(LLINT_C_LOOP)
+        default:
+            ASSERT(false); // We should never get here.
+#endif
     }
 }
 
@@ -2638,8 +2642,21 @@
     UNUSED_PARAM(exec);
     UNUSED_PARAM(returnAddress);
 #if ENABLE(LLINT)
+#if !ENABLE(LLINT_C_LOOP)
+    // When using the JIT, we could have addresses that are not bytecode
+    // addresses. We check if the return address is in the LLint glue and
+    // opcode handlers range here to ensure that we are looking at bytecode
+    // before attempting to convert the return address into a bytecode offset.
+    //
+    // In the case of the C Loop LLInt, the JIT is disabled, and the only
+    // valid return addresses should be bytecode PCs. So, we can and need to
+    // forego this check because when we do not ENABLE(COMPUTED_GOTO_OPCODES),
+    // then the bytecode "PC"s are actually the opcodeIDs and are not bounded
+    // by llint_begin and llint_end.
     if (returnAddress.value() >= LLInt::getCodePtr(llint_begin)
-        && returnAddress.value() <= LLInt::getCodePtr(llint_end)) {
+        && returnAddress.value() <= LLInt::getCodePtr(llint_end))
+#endif
+    {
         ASSERT(exec->codeBlock());
         ASSERT(exec->codeBlock() == this);
         ASSERT(JITCode::isBaselineCode(getJITType()));