Skip to content

Commit

Permalink
Bug 1666039: Create snapshots for getters r=jandem
Browse files Browse the repository at this point in the history
  • Loading branch information
iainireland committed Sep 25, 2020
1 parent 3060500 commit 474e4ab
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
12 changes: 12 additions & 0 deletions js/src/jit/TrialInlining.cpp
Expand Up @@ -128,6 +128,18 @@ ICStub* TrialInliner::maybeSingleStub(const ICEntry& entry) {
return stub;
}

Maybe<InlinableOpData> FindInlinableOpData(ICStub* stub) {
Maybe<InlinableCallData> call = FindInlinableCallData(stub);
if (call.isSome()) {
return call;
}
Maybe<InlinableGetterData> getter = FindInlinableGetterData(stub);
if (getter.isSome()) {
return getter;
}
return mozilla::Nothing();
}

Maybe<InlinableCallData> FindInlinableCallData(ICStub* stub) {
Maybe<InlinableCallData> data;

Expand Down
2 changes: 2 additions & 0 deletions js/src/jit/TrialInlining.h
Expand Up @@ -96,6 +96,8 @@ class InlinableGetterData : public InlinableOpData {
bool sameRealm = false;
};

mozilla::Maybe<InlinableOpData> FindInlinableOpData(ICStub* stub);

mozilla::Maybe<InlinableCallData> FindInlinableCallData(ICStub* stub);
mozilla::Maybe<InlinableGetterData> FindInlinableGetterData(ICStub* stub);

Expand Down
22 changes: 11 additions & 11 deletions js/src/jit/WarpOracle.cpp
Expand Up @@ -60,10 +60,10 @@ class MOZ_STACK_CLASS WarpScriptOracle {
AbortReasonOr<WarpEnvironment> createEnvironment();
AbortReasonOr<Ok> maybeInlineIC(WarpOpSnapshotList& snapshots,
BytecodeLocation loc);
AbortReasonOr<bool> maybeInlineCallIC(WarpOpSnapshotList& snapshots,
BytecodeLocation loc, ICStub* stub,
ICFallbackStub* fallbackStub,
uint8_t* stubDataCopy);
AbortReasonOr<bool> maybeInlineCall(WarpOpSnapshotList& snapshots,
BytecodeLocation loc, ICStub* stub,
ICFallbackStub* fallbackStub,
uint8_t* stubDataCopy);
MOZ_MUST_USE bool replaceNurseryPointers(ICStub* stub,
const CacheIRStubInfo* stubInfo,
uint8_t* stubDataCopy);
Expand Down Expand Up @@ -928,8 +928,8 @@ AbortReasonOr<Ok> WarpScriptOracle::maybeInlineIC(WarpOpSnapshotList& snapshots,

if (fallbackStub->trialInliningState() == TrialInliningState::Inlined) {
bool inlinedCall;
MOZ_TRY_VAR(inlinedCall, maybeInlineCallIC(snapshots, loc, stub,
fallbackStub, stubDataCopy));
MOZ_TRY_VAR(inlinedCall, maybeInlineCall(snapshots, loc, stub, fallbackStub,
stubDataCopy));
if (inlinedCall) {
return Ok();
}
Expand All @@ -945,17 +945,17 @@ AbortReasonOr<Ok> WarpScriptOracle::maybeInlineIC(WarpOpSnapshotList& snapshots,
return Ok();
}

AbortReasonOr<bool> WarpScriptOracle::maybeInlineCallIC(
AbortReasonOr<bool> WarpScriptOracle::maybeInlineCall(
WarpOpSnapshotList& snapshots, BytecodeLocation loc, ICStub* stub,
ICFallbackStub* fallbackStub, uint8_t* stubDataCopy) {
Maybe<InlinableCallData> callData = FindInlinableCallData(stub);
if (callData.isNothing() || !callData->icScript) {
Maybe<InlinableOpData> inlineData = FindInlinableOpData(stub);
if (inlineData.isNothing() || !inlineData->icScript) {
return false;
}

RootedFunction targetFunction(cx_, callData->target);
RootedFunction targetFunction(cx_, inlineData->target);
RootedScript targetScript(cx_, targetFunction->nonLazyScript());
ICScript* icScript = callData->icScript;
ICScript* icScript = inlineData->icScript;
if (!TrialInliner::canInline(targetFunction, script_)) {
return false;
}
Expand Down

0 comments on commit 474e4ab

Please sign in to comment.