Procházet zdrojové kódy

Remove jit support for AsmJsFunctionEntry trace

Michael Ferris před 9 roky
rodič
revize
09d7a4e0f5

+ 1 - 116
lib/Backend/IRBuilderAsmJs.cpp

@@ -127,13 +127,6 @@ IRBuilderAsmJs::Build()
         BuildImplicitArgIns();
     }
 
-#ifdef ENABLE_DEBUG_CONFIG_OPTIONS
-    if (!this->IsLoopBody() && PHASE_TRACE(Js::AsmjsFunctionEntryPhase, m_func))
-    {
-        BuildArgInTracing();
-    }
-#endif
-
     if (m_statementReader.AtStatementBoundary(&m_jnReader))
     {
         statementIndex = AddStatementBoundary(statementIndex, offset);
@@ -931,110 +924,6 @@ IRBuilderAsmJs::BuildImplicitArgIns()
     }
 }
 
-#ifdef ENABLE_DEBUG_CONFIG_OPTIONS
-void
-IRBuilderAsmJs::BuildArgInTracing()
-{
-    // todo:: fix implementation on x64
-#ifdef _M_IX86
-    int32 intArgInCount = 0;
-    int32 int64ArgInCount = 0;
-    int32 floatArgInCount = 0;
-    int32 doubleArgInCount = 0;
-    int32 simd128ArgInCount = 0;
-
-    Js::ArgSlot nArgs = 0;
-    if (m_func->GetJITFunctionBody()->HasImplicitArgIns())
-    {
-        // -1 to remove the implicit this pointer
-        nArgs = m_func->GetJITFunctionBody()->GetInParamsCount() - 1;
-    }
-    int32 argSize = 0;
-    Js::ArgSlot argOutSlot = 1;
-
-    // Start Call
-    IR::RegOpnd * dstOpnd = IR::RegOpnd::New(TyVar, m_func);
-    IR::IntConstOpnd * argSizeOpnd = IR::IntConstOpnd::New(nArgs, TyInt32, m_func);
-    IR::Instr *instr = IR::Instr::New(Js::OpCode::StartCall, dstOpnd, argSizeOpnd, m_func);
-
-    AddInstr(instr, Js::Constants::NoByteCodeOffset);
-
-    m_argStack->Push(instr);
-
-    auto PushArg = [&](IRType type, ValueType valueType, IR::Opnd* srcOpnd) {
-        StackSym* symDst = StackSym::NewArgSlotSym(argOutSlot++, m_func, type);
-        symDst->m_allocated = true;
-        IR::SymOpnd * dstOpnd = IR::SymOpnd::New(symDst, type, m_func);
-        dstOpnd->SetValueType(valueType);
-        IR::Instr * instr = IR::Instr::New(Js::OpCode::ArgOut_A, dstOpnd, srcOpnd, m_func);
-
-        AddInstr(instr, Js::Constants::NoByteCodeOffset);
-        m_argStack->Push(instr);
-        argSize += max(TySize[type], MachPtr);
-    };
-
-    // Move the function object as an argument
-    {
-        StackSym* stackSym = StackSym::New(m_func);
-        IR::RegOpnd* stackOpnd = IR::RegOpnd::New(stackSym, TyVar, m_func);
-        AddInstr(IR::Instr::New(Js::OpCode::LdFuncObj, stackOpnd, m_func), Js::Constants::NoByteCodeOffset);
-
-        PushArg(TyVar, ValueType::GetObject(ObjectType::Object), stackOpnd);
-    }
-    PushArg(TyInt32, ValueType::GetInt(false), IR::IntConstOpnd::New(nArgs, TyInt32, m_func));
-
-    for (Js::ArgSlot i = 0; i < nArgs; ++i)
-    {
-        IRType argType;
-        Js::RegSlot argSlot;
-        ValueType valueType;
-        Js::AsmJsVarType varType = m_asmFuncInfo->GetArgType(i);
-        switch (varType.which())
-        {
-        case Js::AsmJsVarType::Which::Int:
-            argType = TyInt32;
-            argSlot = GetFirstVar(WAsmJs::INT32) + intArgInCount;
-            valueType = ValueType::GetInt(false);
-            ++intArgInCount;
-            break;
-        case Js::AsmJsVarType::Which::Float:
-            argType = TyFloat32;
-            argSlot = GetFirstVar(WAsmJs::FLOAT32) + floatArgInCount;
-            valueType = ValueType::Float;
-            ++floatArgInCount;
-            break;
-        case Js::AsmJsVarType::Which::Double:
-            argType = TyFloat64;
-            argSlot = GetFirstVar(WAsmJs::FLOAT64) + doubleArgInCount;
-            valueType = ValueType::Float;
-            ++doubleArgInCount;
-            break;
-        case Js::AsmJsVarType::Which::Int64:
-            argType = TyInt64;
-            argSlot = GetFirstVar(WAsmJs::INT64) + int64ArgInCount;
-            valueType = ValueType::GetInt(false);
-            ++int64ArgInCount;
-            break;
-        default:
-            // SIMD_JS
-            GetSimdTypesFromAsmType((Js::AsmJsType::Which)varType.which(), &argType, &valueType);
-            argSlot = GetFirstVar(WAsmJs::SIMD) + simd128ArgInCount;
-            ++simd128ArgInCount;
-            break;
-        }
-
-        PushArg(TyInt32, ValueType::GetInt(false), IR::IntConstOpnd::New((int32)argType, TyInt32, m_func));
-        PushArg(argType, valueType, BuildSrcOpnd(argSlot, argType));
-    }
-
-    // save this so we can calculate arg offsets later on
-    m_argOffsetStack->Push(argSize);
-    argSizeOpnd->SetValue(argSize);
-    BuildAsmCall(Js::OpCodeAsmJs::AsmJsEntryTracing, Js::Constants::NoByteCodeOffset, nArgs * 2 + 1, 0, 0, 0);
-#endif
-}
-#endif
-
 void
 IRBuilderAsmJs::InsertLabels()
 {
@@ -1771,10 +1660,6 @@ IRBuilderAsmJs::BuildAsmCall(Js::OpCodeAsmJs newOpcode, uint32 offset, Js::ArgSl
 
         instr = IR::Instr::New(Js::OpCode::AsmJsCallE, dstOpnd, srcOpnd, m_func);
         break;
-    case Js::OpCodeAsmJs::AsmJsEntryTracing:
-        argOffset = m_argOffsetStack->Pop();
-        instr = IR::Instr::New(Js::OpCode::AsmJsEntryTracing, m_func);
-        break;
     default:
         Assume(UNREACHED);
     }
@@ -1785,7 +1670,7 @@ IRBuilderAsmJs::BuildAsmCall(Js::OpCodeAsmJs newOpcode, uint32 offset, Js::ArgSl
 
     for (argInstr = m_argStack->Pop(); argInstr && argInstr->m_opcode != Js::OpCode::StartCall; argInstr = m_argStack->Pop())
     {
-        if (newOpcode == Js::OpCodeAsmJs::I_Call || newOpcode == Js::OpCodeAsmJs::AsmJsEntryTracing)
+        if (newOpcode == Js::OpCodeAsmJs::I_Call)
         {
 #if _M_IX86
             argOffset -= argInstr->GetDst()->GetSize();

+ 0 - 3
lib/Backend/IRBuilderAsmJs.h

@@ -84,9 +84,6 @@ private:
     void                    CreateLoadConstInstrForType(byte* table, Js::RegSlot& regAllocated, uint32 constCount, uint32 offset, IRType irType, ValueType valueType, Js::OpCode opcode, F extraProcess);
     void                    BuildConstantLoads();
     void                    BuildImplicitArgIns();
-#ifdef ENABLE_DEBUG_CONFIG_OPTIONS
-    void                    BuildArgInTracing();
-#endif
     void                    InsertLabels();
     IR::LabelInstr *        CreateLabel(IR::BranchInstr * branchInstr, uint& offset);
 #if DBG

+ 0 - 4
lib/Backend/JnHelperMethodList.h

@@ -556,10 +556,6 @@ HELPERCALL(UI64TOF64,       Js::JavascriptConversion::ULongToDouble,       0)
 HELPERCALL(I64TOF32,        Js::JavascriptConversion::LongToFloat,         0)
 HELPERCALL(UI64TOF32,       Js::JavascriptConversion::ULongToFloat,        0)
 
-#if (defined(ASMJS_PLAT) || defined(ENABLE_WASM)) && defined(ENABLE_DEBUG_CONFIG_OPTIONS)
-HELPERCALL(TraceAsmJsArgIn, WAsmJs::TraceAsmJsArgsIn, 0)
-#endif
-
 #ifdef _M_IX86
 HELPERCALL(DirectMath_Acos, nullptr, 0)
 HELPERCALL(DirectMath_Asin, nullptr, 0)

+ 0 - 1
lib/Backend/Lower.cpp

@@ -843,7 +843,6 @@ Lowerer::LowerRange(IR::Instr *instrStart, IR::Instr *instrEnd, bool defaultDoFa
             }
             break;
         }
-        case Js::OpCode::AsmJsEntryTracing:
         case Js::OpCode::AsmJsCallI:
             m_lowererMD.LowerAsmJsCallI(instr);
             break;

+ 3 - 12
lib/Backend/amd64/LowererMDArch.cpp

@@ -543,7 +543,7 @@ LowererMDArch::LowerCallArgs(IR::Instr *callInstr, ushort callFlags, Js::ArgSlot
     // Machine dependent lowering
     //
 
-    if (callInstr->m_opcode != Js::OpCode::AsmJsCallI && callInstr->m_opcode != Js::OpCode::AsmJsEntryTracing)
+    if (callInstr->m_opcode != Js::OpCode::AsmJsCallI)
     {
         // Push argCount
         IR::IntConstOpnd *argCountOpnd = Lowerer::MakeCallInfoConst(callFlags, argCount, m_func);
@@ -561,17 +561,8 @@ LowererMDArch::LowerCallArgs(IR::Instr *callInstr, ushort callFlags, Js::ArgSlot
 
     if (m_func->GetJITFunctionBody()->IsAsmJsMode())
     {
-#ifdef ENABLE_DEBUG_CONFIG_OPTIONS
-        if (callInstr->m_opcode == Js::OpCode::AsmJsEntryTracing)
-        {
-            callInstr = this->lowererMD->ChangeToHelperCall(callInstr, IR::HelperTraceAsmJsArgIn);
-        }
-        else
-#endif
-        {
-            IR::Opnd * functionObjOpnd = callInstr->UnlinkSrc1();
-            GeneratePreCall(callInstr, functionObjOpnd, cfgInsertLoc->GetNextRealInstr());
-        }
+        IR::Opnd * functionObjOpnd = callInstr->UnlinkSrc1();
+        GeneratePreCall(callInstr, functionObjOpnd, cfgInsertLoc->GetNextRealInstr());
     }
 
     return argSlots;

+ 0 - 15
lib/Backend/i386/LowererMDArch.cpp

@@ -835,21 +835,6 @@ LowererMDArch::LowerAsmJsCallI(IR::Instr * callInstr)
     const uint32 argSlots = argCount + (stackAlignment / 4) + 1;
     m_func->m_argSlotsForFunctionsCalled = max(m_func->m_argSlotsForFunctionsCalled, argSlots);
 
-#ifdef ENABLE_DEBUG_CONFIG_OPTIONS
-    if (callInstr->m_opcode == Js::OpCode::AsmJsEntryTracing)
-    {
-        callInstr = this->lowererMD->ChangeToHelperCall(callInstr, IR::HelperTraceAsmJsArgIn);
-        //     lea esp, [esp + sizeValue]
-        IR::IntConstOpnd * sizeOpnd = startCallInstr->GetSrc1()->AsIntConstOpnd();
-
-        IntConstType sizeValue = sizeOpnd->GetValue() + stackAlignment;
-        IR::RegOpnd * espOpnd = IR::RegOpnd::New(nullptr, this->GetRegStackPointer(), TyMachReg, m_func);
-        IR::Instr * fixStack = IR::Instr::New(Js::OpCode::LEA, espOpnd, IR::IndirOpnd::New(espOpnd, sizeValue, TyMachReg, m_func), m_func);
-        callInstr->InsertAfter(fixStack);
-        return fixStack;
-    }
-#endif
-
     IR::Opnd * functionObjOpnd = callInstr->UnlinkSrc1();
 
     // we will not have function object mem ref in the case of function table calls, so we cannot calculate the call address ahead of time

+ 0 - 2
lib/Runtime/ByteCode/OpCodes.h

@@ -752,8 +752,6 @@ MACRO_BACKEND_ONLY(     Unreachable_Void,   Empty,          OpSideEffect)
 MACRO_BACKEND_ONLY(     TrapIfMinIntOverNegOne, Reg3,       OpSideEffect)
 MACRO_BACKEND_ONLY(     TrapIfZero,         Reg3,           OpSideEffect)
 
-MACRO_BACKEND_ONLY(     AsmJsEntryTracing, Empty, None)
-
 // All SIMD ops are backend only for non-asmjs.
 #define MACRO_SIMD(opcode, asmjsLayout, opCodeAttrAsmJs, OpCodeAttr, ...) MACRO_BACKEND_ONLY(opcode, Empty, OpCodeAttr)
 #define MACRO_SIMD_WMS(opcode, asmjsLayout, opCodeAttrAsmJs, OpCodeAttr, ...) MACRO_BACKEND_ONLY(opcode, Empty, OpCodeAttr)

+ 0 - 3
lib/Runtime/ByteCode/OpCodesAsmJs.h

@@ -319,9 +319,6 @@ MACRO_EXTEND_WMS( PrintF64, Double2, None)
 
 #include "OpCodesSimd.h"
 
-MACRO_EXTEND(AsmJsEntryTracing, Empty, None)
-
-
 // help the caller to undefine all the macros
 #undef MACRO
 #undef MACRO_WMS

+ 0 - 37
lib/Runtime/Language/WAsmjsUtils.cpp

@@ -17,43 +17,6 @@ template<> Types RegisterSpace::GetRegisterSpaceType<double>(){return WAsmJs::FL
 template<> Types RegisterSpace::GetRegisterSpaceType<AsmJsSIMDValue>(){return WAsmJs::SIMD;}
 
 #ifdef ENABLE_DEBUG_CONFIG_OPTIONS
-    void TraceAsmJsArgsIn(Js::Var function, int n, ...)
-    {
-        Assert(Js::AsmJsScriptFunction::Is(function));
-        Js::AsmJsScriptFunction* asmFunction = (Js::AsmJsScriptFunction*)function;
-        va_list argptr;
-        va_start(argptr, n);
-
-        Output::Print(_u("Executing function %s("), asmFunction->GetFunctionBody()->GetDisplayName());
-        for (int i = 0; i < n ; i++)
-        {
-            IRType type = (IRType)va_arg(argptr, int32);
-            switch (type)
-            {
-            case TyInt32:
-            case TyUint32:
-                Output::Print(_u("%d, "), va_arg(argptr, int32));
-                break;
-            case TyInt64:
-            case TyUint64:
-                Output::Print(_u("%lld, "), va_arg(argptr, int64));
-                break;
-            case TyFloat32:
-            {
-                int v = va_arg(argptr, int);
-                Output::Print(_u("%.2f, "), *(float*)v);
-                break;
-            }
-            case TyFloat64:
-                Output::Print(_u("%.2f, "), va_arg(argptr, double));
-                break;
-            default:
-                break;
-            }
-        }
-        Output::Print(_u("){\n"));
-    }
-
     namespace Tracing
     {
         // This can be broken if exception are thrown from wasm frames

+ 0 - 1
lib/Runtime/Language/WAsmjsUtils.h

@@ -15,7 +15,6 @@ namespace WAsmJs
     static const double SIMD_SLOTS_SPACE = (sizeof(SIMDValue) / sizeof(Js::Var)); // 4 in x86 and 2 in x64
 
 #ifdef ENABLE_DEBUG_CONFIG_OPTIONS
-    void TraceAsmJsArgsIn(Js::Var function, int n, ...);
     namespace Tracing
     {
         int GetPrintCol();