Sfoglia il codice sorgente

Added workaround in GlobOpt to override type information from profile data

Franco Castellacci 9 anni fa
parent
commit
f6ec735fce
1 ha cambiato i file con 25 aggiunte e 1 eliminazioni
  1. 25 1
      lib/Backend/GlobOpt.cpp

+ 25 - 1
lib/Backend/GlobOpt.cpp

@@ -5801,7 +5801,31 @@ GlobOpt::OptSrc(IR::Opnd *opnd, IR::Instr * *pInstr, Value **indirIndexValRef, I
                 int paramSlotNum = sym->AsStackSym()->GetParamSlotNum() - 2;
                 if (paramSlotNum >= 0)
                 {
-                    const auto parameterType = instr->m_func->GetReadOnlyProfileInfo()->GetParameterInfo(static_cast<Js::ArgSlot>(paramSlotNum));
+                    ValueType parameterType;
+                    if (instr->m_func->GetJITFunctionBody()->GetParameterTypeInfo() != nullptr)
+                    {
+                        Js::TypeHint typeHint = (Js::TypeHint) instr->m_func->GetJITFunctionBody()->GetParameterTypeInfo()->content[paramSlotNum];
+                        switch (typeHint)
+                        {
+                            case Js::TypeHint::Int:
+                                parameterType = ValueType::Int.SetCanBeTaggedValue(true);
+                                break;
+                            case Js::TypeHint::Float:
+                                parameterType = ValueType::Float.SetCanBeTaggedValue(true);
+                                break;
+                            case Js::TypeHint::Bool:
+                                parameterType = ValueType::Boolean;
+                                break;
+                            case Js::TypeHint::Object:
+                                parameterType = ValueType::UninitializedObject;
+                                break;
+                            default:
+                                parameterType = instr->m_func->GetReadOnlyProfileInfo()->GetParameterInfo(static_cast<Js::ArgSlot>(paramSlotNum));
+                        }
+                    } else
+                    {
+                        parameterType = instr->m_func->GetReadOnlyProfileInfo()->GetParameterInfo(static_cast<Js::ArgSlot>(paramSlotNum));
+                    }
                     val = NewGenericValue(parameterType);
                     opnd->SetValueType(val->GetValueInfo()->Type());
                     return val;