Skip to content

Commit

Permalink
[MERGE #5899 @rajatd] January 2019 servicing update
Browse files Browse the repository at this point in the history
Merge pull request #5899 from rajatd:servicing/1901
  • Loading branch information
rajatd committed Jan 8, 2019
2 parents daa5d25 + 788f17b commit 9997a53
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 8 deletions.
9 changes: 9 additions & 0 deletions lib/Backend/GlobOptFields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,15 @@ GlobOpt::ProcessFieldKills(IR::Instr *instr, BVSparse<JitArenaAllocator> *bv, bo
}
break;

case Js::OpCode::InitClass:
case Js::OpCode::InitProto:
case Js::OpCode::NewScObjectNoCtor:
if (inGlobOpt)
{
KillObjectHeaderInlinedTypeSyms(this->currentBlock, false);
}
break;

default:
if (instr->UsesAllFields())
{
Expand Down
36 changes: 28 additions & 8 deletions lib/Runtime/Library/JsBuiltInEngineInterfaceExtensionObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,26 @@ namespace Js
{
return;
}

struct AutoRestoreFlags
{
ThreadContext * ctx;
ImplicitCallFlags savedImplicitCallFlags;
DisableImplicitFlags savedDisableImplicitFlags;
AutoRestoreFlags(ThreadContext *ctx, Js::ImplicitCallFlags implFlags, DisableImplicitFlags disableImplFlags) :
ctx(ctx),
savedImplicitCallFlags(implFlags),
savedDisableImplicitFlags(disableImplFlags)
{
ctx->ClearDisableImplicitFlags();
}

~AutoRestoreFlags()
{
ctx->SetImplicitCallFlags((Js::ImplicitCallFlags)(savedImplicitCallFlags));
ctx->SetDisableImplicitFlags((DisableImplicitFlags)savedDisableImplicitFlags);
}
};

try {
EnsureJsBuiltInByteCode(scriptContext);
Expand Down Expand Up @@ -138,19 +158,19 @@ namespace Js
scriptContext->GetThreadContext()->SetNoJsReentrancy(false);
#endif
// Clear disable implicit call bit as initialization code doesn't have any side effect
Js::ImplicitCallFlags saveImplicitCallFlags = scriptContext->GetThreadContext()->GetImplicitCallFlags();
scriptContext->GetThreadContext()->ClearDisableImplicitFlags();
JavascriptFunction::CallRootFunctionInScript(functionGlobal, Js::Arguments(callInfo, args));
scriptContext->GetThreadContext()->SetImplicitCallFlags((Js::ImplicitCallFlags)(saveImplicitCallFlags));
{
AutoRestoreFlags autoRestoreFlags(scriptContext->GetThreadContext(), scriptContext->GetThreadContext()->GetImplicitCallFlags(), scriptContext->GetThreadContext()->GetDisableImplicitFlags());
JavascriptFunction::CallRootFunctionInScript(functionGlobal, Js::Arguments(callInfo, args));
}

Js::ScriptFunction *functionBuiltins = scriptContext->GetLibrary()->CreateScriptFunction(jsBuiltInByteCode->GetNestedFunctionForExecution(0));
functionBuiltins->SetPrototype(scriptContext->GetLibrary()->nullValue);

// Clear disable implicit call bit as initialization code doesn't have any side effect
saveImplicitCallFlags = scriptContext->GetThreadContext()->GetImplicitCallFlags();
scriptContext->GetThreadContext()->ClearDisableImplicitFlags();
JavascriptFunction::CallRootFunctionInScript(functionBuiltins, Js::Arguments(callInfo, args));
scriptContext->GetThreadContext()->SetImplicitCallFlags((Js::ImplicitCallFlags)(saveImplicitCallFlags));
{
AutoRestoreFlags autoRestoreFlags(scriptContext->GetThreadContext(), scriptContext->GetThreadContext()->GetImplicitCallFlags(), scriptContext->GetThreadContext()->GetDisableImplicitFlags());
JavascriptFunction::CallRootFunctionInScript(functionBuiltins, Js::Arguments(callInfo, args));
}

InitializePrototypes(scriptContext);
#if DBG_DUMP
Expand Down

0 comments on commit 9997a53

Please sign in to comment.