Skip to content

Commit aaa3903

Browse files
committed
Bug 1703469: Remove redundant function arg r=jandem
We're always using the canonical function here anyway. Differential Revision: https://phabricator.services.mozilla.com/D251757
1 parent b1220f6 commit aaa3903

File tree

3 files changed

+7
-17
lines changed

3 files changed

+7
-17
lines changed

js/src/jit/CompileInfo.h

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ inline unsigned CountArgSlots(JSScript* script, bool hasFun,
6666
// Contains information about the compilation source for IR being generated.
6767
class CompileInfo {
6868
public:
69-
CompileInfo(CompileRuntime* runtime, JSScript* script, JSFunction* fun,
69+
CompileInfo(CompileRuntime* runtime, JSScript* script,
7070
jsbytecode* osrPc, bool scriptNeedsArgsObj,
7171
InlineScriptTree* inlineScriptTree)
7272
: script_(script),
73-
fun_(fun),
73+
fun_(script->function()),
7474
osrPc_(osrPc),
7575
scriptNeedsArgsObj_(scriptNeedsArgsObj),
7676
hadEagerTruncationBailout_(script->hadEagerTruncationBailout()),
@@ -89,18 +89,9 @@ class CompileInfo {
8989
runtime->hasSeenArrayExceedsInt32LengthFuseIntact()) {
9090
MOZ_ASSERT_IF(osrPc, JSOp(*osrPc) == JSOp::LoopHead);
9191

92-
// The function here can flow in from anywhere so look up the canonical
93-
// function to ensure that we do not try to embed a nursery pointer in
94-
// jit-code. Precisely because it can flow in from anywhere, it's not
95-
// guaranteed to be non-lazy. Hence, don't access its script!
96-
if (fun_) {
97-
fun_ = fun_->baseScript()->function();
98-
MOZ_ASSERT(fun_->isTenured());
99-
}
100-
10192
nimplicit_ = StartArgSlot(script) /* env chain and argument obj */
102-
+ (fun ? 1 : 0); /* this */
103-
nargs_ = fun ? fun->nargs() : 0;
93+
+ (fun_ ? 1 : 0); /* this */
94+
nargs_ = fun_ ? fun_->nargs() : 0;
10495
nlocals_ = script->nfixed();
10596

10697
// An extra slot is needed for global scopes because InitGLexical (stack
@@ -134,7 +125,7 @@ class CompileInfo {
134125
// will need to be observable.
135126
needsBodyEnvironmentObject_ = script->needsBodyEnvironment();
136127
funNeedsSomeEnvironmentObject_ =
137-
fun ? fun->needsSomeEnvironmentObject() : false;
128+
fun_ ? fun_->needsSomeEnvironmentObject() : false;
138129
}
139130

140131
explicit CompileInfo(unsigned nlocals)

js/src/jit/Ion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1779,7 +1779,7 @@ static AbortReason IonCompile(JSContext* cx, HandleScript script,
17791779
}
17801780

17811781
CompileInfo* info = alloc->new_<CompileInfo>(
1782-
CompileRuntime::get(cx->runtime()), script, script->function(), osrPc,
1782+
CompileRuntime::get(cx->runtime()), script, osrPc,
17831783
script->needsArgsObj(), inlineScriptTree);
17841784
if (!info) {
17851785
return AbortReason::Alloc;

js/src/jit/WarpOracle.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,8 +1069,7 @@ AbortReasonOr<bool> WarpScriptOracle::maybeInlineCall(
10691069
jsbytecode* osrPc = nullptr;
10701070
bool needsArgsObj = targetScript->needsArgsObj();
10711071
CompileInfo* info = lifoAlloc->new_<CompileInfo>(
1072-
mirGen_.runtime, targetScript, targetFunction, osrPc, needsArgsObj,
1073-
inlineScriptTree);
1072+
mirGen_.runtime, targetScript, osrPc, needsArgsObj, inlineScriptTree);
10741073
if (!info) {
10751074
return abort(AbortReason::Alloc);
10761075
}

0 commit comments

Comments
 (0)