Title: [156896] trunk/Source/_javascript_Core
Revision
156896
Author
[email protected]
Date
2013-10-04 11:20:40 -0700 (Fri, 04 Oct 2013)

Log Message

Add callOperation to Baseline JIT
https://bugs.webkit.org/show_bug.cgi?id=122306

Reviewed by Geoffrey Garen.

Created baseline JIT compatible versions for a few flavors of callOperation().
Migrated cti_op_new_regexp() and its caller to callOperation(operationNewRegexp()).

* dfg/DFGOperations.cpp: Moved operationNewRegexp() to JITOperations
* dfg/DFGOperations.h:
* jit/JIT.h:
(JSC::JIT::appendCall):
* jit/JITInlines.h:
(JSC::JIT::appendCallWithExceptionCheck):
(JSC::JIT::appendCallWithExceptionCheckSetJSValueResult):
(JSC::JIT::callOperation):
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_new_regexp):
* jit/JITOperations.cpp:
* jit/JITOperations.h:
* jit/JITStubs.cpp:
* jit/JITStubs.h:
* jit/JSInterfaceJIT.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (156895 => 156896)


--- trunk/Source/_javascript_Core/ChangeLog	2013-10-04 18:20:19 UTC (rev 156895)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-10-04 18:20:40 UTC (rev 156896)
@@ -1,3 +1,29 @@
+2013-10-04  Michael Saboff  <[email protected]>
+
+        Add callOperation to Baseline JIT
+        https://bugs.webkit.org/show_bug.cgi?id=122306
+
+        Reviewed by Geoffrey Garen.
+
+        Created baseline JIT compatible versions for a few flavors of callOperation().
+        Migrated cti_op_new_regexp() and its caller to callOperation(operationNewRegexp()).
+
+        * dfg/DFGOperations.cpp: Moved operationNewRegexp() to JITOperations
+        * dfg/DFGOperations.h:
+        * jit/JIT.h:
+        (JSC::JIT::appendCall):
+        * jit/JITInlines.h:
+        (JSC::JIT::appendCallWithExceptionCheck):
+        (JSC::JIT::appendCallWithExceptionCheckSetJSValueResult):
+        (JSC::JIT::callOperation):
+        * jit/JITOpcodes.cpp:
+        (JSC::JIT::emit_op_new_regexp):
+        * jit/JITOperations.cpp:
+        * jit/JITOperations.h:
+        * jit/JITStubs.cpp:
+        * jit/JITStubs.h:
+        * jit/JSInterfaceJIT.h:
+
 2013-10-03  Mark Rowe  <[email protected]>
 
         REGRESSION (r156811): WebCore rebuilds from scratch when doing an incremental build

Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.cpp (156895 => 156896)


--- trunk/Source/_javascript_Core/dfg/DFGOperations.cpp	2013-10-04 18:20:19 UTC (rev 156895)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.cpp	2013-10-04 18:20:40 UTC (rev 156896)
@@ -745,19 +745,6 @@
     return newTypedArrayWithOneArgument<JSFloat64Array>(exec, structure, encodedValue);
 }
 
-EncodedJSValue JIT_OPERATION operationNewRegexp(ExecState* exec, void* regexpPtr)
-{
-    VM& vm = exec->vm();
-    NativeCallFrameTracer tracer(&vm, exec);
-    RegExp* regexp = static_cast<RegExp*>(regexpPtr);
-    if (!regexp->isValid()) {
-        vm.throwException(exec, createSyntaxError(exec, "Invalid flags supplied to RegExp constructor."));
-        return JSValue::encode(jsUndefined());
-    }
-    
-    return JSValue::encode(RegExpObject::create(vm, exec->lexicalGlobalObject()->regExpStructure(), regexp));
-}
-
 JSCell* JIT_OPERATION operationCreateActivation(ExecState* exec)
 {
     VM& vm = exec->vm();

Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.h (156895 => 156896)


--- trunk/Source/_javascript_Core/dfg/DFGOperations.h	2013-10-04 18:20:19 UTC (rev 156895)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.h	2013-10-04 18:20:40 UTC (rev 156896)
@@ -74,7 +74,6 @@
 char* JIT_OPERATION operationNewFloat32ArrayWithOneArgument(ExecState*, Structure*, EncodedJSValue) WTF_INTERNAL;
 char* JIT_OPERATION operationNewFloat64ArrayWithSize(ExecState*, Structure*, int32_t) WTF_INTERNAL;
 char* JIT_OPERATION operationNewFloat64ArrayWithOneArgument(ExecState*, Structure*, EncodedJSValue) WTF_INTERNAL;
-EncodedJSValue JIT_OPERATION operationNewRegexp(ExecState*, void*) WTF_INTERNAL;
 void JIT_OPERATION operationPutByValStrict(ExecState*, EncodedJSValue encodedBase, EncodedJSValue encodedProperty, EncodedJSValue encodedValue) WTF_INTERNAL;
 void JIT_OPERATION operationPutByValNonStrict(ExecState*, EncodedJSValue encodedBase, EncodedJSValue encodedProperty, EncodedJSValue encodedValue) WTF_INTERNAL;
 void JIT_OPERATION operationPutByValCellStrict(ExecState*, JSCell*, EncodedJSValue encodedProperty, EncodedJSValue encodedValue) WTF_INTERNAL;

Modified: trunk/Source/_javascript_Core/jit/JIT.h (156895 => 156896)


--- trunk/Source/_javascript_Core/jit/JIT.h	2013-10-04 18:20:19 UTC (rev 156895)
+++ trunk/Source/_javascript_Core/jit/JIT.h	2013-10-04 18:20:40 UTC (rev 156896)
@@ -421,6 +421,14 @@
         CodeRef privateCompileCTINativeCall(VM*, NativeFunction);
         void privateCompilePatchGetArrayLength(ReturnAddressPtr returnAddress);
 
+        // Add a call out from JIT code, without an exception check.
+        Call appendCall(const FunctionPtr& function)
+        {
+            Call functionCall = call();
+            m_calls.append(CallRecord(functionCall, m_bytecodeOffset, function.value()));
+            return functionCall;
+        }
+
         void exceptionCheck(Jump jumpToHandler)
         {
             m_exceptionChecks.append(jumpToHandler);
@@ -850,6 +858,12 @@
         }
         void linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator&, int virtualRegisterIndex);
 
+        MacroAssembler::Call appendCallWithExceptionCheck(const FunctionPtr&);
+        MacroAssembler::Call appendCallWithExceptionCheckSetJSValueResult(const FunctionPtr&, int);
+        MacroAssembler::Call callOperation(J_JITOperation_E, int);
+        MacroAssembler::Call callOperation(J_JITOperation_EP, int, void*);
+        MacroAssembler::Call callOperation(V_JITOperation_EP, void*);
+
         Jump checkStructure(RegisterID reg, Structure* structure);
 
         void restoreArgumentReferenceForTrampoline();

Modified: trunk/Source/_javascript_Core/jit/JITInlines.h (156895 => 156896)


--- trunk/Source/_javascript_Core/jit/JITInlines.h	2013-10-04 18:20:19 UTC (rev 156895)
+++ trunk/Source/_javascript_Core/jit/JITInlines.h	2013-10-04 18:20:40 UTC (rev 156896)
@@ -204,6 +204,43 @@
     // In the trampoline on x86-64, the first argument register is not overwritten.
 }
 
+ALWAYS_INLINE MacroAssembler::Call JIT::appendCallWithExceptionCheck(const FunctionPtr& function)
+{
+    updateTopCallFrame();
+    MacroAssembler::Call call = appendCall(function);
+    exceptionCheck();
+    return call;
+}
+
+ALWAYS_INLINE MacroAssembler::Call JIT::appendCallWithExceptionCheckSetJSValueResult(const FunctionPtr& function, int dst)
+{
+    MacroAssembler::Call call = appendCallWithExceptionCheck(function);
+#if USE(JSVALUE64)
+    emitPutVirtualRegister(dst, returnValueRegister);
+#else
+    emitStore(dst, returnValue2Register, returnValueRegister);
+#endif
+    return call;
+}
+
+ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_E operation, int dst)
+{
+    setupArgumentsExecState();
+    return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
+}
+
+ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EP operation, int dst, void* pointer)
+{
+    setupArgumentsWithExecState(TrustedImmPtr(pointer));
+    return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
+}
+
+ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EP operation, void* pointer)
+{
+    setupArgumentsWithExecState(TrustedImmPtr(pointer));
+    return appendCallWithExceptionCheck(operation);
+}
+    
 ALWAYS_INLINE JIT::Jump JIT::checkStructure(RegisterID reg, Structure* structure)
 {
     return branchPtr(NotEqual, Address(reg, JSCell::structureOffset()), TrustedImmPtr(structure));

Modified: trunk/Source/_javascript_Core/jit/JITOpcodes.cpp (156895 => 156896)


--- trunk/Source/_javascript_Core/jit/JITOpcodes.cpp	2013-10-04 18:20:19 UTC (rev 156895)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes.cpp	2013-10-04 18:20:40 UTC (rev 156896)
@@ -1211,9 +1211,7 @@
 
 void JIT::emit_op_new_regexp(Instruction* currentInstruction)
 {
-    JITStubCall stubCall(this, cti_op_new_regexp);
-    stubCall.addArgument(TrustedImmPtr(m_codeBlock->regexp(currentInstruction[2].u.operand)));
-    stubCall.call(currentInstruction[1].u.operand);
+    callOperation(operationNewRegexp, currentInstruction[1].u.operand, m_codeBlock->regexp(currentInstruction[2].u.operand));
 }
 
 void JIT::emit_op_new_func(Instruction* currentInstruction)

Modified: trunk/Source/_javascript_Core/jit/JITOperations.cpp (156895 => 156896)


--- trunk/Source/_javascript_Core/jit/JITOperations.cpp	2013-10-04 18:20:19 UTC (rev 156895)
+++ trunk/Source/_javascript_Core/jit/JITOperations.cpp	2013-10-04 18:20:40 UTC (rev 156896)
@@ -27,6 +27,7 @@
 #include "JITOperations.h"
 
 #include "CommonSlowPaths.h"
+#include "Error.h"
 #include "GetterSetter.h"
 #include "HostCallReturnValue.h"
 #include "JITOperationWrappers.h"
@@ -587,6 +588,19 @@
     return virtualFor(execCallee, CodeForConstruct);
 }
 
+EncodedJSValue JIT_OPERATION operationNewRegexp(ExecState* exec, void* regexpPtr)
+{
+    VM& vm = exec->vm();
+    NativeCallFrameTracer tracer(&vm, exec);
+    RegExp* regexp = static_cast<RegExp*>(regexpPtr);
+    if (!regexp->isValid()) {
+        vm.throwException(exec, createSyntaxError(exec, "Invalid flags supplied to RegExp constructor."));
+        return JSValue::encode(jsUndefined());
+    }
+
+    return JSValue::encode(RegExpObject::create(vm, exec->lexicalGlobalObject()->regExpStructure(), regexp));
+}
+
 JITHandlerEncoded JIT_OPERATION lookupExceptionHandler(ExecState* exec)
 {
     VM* vm = &exec->vm();

Modified: trunk/Source/_javascript_Core/jit/JITOperations.h (156895 => 156896)


--- trunk/Source/_javascript_Core/jit/JITOperations.h	2013-10-04 18:20:19 UTC (rev 156895)
+++ trunk/Source/_javascript_Core/jit/JITOperations.h	2013-10-04 18:20:40 UTC (rev 156896)
@@ -101,6 +101,7 @@
 typedef void JIT_OPERATION (*V_JITOperation_E)(ExecState*);
 typedef void JIT_OPERATION (*V_JITOperation_EOZD)(ExecState*, JSObject*, int32_t, double);
 typedef void JIT_OPERATION (*V_JITOperation_EOZJ)(ExecState*, JSObject*, int32_t, EncodedJSValue);
+typedef void JIT_OPERATION (*V_JITOperation_EP)(ExecState*, void*);
 typedef void JIT_OPERATION (*V_JITOperation_EC)(ExecState*, JSCell*);
 typedef void JIT_OPERATION (*V_JITOperation_ECIcf)(ExecState*, JSCell*, InlineCallFrame*);
 typedef void JIT_OPERATION (*V_JITOperation_ECCIcf)(ExecState*, JSCell*, JSCell*, InlineCallFrame*);
@@ -198,6 +199,7 @@
 char* JIT_OPERATION operationLinkClosureCall(ExecState*) WTF_INTERNAL;
 char* JIT_OPERATION operationVirtualConstruct(ExecState*) WTF_INTERNAL;
 char* JIT_OPERATION operationLinkConstruct(ExecState*) WTF_INTERNAL;
+EncodedJSValue JIT_OPERATION operationNewRegexp(ExecState*, void*) WTF_INTERNAL;
 
 }
 

Modified: trunk/Source/_javascript_Core/jit/JITStubs.cpp (156895 => 156896)


--- trunk/Source/_javascript_Core/jit/JITStubs.cpp	2013-10-04 18:20:19 UTC (rev 156895)
+++ trunk/Source/_javascript_Core/jit/JITStubs.cpp	2013-10-04 18:20:40 UTC (rev 156896)
@@ -1936,21 +1936,6 @@
     return func;
 }
 
-DEFINE_STUB_FUNCTION(JSObject*, op_new_regexp)
-{
-    STUB_INIT_STACK_FRAME(stackFrame);
-
-    CallFrame* callFrame = stackFrame.callFrame;
-
-    RegExp* regExp = stackFrame.args[0].regExp();
-    if (!regExp->isValid()) {
-        stackFrame.vm->throwException(callFrame, createSyntaxError(callFrame, "Invalid flags supplied to RegExp constructor."));
-        VM_THROW_EXCEPTION();
-    }
-
-    return RegExpObject::create(*stackFrame.vm, stackFrame.callFrame->lexicalGlobalObject()->regExpStructure(), regExp);
-}
-
 DEFINE_STUB_FUNCTION(EncodedJSValue, op_call_eval)
 {
     STUB_INIT_STACK_FRAME(stackFrame);

Modified: trunk/Source/_javascript_Core/jit/JITStubs.h (156895 => 156896)


--- trunk/Source/_javascript_Core/jit/JITStubs.h	2013-10-04 18:20:19 UTC (rev 156895)
+++ trunk/Source/_javascript_Core/jit/JITStubs.h	2013-10-04 18:20:40 UTC (rev 156896)
@@ -357,7 +357,6 @@
 JSObject* JIT_STUB cti_op_new_func(STUB_ARGS_DECLARATION) WTF_INTERNAL;
 JSObject* JIT_STUB cti_op_new_func_exp(STUB_ARGS_DECLARATION) WTF_INTERNAL;
 JSObject* JIT_STUB cti_op_new_object(STUB_ARGS_DECLARATION) WTF_INTERNAL;
-JSObject* JIT_STUB cti_op_new_regexp(STUB_ARGS_DECLARATION) WTF_INTERNAL;
 JSObject* JIT_STUB cti_op_push_activation(STUB_ARGS_DECLARATION) WTF_INTERNAL;
 void JIT_STUB cti_op_push_name_scope(STUB_ARGS_DECLARATION) WTF_INTERNAL;
 void JIT_STUB cti_op_push_with_scope(STUB_ARGS_DECLARATION) WTF_INTERNAL;

Modified: trunk/Source/_javascript_Core/jit/JSInterfaceJIT.h (156895 => 156896)


--- trunk/Source/_javascript_Core/jit/JSInterfaceJIT.h	2013-10-04 18:20:19 UTC (rev 156895)
+++ trunk/Source/_javascript_Core/jit/JSInterfaceJIT.h	2013-10-04 18:20:40 UTC (rev 156896)
@@ -29,6 +29,7 @@
 #include "BytecodeConventions.h"
 #include "CCallHelpers.h"
 #include "JITCode.h"
+#include "JITOperations.h"
 #include "JITStubs.h"
 #include "JSCJSValue.h"
 #include "JSStack.h"
@@ -61,6 +62,7 @@
         // however the code will still function correctly.
 #if CPU(X86_64)
         static const RegisterID returnValueRegister = X86Registers::eax;
+        static const RegisterID returnValue2Register = X86Registers::edx;
         static const RegisterID cachedResultRegister = X86Registers::eax;
 #if !OS(WINDOWS)
         static const RegisterID firstArgumentRegister = X86Registers::edi;
@@ -89,6 +91,7 @@
         static const RegisterID nonArgGPR1 = X86Registers::eax; // regT0
 #elif CPU(X86)
         static const RegisterID returnValueRegister = X86Registers::eax;
+        static const RegisterID returnValue2Register = X86Registers::edx;
         static const RegisterID cachedResultRegister = X86Registers::eax;
         // On x86 we always use fastcall conventions = but on
         // OS X if might make more sense to just use regparm.
@@ -109,6 +112,7 @@
         static const FPRegisterID fpRegT3 = X86Registers::xmm3;
 #elif CPU(ARM)
         static const RegisterID returnValueRegister = ARMRegisters::r0;
+        static const RegisterID returnValue2Register = ARMRegisters::r1;
         static const RegisterID cachedResultRegister = ARMRegisters::r0;
         static const RegisterID firstArgumentRegister = ARMRegisters::r0;
         static const RegisterID secondArgumentRegister = ARMRegisters::r1;
@@ -131,6 +135,7 @@
         static const FPRegisterID fpRegT3 = ARMRegisters::d3;
 #elif CPU(MIPS)
         static const RegisterID returnValueRegister = MIPSRegisters::v0;
+        static const RegisterID returnValue2Register = MIPSRegisters::v1;
         static const RegisterID cachedResultRegister = MIPSRegisters::v0;
         static const RegisterID firstArgumentRegister = MIPSRegisters::a0;
         static const RegisterID secondArgumentRegister = MIPSRegisters::a1;
@@ -169,6 +174,7 @@
         static const RegisterID secondArgumentRegister = regT5;
 
         static const RegisterID returnValueRegister = SH4Registers::r0;
+        static const RegisterID returnValue2Register = SH4Registers::r1;
         static const RegisterID cachedResultRegister = SH4Registers::r0;
 
         static const FPRegisterID fpRegT0 = SH4Registers::dr0;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to