summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/llint/LLIntThunks.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/llint/LLIntThunks.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/JavaScriptCore/llint/LLIntThunks.cpp')
-rw-r--r--Source/JavaScriptCore/llint/LLIntThunks.cpp85
1 files changed, 31 insertions, 54 deletions
diff --git a/Source/JavaScriptCore/llint/LLIntThunks.cpp b/Source/JavaScriptCore/llint/LLIntThunks.cpp
index 9429e6cb5..a9fa7dd65 100644
--- a/Source/JavaScriptCore/llint/LLIntThunks.cpp
+++ b/Source/JavaScriptCore/llint/LLIntThunks.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2013, 2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,19 +29,25 @@
#include "CallData.h"
#include "ExceptionHelpers.h"
#include "Interpreter.h"
+#include "JSCJSValueInlines.h"
#include "JSInterfaceJIT.h"
#include "JSObject.h"
-#include "JSStackInlines.h"
#include "LLIntCLoop.h"
+#include "LLIntData.h"
#include "LinkBuffer.h"
#include "LowLevelInterpreter.h"
#include "ProtoCallFrame.h"
+#include "StackAlignment.h"
#include "VM.h"
namespace JSC {
+EncodedJSValue JS_EXPORT_PRIVATE vmEntryToWasm(void* code, VM* vm, ProtoCallFrame* frame)
+{
+ return vmEntryToJavaScript(code, vm, frame);
+}
+
#if ENABLE(JIT)
-#if ENABLE(LLINT)
namespace LLInt {
@@ -53,100 +59,71 @@ static MacroAssemblerCodeRef generateThunkWithJumpTo(VM* vm, void (*target)(), c
jit.move(JSInterfaceJIT::TrustedImmPtr(bitwise_cast<void*>(target)), JSInterfaceJIT::regT0);
jit.jump(JSInterfaceJIT::regT0);
- LinkBuffer patchBuffer(*vm, &jit, GLOBAL_THUNK_ID);
+ LinkBuffer patchBuffer(*vm, jit, GLOBAL_THUNK_ID);
return FINALIZE_CODE(patchBuffer, ("LLInt %s prologue thunk", thunkKind));
}
MacroAssemblerCodeRef functionForCallEntryThunkGenerator(VM* vm)
{
- return generateThunkWithJumpTo(vm, llint_function_for_call_prologue, "function for call");
+ return generateThunkWithJumpTo(vm, LLInt::getCodeFunctionPtr(llint_function_for_call_prologue), "function for call");
}
MacroAssemblerCodeRef functionForConstructEntryThunkGenerator(VM* vm)
{
- return generateThunkWithJumpTo(vm, llint_function_for_construct_prologue, "function for construct");
+ return generateThunkWithJumpTo(vm, LLInt::getCodeFunctionPtr(llint_function_for_construct_prologue), "function for construct");
}
MacroAssemblerCodeRef functionForCallArityCheckThunkGenerator(VM* vm)
{
- return generateThunkWithJumpTo(vm, llint_function_for_call_arity_check, "function for call with arity check");
+ return generateThunkWithJumpTo(vm, LLInt::getCodeFunctionPtr(llint_function_for_call_arity_check), "function for call with arity check");
}
MacroAssemblerCodeRef functionForConstructArityCheckThunkGenerator(VM* vm)
{
- return generateThunkWithJumpTo(vm, llint_function_for_construct_arity_check, "function for construct with arity check");
+ return generateThunkWithJumpTo(vm, LLInt::getCodeFunctionPtr(llint_function_for_construct_arity_check), "function for construct with arity check");
}
MacroAssemblerCodeRef evalEntryThunkGenerator(VM* vm)
{
- return generateThunkWithJumpTo(vm, llint_eval_prologue, "eval");
+ return generateThunkWithJumpTo(vm, LLInt::getCodeFunctionPtr(llint_eval_prologue), "eval");
}
MacroAssemblerCodeRef programEntryThunkGenerator(VM* vm)
{
- return generateThunkWithJumpTo(vm, llint_program_prologue, "program");
+ return generateThunkWithJumpTo(vm, LLInt::getCodeFunctionPtr(llint_program_prologue), "program");
+}
+
+MacroAssemblerCodeRef moduleProgramEntryThunkGenerator(VM* vm)
+{
+ return generateThunkWithJumpTo(vm, LLInt::getCodeFunctionPtr(llint_module_program_prologue), "module_program");
}
} // namespace LLInt
-#endif // ENABLE(LLINT)
#else // ENABLE(JIT)
// Non-JIT (i.e. C Loop LLINT) case:
-typedef JSValue (*ExecuteCode) (CallFrame*, void* executableAddress);
-
-template<ExecuteCode execute>
-EncodedJSValue doCallToJavaScript(void* executableAddress, ProtoCallFrame* protoCallFrame)
+EncodedJSValue vmEntryToJavaScript(void* executableAddress, VM* vm, ProtoCallFrame* protoCallFrame)
{
- CodeBlock* codeBlock = protoCallFrame->codeBlock();
- JSScope* scope = protoCallFrame->scope();
- JSObject* callee = protoCallFrame->callee();
- int argCountIncludingThis = protoCallFrame->argumentCountIncludingThis();
- int argCount = protoCallFrame->argumentCount();
- JSValue thisValue = protoCallFrame->thisValue();
- JSStack& stack = scope->vm()->interpreter->stack();
-
- CallFrame* newCallFrame = stack.pushFrame(codeBlock, scope, argCountIncludingThis, callee);
- if (UNLIKELY(!newCallFrame)) {
- JSGlobalObject* globalObject = scope->globalObject();
- ExecState* exec = globalObject->globalExec();
- return JSValue::encode(throwStackOverflowError(exec));
- }
-
- // Set the arguments for the callee:
- newCallFrame->setThisValue(thisValue);
- for (int i = 0; i < argCount; ++i)
- newCallFrame->setArgument(i, protoCallFrame->argument(i));
-
- JSValue result = execute(newCallFrame, executableAddress);
-
- stack.popFrame(newCallFrame);
-
+ JSValue result = CLoop::execute(llint_vm_entry_to_javascript, executableAddress, vm, protoCallFrame);
return JSValue::encode(result);
}
-static inline JSValue executeJS(CallFrame* newCallFrame, void* executableAddress)
-{
- Opcode entryOpcode = *reinterpret_cast<Opcode*>(&executableAddress);
- return CLoop::execute(newCallFrame, entryOpcode);
-}
-
-EncodedJSValue callToJavaScript(void* executableAddress, ExecState**, ProtoCallFrame* protoCallFrame, Register*)
+EncodedJSValue vmEntryToNative(void* executableAddress, VM* vm, ProtoCallFrame* protoCallFrame)
{
- return doCallToJavaScript<executeJS>(executableAddress, protoCallFrame);
+ JSValue result = CLoop::execute(llint_vm_entry_to_native, executableAddress, vm, protoCallFrame);
+ return JSValue::encode(result);
}
-static inline JSValue executeNative(CallFrame* newCallFrame, void* executableAddress)
+extern "C" VMEntryRecord* vmEntryRecord(VMEntryFrame* entryFrame)
{
- NativeFunction function = reinterpret_cast<NativeFunction>(executableAddress);
- return JSValue::decode(function(newCallFrame));
+ // The C Loop doesn't have any callee save registers, so the VMEntryRecord is allocated at the base of the frame.
+ intptr_t stackAlignment = stackAlignmentBytes();
+ intptr_t VMEntryTotalFrameSize = (sizeof(VMEntryRecord) + (stackAlignment - 1)) & ~(stackAlignment - 1);
+ return reinterpret_cast<VMEntryRecord*>(reinterpret_cast<char*>(entryFrame) - VMEntryTotalFrameSize);
}
-EncodedJSValue callToNativeFunction(void* executableAddress, ExecState**, ProtoCallFrame* protoCallFrame, Register*)
-{
- return doCallToJavaScript<executeNative>(executableAddress, protoCallFrame);
-}
#endif // ENABLE(JIT)