From 3ccd90cecbaea74e46e53b3ab504ee8050aa6382 Mon Sep 17 00:00:00 2001 From: Michael Holman Date: Tue, 12 Sep 2017 17:46:23 -0700 Subject: [PATCH] Address CR feedback --- lib/Backend/BackendOpCodeAttrAsmJs.cpp | 3 +-- lib/Backend/Sym.h | 1 - lib/Runtime/Base/FunctionBody.cpp | 4 ++-- lib/Runtime/ByteCode/OpCodesAsmJs.h | 2 +- lib/Runtime/Language/DynamicProfileInfo.cpp | 14 +++++++++++--- lib/WasmReader/WasmByteCodeGenerator.cpp | 7 ++----- test/wasm/inlining.baseline | 2 ++ test/wasm/rlexe.xml | 7 +++++++ 8 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 test/wasm/inlining.baseline diff --git a/lib/Backend/BackendOpCodeAttrAsmJs.cpp b/lib/Backend/BackendOpCodeAttrAsmJs.cpp index 296a1d9d2c4..b647a421376 100644 --- a/lib/Backend/BackendOpCodeAttrAsmJs.cpp +++ b/lib/Backend/BackendOpCodeAttrAsmJs.cpp @@ -13,8 +13,7 @@ namespace OpCodeAttrAsmJs OpNoFallThrough = 1 << 0, // Opcode doesn't fallthrough in flow and its always jump to the return from this opcode. OpHasMultiSizeLayout = 1 << 1, OpHasProfiled = 1 << 2, - OpProfiled = 1 << 3, - OpByteCodeOnly = 1 << 4 + OpProfiled = 1 << 3 }; static const int OpcodeAttributesAsmJs[] = diff --git a/lib/Backend/Sym.h b/lib/Backend/Sym.h index e6cb3ea97d9..315b8d4c781 100644 --- a/lib/Backend/Sym.h +++ b/lib/Backend/Sym.h @@ -176,7 +176,6 @@ class StackSym: public Sym bool IsFromByteCodeConstantTable() const { return m_isFromByteCodeConstantTable; } void SetIsFromByteCodeConstantTable() { this->m_isFromByteCodeConstantTable = true; } Js::ArgSlot GetArgSlotNum() const { Assert(HasArgSlotNum()); return m_slotNum; } - void SetArgSlotNum(Js::ArgSlot newNum) { m_slotNum = newNum; } bool HasArgSlotNum() const { return !!(m_isArgSlotSym | m_isArgSlotRegSym); } void IncrementArgSlotNum(); void DecrementArgSlotNum(); diff --git a/lib/Runtime/Base/FunctionBody.cpp b/lib/Runtime/Base/FunctionBody.cpp index d98055a76e6..17b2e3d66ee 100644 --- a/lib/Runtime/Base/FunctionBody.cpp +++ b/lib/Runtime/Base/FunctionBody.cpp @@ -4948,15 +4948,15 @@ namespace Js DynamicProfileInfoList * profileInfoList = GetScriptContext()->GetProfileInfoList(); if (profileInfoList) { - for (auto iter = profileInfoList->GetEditingIterator(); iter.IsValid(); iter.Next()) + FOREACH_SLISTBASE_ENTRY_EDITING(DynamicProfileInfo*, info, profileInfoList, iter) { - DynamicProfileInfo * info = iter.Data(); if (info->HasFunctionBody() && info->GetFunctionBody() == this) { iter.UnlinkCurrent(); break; } } + NEXT_SLISTBASE_ENTRY_EDITING; } #endif this->dynamicProfileInfo = nullptr; diff --git a/lib/Runtime/ByteCode/OpCodesAsmJs.h b/lib/Runtime/ByteCode/OpCodesAsmJs.h index 6b5fe468c19..776bb97be9d 100755 --- a/lib/Runtime/ByteCode/OpCodesAsmJs.h +++ b/lib/Runtime/ByteCode/OpCodesAsmJs.h @@ -21,7 +21,7 @@ #define MACRO_WMS_PROFILED( opcode, layout, attr) \ MACRO_WMS(opcode, layout, OpHasProfiled|attr) \ - MACRO_WMS(Profiled##opcode, Profiled##layout, OpByteCodeOnly|OpProfiled|attr) \ + MACRO_WMS(Profiled##opcode, Profiled##layout, OpProfiled|attr) \ // ( OpCodeAsmJs , LayoutAsmJs , OpCodeAttrAsmJs ) diff --git a/lib/Runtime/Language/DynamicProfileInfo.cpp b/lib/Runtime/Language/DynamicProfileInfo.cpp index 6610bf0aacf..128315b4bed 100644 --- a/lib/Runtime/Language/DynamicProfileInfo.cpp +++ b/lib/Runtime/Language/DynamicProfileInfo.cpp @@ -217,7 +217,11 @@ namespace Js bool DynamicProfileInfo::IsEnabled(const FunctionBody *const functionBody) { Assert(functionBody); - return IsEnabled_OptionalFunctionBody(functionBody, functionBody->GetScriptContext()); + return (IsEnabled_OptionalFunctionBody(functionBody, functionBody->GetScriptContext()) +#ifdef ENABLE_WASM + && !(PHASE_TRACE1(Js::WasmInOutPhase) && functionBody->IsWasmFunction()) +#endif + ); } bool DynamicProfileInfo::IsEnabled_OptionalFunctionBody(const FunctionBody *const functionBody, const ScriptContext *const scriptContext) @@ -248,7 +252,11 @@ namespace Js bool DynamicProfileInfo::IsEnabled(const Js::Phase phase, const FunctionBody *const functionBody) { Assert(functionBody); - return IsEnabled_OptionalFunctionBody(phase, functionBody, functionBody->GetScriptContext()); + return (IsEnabled_OptionalFunctionBody(phase, functionBody, functionBody->GetScriptContext()) +#ifdef ENABLE_WASM + && !(PHASE_TRACE1(Js::WasmInOutPhase) && functionBody->IsWasmFunction()) +#endif + ); } bool DynamicProfileInfo::IsEnabled_OptionalFunctionBody( @@ -414,7 +422,7 @@ namespace Js { if (!callerBody || !callerBody->GetIsAsmjsMode() || !calleeBody || !calleeBody->GetIsAsmjsMode()) { - AssertMsg(UNREACHED, "Call to RecordAsmJsCallSiteInfo without 2 wasm function body"); + AssertMsg(UNREACHED, "Call to RecordAsmJsCallSiteInfo without two asm.js/wasm FunctionBody"); return; } diff --git a/lib/WasmReader/WasmByteCodeGenerator.cpp b/lib/WasmReader/WasmByteCodeGenerator.cpp index 9b2cfbd60ad..49657c5ec00 100644 --- a/lib/WasmReader/WasmByteCodeGenerator.cpp +++ b/lib/WasmReader/WasmByteCodeGenerator.cpp @@ -965,7 +965,7 @@ EmitInfo WasmBytecodeGenerator::EmitCall() calleeSignature = calleeInfo->GetSignature(); // currently only handle inlining internal function calls // in future we can expand to all calls by adding checks in inliner and falling back to call in case ScriptFunction doesn't match - if (GetReader()->m_currentNode.call.funcType == FunctionIndexTypes::Function) + if (GetReader()->m_currentNode.call.funcType == FunctionIndexTypes::Function && !PHASE_TRACE1(Js::WasmInOutPhase)) { profileId = GetNextProfileId(); } @@ -1135,10 +1135,7 @@ EmitInfo WasmBytecodeGenerator::EmitCall() default: throw WasmCompilationException(_u("Unknown call return type %u"), retInfo.type); } - if (retInfo.type != WasmTypes::Void) - { - retInfo.location = GetRegisterSpace(retInfo.type)->AcquireTmpRegister(); - } + retInfo.location = GetRegisterSpace(retInfo.type)->AcquireTmpRegister(); m_writer->AsmReg2(convertOp, retInfo.location, varRetReg); } } diff --git a/test/wasm/inlining.baseline b/test/wasm/inlining.baseline new file mode 100644 index 00000000000..bb88ec0fa72 --- /dev/null +++ b/test/wasm/inlining.baseline @@ -0,0 +1,2 @@ +-1970372561 +-1970372561 diff --git a/test/wasm/rlexe.xml b/test/wasm/rlexe.xml index 2c4b7663d75..ac75cb70079 100644 --- a/test/wasm/rlexe.xml +++ b/test/wasm/rlexe.xml @@ -158,6 +158,13 @@ exclude_jshost,exclude_win7 + + + inlining.js + inlining.baseline + exclude_jshost,exclude_win7,exclude_xplat + + params.js