Bug 1673553 part 6 - Remove Baseline type monitor and update ICs. r=iain

Also removes JOF_IC and JOF_TYPESET from GetAliasedVar and GetImport.

Differential Revision: https://phabricator.services.mozilla.com/D96992
This commit is contained in:
Jan de Mooij committed 2020-11-16 10:19:17 +00:00
1 parent c2d91b36e0
commit 1534301b43
21 files changed
+78 -2538

No files matched your search

-40
View File
@@ -366,8 +366,6 @@ class MOZ_STACK_CLASS BaselineStackBuilder {
void setResumeAddr(void* resumeAddr) { header_->resumeAddr = resumeAddr; }
void setMonitorPC(jsbytecode* pc) { header_->monitorPC = pc; }
void setFrameSizeOfInnerMostFrame(uint32_t size) {
header_->frameSizeOfInnerMostFrame = size;
}
@@ -1147,16 +1145,6 @@ bool BaselineStackBuilder::buildStubFrame(uint32_t frameSize,
return false;
}
// Ensure we have a TypeMonitor fallback stub so we don't crash in JIT code
// when we try to enter it. See callers of offsetOfFallbackMonitorStub.
if (BytecodeOpHasTypeSet(op_) && IsTypeInferenceEnabled()) {
ICFallbackStub* fallbackStub = icEntry.fallbackStub();
if (!fallbackStub->toMonitoredFallbackStub()->getFallbackMonitorStub(
cx_, script_)) {
return false;
}
}
// Push return address into ICCall_Scripted stub, immediately after the call.
void* baselineCallReturnAddr = getStubReturnAddress();
MOZ_ASSERT(baselineCallReturnAddr);
@@ -1313,11 +1301,6 @@ bool BaselineStackBuilder::finishLastFrame() {
blFrame()->setInterpreterFields(script_, throwPC);
resumeAddr = baselineInterp.interpretOpAddr().value;
} else {
// If the opcode is monitored we should monitor the top stack value when
// we finish the bailout in FinishBailoutToBaseline.
if (resumeAfter() && BytecodeOpHasTypeSet(op_)) {
setMonitorPC(pc_);
}
jsbytecode* resumePC = getResumePC();
blFrame()->setInterpreterFields(script_, resumePC);
resumeAddr = baselineInterp.interpretOpAddr().value;
@@ -1965,29 +1948,6 @@ bool jit::FinishBailoutToBaseline(BaselineBailoutInfo* bailoutInfoArg) {
return false;
}
// Monitor the top stack value if we are resuming after a JOF_TYPESET op.
if (jsbytecode* monitorPC = bailoutInfo->monitorPC) {
MOZ_ASSERT(BytecodeOpHasTypeSet(JSOp(*monitorPC)));
MOZ_ASSERT(GetNextPc(monitorPC) == topFrame->interpreterPC());
RootedScript script(cx, topFrame->script());
uint32_t monitorOffset = script->pcToOffset(monitorPC);
ICEntry& icEntry = script->jitScript()->icEntryFromPCOffset(monitorOffset);
ICFallbackStub* fallbackStub = icEntry.fallbackStub();
// Not every monitored op has a monitored fallback stub, e.g.
// JSOp::NewObject, which always returns the same type for a
// particular script/pc location.
if (fallbackStub->isMonitoredFallback()) {
ICMonitoredFallbackStub* stub = fallbackStub->toMonitoredFallbackStub();
uint32_t frameSize = bailoutInfo->frameSizeOfInnerMostFrame;
RootedValue val(cx, topFrame->topStackValue(frameSize));
if (!TypeMonitorResult(cx, stub, topFrame, script, monitorPC, val)) {
return false;
}
}
}
// Create arguments objects for bailed out frames, to maintain the invariant
// that script->needsArgsObj() implies frame->hasArgsObj().
RootedScript innerScript(cx, nullptr);
+4 -132
View File
@@ -140,10 +140,6 @@ static size_t GetEnteredOffset(BaselineCacheIRStubKind kind) {
switch (kind) {
case BaselineCacheIRStubKind::Regular:
return ICCacheIR_Regular::offsetOfEnteredCount();
case BaselineCacheIRStubKind::Updated:
return ICCacheIR_Updated::offsetOfEnteredCount();
case BaselineCacheIRStubKind::Monitored:
return ICCacheIR_Monitored::offsetOfEnteredCount();
}
MOZ_CRASH("unhandled BaselineCacheIRStubKind");
}
@@ -866,60 +862,7 @@ bool BaselineCacheIRCompiler::callTypeUpdateIC(
// Ensure the stack is empty for the VM call below.
allocator.discardStack(masm);
if (!IsTypeInferenceEnabled()) {
return true;
}
// R0 contains the value that needs to be typechecked.
MOZ_ASSERT(val == R0);
MOZ_ASSERT(scratch == R1.scratchReg());
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
static const bool CallClobbersTailReg = false;
#else
static const bool CallClobbersTailReg = true;
#endif
// Call the first type update stub.
if (CallClobbersTailReg) {
masm.push(ICTailCallReg);
}
masm.push(ICStubReg);
masm.loadPtr(Address(ICStubReg, ICCacheIR_Updated::offsetOfFirstUpdateStub()),
ICStubReg);
masm.call(Address(ICStubReg, ICStub::offsetOfStubCode()));
masm.pop(ICStubReg);
if (CallClobbersTailReg) {
masm.pop(ICTailCallReg);
}
// The update IC will store 0 or 1 in |scratch|, R1.scratchReg(), reflecting
// if the value in R0 type-checked properly or not.
Label done;
masm.branch32(Assembler::Equal, scratch, Imm32(1), &done);
AutoStubFrame stubFrame(*this);
stubFrame.enter(masm, scratch, CallCanGC::CanNotGC);
masm.PushRegsInMask(saveRegs);
masm.Push(val);
masm.Push(TypedOrValueRegister(MIRType::Object, AnyRegister(obj)));
masm.Push(ICStubReg);
// Load previous frame pointer, push BaselineFrame*.
masm.loadPtr(Address(BaselineFrameReg, 0), scratch);
masm.pushBaselineFramePtr(scratch, scratch);
using Fn = bool (*)(JSContext*, BaselineFrame*, ICCacheIR_Updated*,
HandleValue, HandleValue);
callVM<Fn, DoTypeUpdateFallback>(masm);
masm.PopRegsInMask(saveRegs);
stubFrame.leave(masm);
masm.bind(&done);
// TODO(no-TI): clean up.
return true;
}
@@ -2221,11 +2164,8 @@ bool BaselineCacheIRCompiler::emitMegamorphicSetElement(ObjOperandId objId,
bool BaselineCacheIRCompiler::emitTypeMonitorResult() {
JitSpew(JitSpew_Codegen, "%s", __FUNCTION__);
allocator.discardStack(masm);
if (IsTypeInferenceEnabled()) {
EmitEnterTypeMonitorIC(masm);
} else {
EmitReturnFromIC(masm);
}
// TODO(no-TI): remove CacheIR instruction.
EmitReturnFromIC(masm);
return true;
}
@@ -2468,12 +2408,6 @@ static void ResetEnteredCounts(ICFallbackStub* stub) {
case ICStub::CacheIR_Regular:
iter->toCacheIR_Regular()->resetEnteredCount();
break;
case ICStub::CacheIR_Updated:
iter->toCacheIR_Updated()->resetEnteredCount();
break;
case ICStub::CacheIR_Monitored:
iter->toCacheIR_Monitored()->resetEnteredCount();
break;
default:
break;
}
@@ -2502,17 +2436,12 @@ ICStub* js::jit::AttachBaselineCacheIRStub(
MOZ_ASSERT(stub->numOptimizedStubs() < MaxOptimizedCacheIRStubs);
#endif
// TODO(no-TI): remove stubKind argument.
uint32_t stubDataOffset = 0;
switch (stubKind) {
case BaselineCacheIRStubKind::Monitored:
stubDataOffset = sizeof(ICCacheIR_Monitored);
break;
case BaselineCacheIRStubKind::Regular:
stubDataOffset = sizeof(ICCacheIR_Regular);
break;
case BaselineCacheIRStubKind::Updated:
stubDataOffset = sizeof(ICCacheIR_Updated);
break;
}
JitZone* jitZone = cx->zone()->jitZone();
@@ -2581,32 +2510,6 @@ ICStub* js::jit::AttachBaselineCacheIRStub(
}
break;
}
case BaselineCacheIRStubKind::Monitored: {
if (!iter->isCacheIR_Monitored()) {
continue;
}
auto otherStub = iter->toCacheIR_Monitored();
if (otherStub->stubInfo() != stubInfo) {
continue;
}
if (!writer.stubDataEquals(otherStub->stubDataStart())) {
continue;
}
break;
}
case BaselineCacheIRStubKind::Updated: {
if (!iter->isCacheIR_Updated()) {
continue;
}
auto otherStub = iter->toCacheIR_Updated();
if (otherStub->stubInfo() != stubInfo) {
continue;
}
if (!writer.stubDataEquals(otherStub->stubDataStart())) {
continue;
}
break;
}
}
// We found a stub that's exactly the same as the stub we're about to
@@ -2656,36 +2559,6 @@ ICStub* js::jit::AttachBaselineCacheIRStub(
*attached = true;
return newStub;
}
case BaselineCacheIRStubKind::Monitored: {
ICStub* monitorStub = nullptr;
if (IsTypeInferenceEnabled()) {
ICTypeMonitor_Fallback* typeMonitorFallback =
stub->toMonitoredFallbackStub()->getFallbackMonitorStub(
cx, outerScript);
if (!typeMonitorFallback) {
cx->recoverFromOutOfMemory();
return nullptr;
}
monitorStub = typeMonitorFallback->firstMonitorStub();
}
auto newStub =
new (newStubMem) ICCacheIR_Monitored(code, monitorStub, stubInfo);
writer.copyStubData(newStub->stubDataStart());
stub->addNewStub(newStub);
*attached = true;
return newStub;
}
case BaselineCacheIRStubKind::Updated: {
auto newStub = new (newStubMem) ICCacheIR_Updated(code, stubInfo);
if (!newStub->initUpdatingChain(cx, stubSpace)) {
cx->recoverFromOutOfMemory();
return nullptr;
}
writer.copyStubData(newStub->stubDataStart());
stub->addNewStub(newStub);
*attached = true;
return newStub;
}
}
MOZ_CRASH("Invalid kind");
@@ -2697,7 +2570,6 @@ uint8_t* ICCacheIR_Trait<Base>::stubDataStart() {
}
template uint8_t* ICCacheIR_Trait<ICStub>::stubDataStart();
template uint8_t* ICCacheIR_Trait<ICMonitoredStub>::stubDataStart();
bool BaselineCacheIRCompiler::emitCallStringObjectConcatResult(
ValOperandId lhsId, ValOperandId rhsId) {
+2 -1
View File
@@ -19,7 +19,8 @@ namespace jit {
class ICFallbackStub;
class ICStub;
enum class BaselineCacheIRStubKind { Regular, Monitored, Updated };
// TODO(no-TI): remove.
enum class BaselineCacheIRStubKind { Regular };
ICStub* AttachBaselineCacheIRStub(JSContext* cx, const CacheIRWriter& writer,
CacheKind kind,
+2 -24
View File
@@ -561,7 +561,7 @@ bool BaselineCompilerCodeGen::emitNextIC() {
} while (entry->pcOffset() < pcOffset);
MOZ_RELEASE_ASSERT(entry->pcOffset() == pcOffset);
MOZ_ASSERT_IF(!entry->isForPrologue(), BytecodeOpHasIC(JSOp(*handler.pc())));
MOZ_ASSERT(BytecodeOpHasIC(JSOp(*handler.pc())));
// Load stub pointer into ICStubReg.
if (JitOptions.warpBuilder) {
@@ -576,10 +576,7 @@ bool BaselineCompilerCodeGen::emitNextIC() {
CodeOffset returnOffset;
EmitCallIC(masm, &returnOffset);
RetAddrEntry::Kind kind = entry->isForPrologue()
? RetAddrEntry::Kind::PrologueIC
: RetAddrEntry::Kind::IC;
RetAddrEntry::Kind kind = RetAddrEntry::Kind::IC;
if (!handler.retAddrEntries().emplaceBack(pcOffset, kind, returnOffset)) {
ReportOutOfMemory(cx);
return false;
@@ -3687,13 +3684,6 @@ template <typename Handler>
bool BaselineCodeGen<Handler>::emit_GetAliasedVar() {
emitGetAliasedVar(R0);
if (IsTypeInferenceEnabled() && handler.maybeIonCompileable()) {
// No need to monitor types if we know Ion can't compile this script.
if (!emitNextIC()) {
return false;
}
}
frame.push(R0);
return true;
}
@@ -3907,13 +3897,6 @@ bool BaselineCompilerCodeGen::emit_GetImport() {
}
}
if (IsTypeInferenceEnabled() && handler.maybeIonCompileable()) {
// No need to monitor types if we know Ion can't compile this script.
if (!emitNextIC()) {
return false;
}
}
frame.push(R0);
return true;
}
@@ -3936,11 +3919,6 @@ bool BaselineInterpreterCodeGen::emit_GetImport() {
return false;
}
// Enter the type monitor IC.
if (IsTypeInferenceEnabled() && !emitNextIC()) {
return false;
}
frame.push(R0);
return true;
}
-3
View File
@@ -179,8 +179,6 @@ static const char* RetAddrEntryKindToString(RetAddrEntry::Kind kind) {
switch (kind) {
case RetAddrEntry::Kind::IC:
return "IC";
case RetAddrEntry::Kind::PrologueIC:
return "prologue IC";
case RetAddrEntry::Kind::CallVM:
return "callVM";
case RetAddrEntry::Kind::StackCheck:
@@ -354,7 +352,6 @@ static void PatchBaselineFramesForDebugMode(
pc);
break;
}
case RetAddrEntry::Kind::PrologueIC:
case RetAddrEntry::Kind::NonOpCallVM:
case RetAddrEntry::Kind::Invalid:
// These cannot trigger BaselineDebugModeOSR.
+25 -1117
View File
File diff suppressed because it is too large. Load diff
+23 -816
View File
File diff suppressed because it is too large. Load diff
+1 -17
View File
@@ -13,18 +13,6 @@ namespace jit {
// List of Baseline IC stub kinds. The stub kind determines the structure of the
// ICStub data.
#define IC_BASELINE_STUB_KIND_LIST(_) \
_(TypeMonitor_Fallback) \
_(TypeMonitor_SingleObject) \
_(TypeMonitor_ObjectGroup) \
_(TypeMonitor_PrimitiveSet) \
_(TypeMonitor_AnyValue) \
\
_(TypeUpdate_Fallback) \
_(TypeUpdate_SingleObject) \
_(TypeUpdate_ObjectGroup) \
_(TypeUpdate_PrimitiveSet) \
_(TypeUpdate_AnyValue) \
\
_(NewArray_Fallback) \
_(NewObject_Fallback) \
\
@@ -67,9 +55,7 @@ namespace jit {
\
_(GetProp_Fallback) \
\
_(CacheIR_Regular) \
_(CacheIR_Monitored) \
_(CacheIR_Updated)
_(CacheIR_Regular)
// List of fallback trampolines. Each of these fallback trampolines exists as
// part of the JitRuntime. Note that some fallback stubs in previous list may
@@ -77,8 +63,6 @@ namespace jit {
// constructing/spread variants here with different calling conventions needing
// different trampolines.
#define IC_BASELINE_FALLBACK_CODE_KIND_LIST(_) \
_(TypeMonitor) \
_(TypeUpdate) \
_(NewArray) \
_(NewObject) \
_(ToBool) \
-7
View File
@@ -113,9 +113,6 @@ class RetAddrEntry {
// An IC for a JOF_IC op.
IC,
// A prologue IC.
PrologueIC,
// A callVM for an op.
CallVM,
@@ -463,10 +460,6 @@ struct alignas(uintptr_t) BaselineBailoutInfo {
// The native code address to resume into.
void* resumeAddr = nullptr;
// If non-null, we have to type monitor the top stack value for this pc (we
// resume right after it).
jsbytecode* monitorPC = nullptr;
// The bytecode pc of try block and fault block.
jsbytecode* tryPC = nullptr;
jsbytecode* faultPC = nullptr;
+2 -260
View File
@@ -446,6 +446,7 @@ AttachDecision GetPropIRGenerator::tryAttachIdempotentStub() {
// effects and produce a result which the MIR in the calling code is able
// to handle, since we do not have a pc to explicitly monitor the result.
// TODO(no-TI): remove idempotent ICs.
MOZ_ASSERT(idempotent());
RootedObject obj(cx_, &val_.toObject());
@@ -1018,10 +1019,6 @@ static void EmitReadSlotReturn(CacheIRWriter& writer, JSObject*,
}
writer.typeMonitorResult();
} else {
// Normally for this op, the result would have to be monitored by TI.
// However, since this stub ALWAYS returns UndefinedValue(), and we can be
// sure that undefined is already registered with the type-set, this can be
// avoided.
writer.returnFromIC();
}
}
@@ -1830,8 +1827,6 @@ AttachDecision GetPropIRGenerator::tryAttachObjectLength(HandleObject obj,
}
if (obj->is<ArrayObject>()) {
// Make sure int32 is added to the TypeSet before we attach a stub, so
// the stub can return int32 values without monitoring the result.
if (obj->as<ArrayObject>().length() > INT32_MAX) {
return AttachDecision::NoAction;
}
@@ -1969,17 +1964,11 @@ AttachDecision GetPropIRGenerator::tryAttachFunction(HandleObject obj,
writer.guardClass(objId, GuardClassKind::JSFunction);
if (isLength) {
writer.loadFunctionLengthResult(objId);
// Doesn't need to be monitored, because it always returns an int32.
writer.returnFromIC();
trackAttached("FunctionLength");
} else {
writer.loadFunctionNameResult(objId);
// Doesn't need to be monitored, because it always returns a string.
writer.returnFromIC();
trackAttached("FunctionName");
}
return AttachDecision::Attach;
@@ -5138,8 +5127,7 @@ CallIRGenerator::CallIRGenerator(JSContext* cx, HandleScript script,
thisval_(thisval),
newTarget_(newTarget),
args_(args),
typeCheckInfo_(cx, /* needsTypeBarrier = */ true),
cacheIRStubKind_(BaselineCacheIRStubKind::Regular) {}
typeCheckInfo_(cx, /* needsTypeBarrier = */ true) {}
void CallIRGenerator::emitNativeCalleeGuard(HandleFunction callee) {
// Note: we rely on GuardSpecificFunction to also guard against the same
@@ -5256,8 +5244,6 @@ AttachDecision CallIRGenerator::tryAttachArrayPush(HandleFunction callee) {
// Set the type-check info, and the stub kind to Updated
typeCheckInfo_.set(thisobj->group(), JSID_VOID);
cacheIRStubKind_ = BaselineCacheIRStubKind::Updated;
trackAttached("ArrayPush");
return AttachDecision::Attach;
}
@@ -5309,7 +5295,6 @@ AttachDecision CallIRGenerator::tryAttachArrayPopShift(HandleFunction callee,
}
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("ArrayPopShift");
return AttachDecision::Attach;
@@ -5360,13 +5345,6 @@ AttachDecision CallIRGenerator::tryAttachArrayJoin(HandleFunction callee) {
writer.returnFromIC();
// The result of this stub does not need to be monitored because it will
// always return a string. We will add String to the stack typeset when
// attaching this stub.
// Set the stub kind to Regular
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("ArrayJoin");
return AttachDecision::Attach;
}
@@ -5443,7 +5421,6 @@ AttachDecision CallIRGenerator::tryAttachArraySlice(HandleFunction callee) {
}
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("ArraySlice");
return AttachDecision::Attach;
@@ -5464,11 +5441,7 @@ AttachDecision CallIRGenerator::tryAttachArrayIsArray(HandleFunction callee) {
// Check if the argument is an Array and return result.
ValOperandId argId = writer.loadArgumentFixedSlot(ArgumentKind::Arg0, argc_);
writer.isArrayResult(argId);
// This stub does not need to be monitored, because it always
// returns a boolean.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("ArrayIsArray");
return AttachDecision::Attach;
@@ -5541,11 +5514,7 @@ AttachDecision CallIRGenerator::tryAttachDataViewGet(HandleFunction callee,
writer.loadDataViewValueResult(objId, int32OffsetId, boolLittleEndianId, type,
allowDoubleForUint32);
// This stub does not need to be monitored, because it returns the same type
// as this call.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("DataViewGet");
return AttachDecision::Attach;
@@ -5617,10 +5586,7 @@ AttachDecision CallIRGenerator::tryAttachDataViewSet(HandleFunction callee,
writer.storeDataViewValueResult(objId, int32OffsetId, numericValueId,
boolLittleEndianId, type);
// This stub doesn't need type monitoring, it always returns |undefined|.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("DataViewSet");
return AttachDecision::Attach;
@@ -5674,7 +5640,6 @@ AttachDecision CallIRGenerator::tryAttachUnsafeGetReservedSlot(
// For simplicity just monitor all stubs.
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("UnsafeGetReservedSlot");
return AttachDecision::Attach;
@@ -5714,7 +5679,6 @@ AttachDecision CallIRGenerator::tryAttachUnsafeSetReservedSlot(
// This stub always returns undefined.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("UnsafeSetReservedSlot");
return AttachDecision::Attach;
@@ -5743,11 +5707,6 @@ AttachDecision CallIRGenerator::tryAttachIsSuspendedGenerator(
writer.callIsSuspendedGeneratorResult(valId);
writer.returnFromIC();
// This stub does not need to be monitored, because it always
// returns Boolean. The stack typeset will be updated when we
// attach the stub.
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("IsSuspendedGenerator");
return AttachDecision::Attach;
}
@@ -5782,7 +5741,6 @@ AttachDecision CallIRGenerator::tryAttachToObject(HandleFunction callee,
// Monitor the returned object.
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
if (native == InlinableNative::IntrinsicToObject) {
trackAttached("ToObject");
@@ -5816,11 +5774,7 @@ AttachDecision CallIRGenerator::tryAttachToInteger(HandleFunction callee) {
// Return the int32.
writer.loadInt32Result(int32Id);
// This stub does not need to be monitored, because it always
// returns an int32.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("ToInteger");
return AttachDecision::Attach;
@@ -5847,11 +5801,7 @@ AttachDecision CallIRGenerator::tryAttachToLength(HandleFunction callee) {
bool isMax = true;
Int32OperandId maxId = writer.int32MinMax(isMax, int32ArgId, zeroId);
writer.loadInt32Result(maxId);
// This stub does not need to be monitored, because it always returns an
// int32.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("ToLength");
return AttachDecision::Attach;
@@ -5869,11 +5819,7 @@ AttachDecision CallIRGenerator::tryAttachIsObject(HandleFunction callee) {
// Type check the argument and return result.
ValOperandId argId = writer.loadArgumentFixedSlot(ArgumentKind::Arg0, argc_);
writer.isObjectResult(argId);
// This stub does not need to be monitored, because it always
// returns a boolean.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("IsObject");
return AttachDecision::Attach;
@@ -5893,11 +5839,7 @@ AttachDecision CallIRGenerator::tryAttachIsPackedArray(HandleFunction callee) {
ValOperandId argId = writer.loadArgumentFixedSlot(ArgumentKind::Arg0, argc_);
ObjOperandId objArgId = writer.guardToObject(argId);
writer.isPackedArrayResult(objArgId);
// This stub does not need to be monitored, because it always
// returns a boolean.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("IsPackedArray");
return AttachDecision::Attach;
@@ -5915,11 +5857,7 @@ AttachDecision CallIRGenerator::tryAttachIsCallable(HandleFunction callee) {
// Check if the argument is callable and return result.
ValOperandId argId = writer.loadArgumentFixedSlot(ArgumentKind::Arg0, argc_);
writer.isCallableResult(argId);
// This stub does not need to be monitored, because it always
// returns a boolean.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("IsCallable");
return AttachDecision::Attach;
@@ -5945,11 +5883,7 @@ AttachDecision CallIRGenerator::tryAttachIsConstructor(HandleFunction callee) {
// Check if the argument is a constructor and return result.
writer.isConstructorResult(objId);
// This stub does not need to be monitored, because it always
// returns a boolean.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("IsConstructor");
return AttachDecision::Attach;
@@ -5974,10 +5908,7 @@ AttachDecision CallIRGenerator::tryAttachIsCrossRealmArrayConstructor(
ObjOperandId objId = writer.guardToObject(argId);
writer.guardIsNotProxy(objId);
writer.isCrossRealmArrayConstructorResult(objId);
// This stub does not need to be monitored, it always returns a boolean.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("IsCrossRealmArrayConstructor");
return AttachDecision::Attach;
@@ -6012,7 +5943,6 @@ AttachDecision CallIRGenerator::tryAttachGuardToClass(HandleFunction callee,
// Monitor the returned object.
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("GuardToClass");
return AttachDecision::Attach;
@@ -6044,10 +5974,7 @@ AttachDecision CallIRGenerator::tryAttachHasClass(HandleFunction callee,
}
writer.hasClassResult(objId, clasp);
// Return without type monitoring, because this always returns a boolean.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("HasClass");
return AttachDecision::Attach;
@@ -6085,7 +6012,6 @@ AttachDecision CallIRGenerator::tryAttachRegExpMatcherSearcherTester(
case InlinableNative::RegExpMatcher:
writer.callRegExpMatcherResult(reId, inputId, lastIndexId);
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("RegExpMatcher");
break;
@@ -6093,7 +6019,6 @@ AttachDecision CallIRGenerator::tryAttachRegExpMatcherSearcherTester(
// No type monitoring because this always returns an int32.
writer.callRegExpSearcherResult(reId, inputId, lastIndexId);
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("RegExpSearcher");
break;
@@ -6101,7 +6026,6 @@ AttachDecision CallIRGenerator::tryAttachRegExpMatcherSearcherTester(
// No type monitoring because this always returns an int32.
writer.callRegExpTesterResult(reId, inputId, lastIndexId);
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("RegExpTester");
break;
@@ -6127,10 +6051,7 @@ AttachDecision CallIRGenerator::tryAttachRegExpPrototypeOptimizable(
ObjOperandId protoId = writer.guardToObject(arg0Id);
writer.regExpPrototypeOptimizableResult(protoId);
// No type monitoring because this always returns a boolean.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("RegExpPrototypeOptimizable");
return AttachDecision::Attach;
@@ -6155,10 +6076,7 @@ AttachDecision CallIRGenerator::tryAttachRegExpInstanceOptimizable(
ObjOperandId protoId = writer.guardToObject(arg1Id);
writer.regExpInstanceOptimizableResult(regexpId, protoId);
// No type monitoring because this always returns a boolean.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("RegExpInstanceOptimizable");
return AttachDecision::Attach;
@@ -6179,10 +6097,7 @@ AttachDecision CallIRGenerator::tryAttachGetFirstDollarIndex(
StringOperandId strId = writer.guardToString(arg0Id);
writer.getFirstDollarIndexResult(strId);
// No type monitoring because this always returns an int32.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("GetFirstDollarIndex");
return AttachDecision::Attach;
@@ -6211,10 +6126,7 @@ AttachDecision CallIRGenerator::tryAttachSubstringKernel(
Int32OperandId lengthId = writer.guardToInt32(arg2Id);
writer.callSubstringKernelResult(strId, beginId, lengthId);
// No type monitoring because this always returns a string.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("SubstringKernel");
return AttachDecision::Attach;
@@ -6245,10 +6157,7 @@ AttachDecision CallIRGenerator::tryAttachObjectHasPrototype(
writer.guardProto(objId, proto);
writer.loadBooleanResult(true);
// No type monitoring because this always returns a boolean.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("ObjectHasPrototype");
return AttachDecision::Attach;
@@ -6273,11 +6182,7 @@ AttachDecision CallIRGenerator::tryAttachString(HandleFunction callee) {
// Return the string.
writer.loadStringResult(strId);
// This stub does not need to be monitored, because it always
// returns a string.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("String");
return AttachDecision::Attach;
@@ -6319,7 +6224,6 @@ AttachDecision CallIRGenerator::tryAttachStringConstructor(
writer.newStringObjectResult(templateObj, strId);
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("StringConstructor");
return AttachDecision::Attach;
@@ -6350,10 +6254,7 @@ AttachDecision CallIRGenerator::tryAttachStringToStringValueOf(
// Return the string
writer.loadStringResult(strId);
// This stub doesn't need to be monitored, because it always returns a string.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("StringToStringValueOf");
return AttachDecision::Attach;
@@ -6382,10 +6283,7 @@ AttachDecision CallIRGenerator::tryAttachStringReplaceString(
StringOperandId replacementId = writer.guardToString(arg2Id);
writer.stringReplaceStringResult(strId, patternId, replacementId);
// No type monitoring because this always returns a string.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("StringReplaceString");
return AttachDecision::Attach;
@@ -6416,9 +6314,7 @@ AttachDecision CallIRGenerator::tryAttachStringSplitString(
StringOperandId separatorId = writer.guardToString(arg1Id);
writer.stringSplitStringResult(strId, separatorId, group);
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("StringSplitString");
return AttachDecision::Attach;
@@ -6460,11 +6356,6 @@ AttachDecision CallIRGenerator::tryAttachStringChar(HandleFunction callee,
writer.returnFromIC();
// This stub does not need to be monitored, because it always
// returns a string for charAt or int32_t for charCodeAt.
// The stack typeset will be updated when we attach the stub.
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
if (kind == StringChar::CodeAt) {
trackAttached("StringCharCodeAt");
} else {
@@ -6502,11 +6393,7 @@ AttachDecision CallIRGenerator::tryAttachStringFromCharCode(
// Return string created from code.
writer.stringFromCharCodeResult(codeId);
// This stub does not need to be monitored, because it always
// returns a string.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("StringFromCharCode");
return AttachDecision::Attach;
@@ -6537,10 +6424,7 @@ AttachDecision CallIRGenerator::tryAttachStringFromCodePoint(
// Return string created from code point.
writer.stringFromCodePointResult(codeId);
// This stub doesn't need to be monitored, because it always returns a string.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("StringFromCodePoint");
return AttachDecision::Attach;
@@ -6571,10 +6455,7 @@ AttachDecision CallIRGenerator::tryAttachStringToLowerCase(
// Return string converted to lower-case.
writer.stringToLowerCaseResult(strId);
// This stub doesn't need to be monitored, because it always returns a string.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("StringToLowerCase");
return AttachDecision::Attach;
@@ -6605,10 +6486,7 @@ AttachDecision CallIRGenerator::tryAttachStringToUpperCase(
// Return string converted to upper-case.
writer.stringToUpperCaseResult(strId);
// This stub doesn't need to be monitored, because it always returns a string.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("StringToUpperCase");
return AttachDecision::Attach;
@@ -6634,7 +6512,6 @@ AttachDecision CallIRGenerator::tryAttachMathRandom(HandleFunction callee) {
writer.mathRandomResult(rng);
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("MathRandom");
return AttachDecision::Attach;
@@ -6668,11 +6545,7 @@ AttachDecision CallIRGenerator::tryAttachMathAbs(HandleFunction callee) {
writer.mathAbsNumberResult(numberId);
}
// The INT_MIN case and implementation details of the C++ abs
// make this a bit tricky. We probably can just remove monitoring
// in the future completely, so do the easy thing right now.
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("MathAbs");
return AttachDecision::Attach;
@@ -6701,10 +6574,7 @@ AttachDecision CallIRGenerator::tryAttachMathClz32(HandleFunction callee) {
int32Id = writer.truncateDoubleToUInt32(numId);
}
writer.mathClz32Result(int32Id);
// Math.clz32 always returns an int32 so we don't need type monitoring.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("MathClz32");
return AttachDecision::Attach;
@@ -6742,10 +6612,7 @@ AttachDecision CallIRGenerator::tryAttachMathSign(HandleFunction callee) {
}
}
// The stub's return type matches the current return value so we don't need
// type monitoring.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("MathSign");
return AttachDecision::Attach;
@@ -6778,10 +6645,7 @@ AttachDecision CallIRGenerator::tryAttachMathImul(HandleFunction callee) {
int32Arg1Id = writer.truncateDoubleToUInt32(numArg1Id);
}
writer.mathImulResult(int32Arg0Id, int32Arg1Id);
// Math.imul always returns int32 so we don't need type monitoring.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("MathImul");
return AttachDecision::Attach;
@@ -6815,7 +6679,6 @@ AttachDecision CallIRGenerator::tryAttachMathFloor(HandleFunction callee) {
}
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("MathFloor");
return AttachDecision::Attach;
@@ -6849,7 +6712,6 @@ AttachDecision CallIRGenerator::tryAttachMathCeil(HandleFunction callee) {
}
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("MathCeil");
return AttachDecision::Attach;
@@ -6883,7 +6745,6 @@ AttachDecision CallIRGenerator::tryAttachMathTrunc(HandleFunction callee) {
}
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("MathTrunc");
return AttachDecision::Attach;
@@ -6917,7 +6778,6 @@ AttachDecision CallIRGenerator::tryAttachMathRound(HandleFunction callee) {
}
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("MathRound");
return AttachDecision::Attach;
@@ -6942,7 +6802,6 @@ AttachDecision CallIRGenerator::tryAttachMathSqrt(HandleFunction callee) {
// Math.sqrt always returns a double so we don't need type monitoring.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("MathSqrt");
return AttachDecision::Attach;
@@ -6964,10 +6823,7 @@ AttachDecision CallIRGenerator::tryAttachMathFRound(HandleFunction callee) {
writer.loadArgumentFixedSlot(ArgumentKind::Arg0, argc_);
NumberOperandId numberId = writer.guardIsNumber(argumentId);
writer.mathFRoundNumberResult(numberId);
// Math.fround always returns a double so we don't need type monitoring.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("MathFRound");
return AttachDecision::Attach;
@@ -7023,7 +6879,6 @@ AttachDecision CallIRGenerator::tryAttachMathPow(HandleFunction callee) {
}
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("MathPow");
return AttachDecision::Attach;
@@ -7079,9 +6934,7 @@ AttachDecision CallIRGenerator::tryAttachMathHypot(HandleFunction callee) {
MOZ_CRASH("Unexpected number of arguments to hypot function.");
}
// Math.hypot always returns a double so we don't need type monitoring.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("MathHypot");
return AttachDecision::Attach;
@@ -7106,10 +6959,7 @@ AttachDecision CallIRGenerator::tryAttachMathATan2(HandleFunction callee) {
NumberOperandId xNumberId = writer.guardIsNumber(xId);
writer.mathAtan2NumberResult(yNumberId, xNumberId);
// Math.atan2 always returns a double so we don't need type monitoring.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("MathAtan2");
return AttachDecision::Attach;
@@ -7160,7 +7010,6 @@ AttachDecision CallIRGenerator::tryAttachMathMinMax(HandleFunction callee,
}
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached(isMax ? "MathMax" : "MathMin");
return AttachDecision::Attach;
@@ -7187,10 +7036,7 @@ AttachDecision CallIRGenerator::tryAttachMathFunction(HandleFunction callee,
writer.loadArgumentFixedSlot(ArgumentKind::Arg0, argc_);
NumberOperandId numberId = writer.guardIsNumber(argumentId);
writer.mathFunctionNumberResult(numberId, fun);
// These functions always return a double so we don't need type monitoring.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("MathFunction");
return AttachDecision::Attach;
@@ -7238,10 +7084,7 @@ AttachDecision CallIRGenerator::tryAttachNumberToString(HandleFunction callee) {
// Return the string.
writer.loadStringResult(strId);
// This stub doesn't need to be monitored, because it always returns a string.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("NumberToString");
return AttachDecision::Attach;
@@ -7269,9 +7112,7 @@ AttachDecision CallIRGenerator::tryAttachReflectGetPrototypeOf(
ObjOperandId objId = writer.guardToObject(argumentId);
writer.reflectGetPrototypeOfResult(objId);
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("ReflectGetPrototypeOf");
return AttachDecision::Attach;
@@ -7376,11 +7217,7 @@ AttachDecision CallIRGenerator::tryAttachAtomicsCompareExchange(
writer.atomicsCompareExchangeResult(objId, int32IndexId, int32ExpectedId,
int32ReplacementId, typedArray->type());
// This stub doesn't need to be monitored, because it always returns an int32
// or, for uint32, a double.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("AtomicsCompareExchange");
return AttachDecision::Attach;
@@ -7457,11 +7294,7 @@ AttachDecision CallIRGenerator::tryAttachAtomicsExchange(
writer.atomicsExchangeResult(objId, int32IndexId, int32ValueId,
typedArray->type());
// This stub doesn't need to be monitored, because it always returns an int32
// or, for uint32, a double.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("AtomicsExchange");
return AttachDecision::Attach;
@@ -7479,11 +7312,7 @@ AttachDecision CallIRGenerator::tryAttachAtomicsAdd(HandleFunction callee) {
writer.atomicsAddResult(objId, int32IndexId, int32ValueId,
typedArray->type());
// This stub doesn't need to be monitored, because it always returns an int32
// or, for uint32, a double.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("AtomicsAdd");
return AttachDecision::Attach;
@@ -7501,11 +7330,7 @@ AttachDecision CallIRGenerator::tryAttachAtomicsSub(HandleFunction callee) {
writer.atomicsSubResult(objId, int32IndexId, int32ValueId,
typedArray->type());
// This stub doesn't need to be monitored, because it always returns an int32
// or, for uint32, a double.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("AtomicsSub");
return AttachDecision::Attach;
@@ -7523,11 +7348,7 @@ AttachDecision CallIRGenerator::tryAttachAtomicsAnd(HandleFunction callee) {
writer.atomicsAndResult(objId, int32IndexId, int32ValueId,
typedArray->type());
// This stub doesn't need to be monitored, because it always returns an int32
// or, for uint32, a double.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("AtomicsAnd");
return AttachDecision::Attach;
@@ -7544,11 +7365,7 @@ AttachDecision CallIRGenerator::tryAttachAtomicsOr(HandleFunction callee) {
auto* typedArray = &args_[0].toObject().as<TypedArrayObject>();
writer.atomicsOrResult(objId, int32IndexId, int32ValueId, typedArray->type());
// This stub doesn't need to be monitored, because it always returns an int32
// or, for uint32, a double.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("AtomicsOr");
return AttachDecision::Attach;
@@ -7566,11 +7383,7 @@ AttachDecision CallIRGenerator::tryAttachAtomicsXor(HandleFunction callee) {
writer.atomicsXorResult(objId, int32IndexId, int32ValueId,
typedArray->type());
// This stub doesn't need to be monitored, because it always returns an int32
// or, for uint32, a double.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("AtomicsXor");
return AttachDecision::Attach;
@@ -7615,11 +7428,7 @@ AttachDecision CallIRGenerator::tryAttachAtomicsLoad(HandleFunction callee) {
Int32OperandId int32IndexId = writer.guardToInt32Index(indexId);
writer.atomicsLoadResult(objId, int32IndexId, typedArray->type());
// This stub doesn't need to be monitored, because it always returns an int32
// or, for uint32, a double.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("AtomicsLoad");
return AttachDecision::Attach;
@@ -7687,11 +7496,7 @@ AttachDecision CallIRGenerator::tryAttachAtomicsStore(HandleFunction callee) {
writer.atomicsStoreResult(objId, int32IndexId, int32ValueId,
typedArray->type());
// This stub doesn't need to be monitored, because it always returns an int32
// or the result is not observed.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("AtomicsStore");
return AttachDecision::Attach;
@@ -7720,10 +7525,7 @@ AttachDecision CallIRGenerator::tryAttachAtomicsIsLockFree(
Int32OperandId int32ValueId = writer.guardToInt32(valueId);
writer.atomicsIsLockFreeResult(int32ValueId);
// This stub doesn't need to be monitored, because it always returns a bool.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("AtomicsIsLockFree");
return AttachDecision::Attach;
@@ -7750,9 +7552,7 @@ AttachDecision CallIRGenerator::tryAttachBoolean(HandleFunction callee) {
writer.loadValueTruthyResult(valId);
}
// This stub doesn't need to be monitored, because it always returns a bool.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("Boolean");
return AttachDecision::Attach;
@@ -7772,10 +7572,7 @@ AttachDecision CallIRGenerator::tryAttachBailout(HandleFunction callee) {
writer.bailout();
writer.loadUndefinedResult();
// This stub doesn't need to be monitored, it always returns undefined.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("Bailout");
return AttachDecision::Attach;
@@ -7797,10 +7594,7 @@ AttachDecision CallIRGenerator::tryAttachAssertFloat32(HandleFunction callee) {
// NOP when not in IonMonkey.
writer.loadUndefinedResult();
// This stub doesn't need to be monitored, it always returns undefined.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("AssertFloat32");
return AttachDecision::Attach;
@@ -7826,10 +7620,7 @@ AttachDecision CallIRGenerator::tryAttachAssertRecoveredOnBailout(
ValOperandId valId = writer.loadArgumentFixedSlot(ArgumentKind::Arg0, argc_);
writer.assertRecoveredOnBailoutResult(valId, mustBeRecovered);
// This stub doesn't need to be monitored, it always returns undefined.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("AssertRecoveredOnBailout");
return AttachDecision::Attach;
@@ -7927,10 +7718,7 @@ AttachDecision CallIRGenerator::tryAttachObjectIs(HandleFunction callee) {
}
}
// This stub does not need to be monitored, because it always returns a
// boolean.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("ObjectIs");
return AttachDecision::Attach;
@@ -7962,11 +7750,7 @@ AttachDecision CallIRGenerator::tryAttachObjectIsPrototypeOf(
ValOperandId argId = writer.loadArgumentFixedSlot(ArgumentKind::Arg0, argc_);
writer.loadInstanceOfObjectResult(argId, thisObjId);
// This stub does not need to be monitored, because it always returns a
// boolean.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("ObjectIsPrototypeOf");
return AttachDecision::Attach;
@@ -8029,7 +7813,6 @@ AttachDecision CallIRGenerator::tryAttachFunCall(HandleFunction callee) {
}
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
if (isScripted) {
trackAttached("Scripted fun_call");
@@ -8054,10 +7837,7 @@ AttachDecision CallIRGenerator::tryAttachIsTypedArray(HandleFunction callee,
ValOperandId argId = writer.loadArgumentFixedSlot(ArgumentKind::Arg0, argc_);
ObjOperandId objArgId = writer.guardToObject(argId);
writer.isTypedArrayResult(objArgId, isPossiblyWrapped);
// This stub does not need to be monitored because it always returns a bool.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached(isPossiblyWrapped ? "IsPossiblyWrappedTypedArray"
: "IsTypedArray");
@@ -8078,10 +7858,7 @@ AttachDecision CallIRGenerator::tryAttachIsTypedArrayConstructor(
ValOperandId argId = writer.loadArgumentFixedSlot(ArgumentKind::Arg0, argc_);
ObjOperandId objArgId = writer.guardToObject(argId);
writer.isTypedArrayConstructorResult(objArgId);
// This stub does not need to be monitored because it always returns a bool.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("IsTypedArrayConstructor");
return AttachDecision::Attach;
@@ -8102,10 +7879,7 @@ AttachDecision CallIRGenerator::tryAttachTypedArrayByteOffset(
ValOperandId argId = writer.loadArgumentFixedSlot(ArgumentKind::Arg0, argc_);
ObjOperandId objArgId = writer.guardToObject(argId);
writer.typedArrayByteOffsetResult(objArgId);
// This stub does not need to be monitored because it always returns int32.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("TypedArrayByteOffset");
return AttachDecision::Attach;
@@ -8126,10 +7900,7 @@ AttachDecision CallIRGenerator::tryAttachTypedArrayElementShift(
ValOperandId argId = writer.loadArgumentFixedSlot(ArgumentKind::Arg0, argc_);
ObjOperandId objArgId = writer.guardToObject(argId);
writer.typedArrayElementShiftResult(objArgId);
// This stub does not need to be monitored because it always returns int32.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("TypedArrayElementShift");
return AttachDecision::Attach;
@@ -8164,10 +7935,7 @@ AttachDecision CallIRGenerator::tryAttachTypedArrayLength(
// Note: the "getter" argument is a hint for IonBuilder. Just pass |callee|,
// the field isn't used for this intrinsic call.
writer.loadTypedArrayLengthResult(objArgId, callee);
// This stub does not need to be monitored because it always returns int32.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("TypedArrayLength");
return AttachDecision::Attach;
@@ -8200,10 +7968,7 @@ AttachDecision CallIRGenerator::tryAttachArrayBufferByteLength(
}
writer.loadArrayBufferByteLengthInt32Result(objArgId);
// This stub does not need to be monitored because it always returns int32.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("ArrayBufferByteLength");
return AttachDecision::Attach;
@@ -8220,10 +7985,7 @@ AttachDecision CallIRGenerator::tryAttachIsConstructing(HandleFunction callee) {
// Note: we don't need to call emitNativeCalleeGuard for intrinsics.
writer.frameIsConstructingResult();
// This stub does not need to be monitored, it always returns a boolean.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("IsConstructing");
return AttachDecision::Attach;
@@ -8253,10 +8015,7 @@ AttachDecision CallIRGenerator::tryAttachGetNextMapSetEntryForIterator(
ObjOperandId objResultArrId = writer.guardToObject(resultArrId);
writer.getNextMapSetEntryForIteratorResult(objIterId, objResultArrId, isMap);
// This stub does not need to be monitored, it always returns a boolean.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("GetNextMapSetEntryForIterator");
return AttachDecision::Attach;
@@ -8290,10 +8049,7 @@ AttachDecision CallIRGenerator::tryAttachFinishBoundFunctionInit(
writer.finishBoundFunctionInitResult(objBoundId, objTargetId,
int32ArgCountId);
// This stub does not need to be monitored, it always returns |undefined|.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("FinishBoundFunctionInit");
return AttachDecision::Attach;
@@ -8321,7 +8077,6 @@ AttachDecision CallIRGenerator::tryAttachNewArrayIterator(
}
writer.newArrayIteratorResult(templateObj);
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("NewArrayIterator");
return AttachDecision::Attach;
@@ -8349,7 +8104,6 @@ AttachDecision CallIRGenerator::tryAttachNewStringIterator(
}
writer.newStringIteratorResult(templateObj);
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("NewStringIterator");
return AttachDecision::Attach;
@@ -8377,7 +8131,6 @@ AttachDecision CallIRGenerator::tryAttachNewRegExpStringIterator(
}
writer.newRegExpStringIteratorResult(templateObj);
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("NewRegExpStringIterator");
return AttachDecision::Attach;
@@ -8412,10 +8165,7 @@ AttachDecision CallIRGenerator::tryAttachArrayIteratorPrototypeOptimizable(
// Ensure that proto[slot] == nextFun.
writer.guardDynamicSlotIsSpecificObject(protoId, nextId, slot);
writer.loadBooleanResult(true);
// This stub does not need to be monitored, it always returns a boolean.
writer.returnFromIC();
cacheIRStubKind_ = BaselineCacheIRStubKind::Regular;
trackAttached("ArrayIteratorPrototypeOptimizable");
return AttachDecision::Attach;
@@ -8459,7 +8209,6 @@ AttachDecision CallIRGenerator::tryAttachObjectCreate(HandleFunction callee) {
writer.objectCreateResult(templateObj);
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("ObjectCreate");
return AttachDecision::Attach;
@@ -8521,7 +8270,6 @@ AttachDecision CallIRGenerator::tryAttachArrayConstructor(
}
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("ArrayConstructor");
return AttachDecision::Attach;
@@ -8624,7 +8372,6 @@ AttachDecision CallIRGenerator::tryAttachTypedArrayConstructor(
}
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("TypedArrayConstructor");
return AttachDecision::Attach;
@@ -8717,7 +8464,6 @@ AttachDecision CallIRGenerator::tryAttachFunApply(HandleFunction calleeFunc) {
}
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
if (isScripted) {
trackAttached("Scripted fun_apply");
@@ -8845,7 +8591,6 @@ AttachDecision CallIRGenerator::tryAttachWasmCall(HandleFunction calleeFunc) {
inst.object());
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("WasmCall");
return AttachDecision::Attach;
@@ -9413,7 +9158,6 @@ AttachDecision CallIRGenerator::tryAttachCallScripted(
writer.callScriptedFunction(calleeObjId, argcId, flags);
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
if (isSpecialized) {
trackAttached("Call scripted func");
} else {
@@ -9594,7 +9338,6 @@ AttachDecision CallIRGenerator::tryAttachCallNative(HandleFunction calleeFunc) {
}
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
if (templateObj) {
MOZ_ASSERT(isSpecialized);
@@ -9644,7 +9387,6 @@ AttachDecision CallIRGenerator::tryAttachCallHook(HandleObject calleeObj) {
writer.callClassHook(calleeObjId, argcId, hook, flags);
writer.typeMonitorResult();
cacheIRStubKind_ = BaselineCacheIRStubKind::Monitored;
trackAttached("Call native func");
return AttachDecision::Attach;
+1 -3
View File
@@ -1447,6 +1447,7 @@ class MOZ_RAII BindNameIRGenerator : public IRGenerator {
};
// Information used by SetProp/SetElem stubs to check/update property types.
// TODO(no-TI): remove.
class MOZ_RAII PropertyTypeCheckInfo {
RootedObjectGroup group_;
RootedId id_;
@@ -1745,7 +1746,6 @@ class MOZ_RAII CallIRGenerator : public IRGenerator {
HandleValue newTarget_;
HandleValueArray args_;
PropertyTypeCheckInfo typeCheckInfo_;
BaselineCacheIRStubKind cacheIRStubKind_;
ScriptedThisResult getThisForScripted(HandleFunction calleeFunc,
MutableHandleObject result);
@@ -1887,8 +1887,6 @@ class MOZ_RAII CallIRGenerator : public IRGenerator {
AttachDecision tryAttachDeferredStub(HandleValue result);
BaselineCacheIRStubKind cacheIRStubKind() const { return cacheIRStubKind_; }
const PropertyTypeCheckInfo* typeCheckInfo() const { return &typeCheckInfo_; }
};
+16 -39
View File
@@ -434,13 +434,6 @@ static bool ComputeBinarySearchMid(ICEntries entries, uint32_t pcOffset,
if (entryOffset < pcOffset) {
return 1;
}
if (entry.isForPrologue()) {
// Prologue ICEntries are used for function argument type checks.
// Ignore these entries and return 1 because these entries appear in
// the ICEntry list before the other ICEntry (if any) at offset 0.
MOZ_ASSERT(entryOffset == 0);
return 1;
}
return 0;
},
loc);
@@ -458,7 +451,6 @@ ICEntry* ICScript::maybeICEntryFromPCOffset(uint32_t pcOffset) {
MOZ_ASSERT(mid < numICEntries());
ICEntry& entry = icEntry(mid);
MOZ_ASSERT(!entry.isForPrologue());
MOZ_ASSERT(entry.pcOffset() == pcOffset);
return &entry;
}
@@ -479,7 +471,7 @@ ICEntry* ICScript::maybeICEntryFromPCOffset(uint32_t pcOffset,
ICEntry* lastEntry = &icEntry(numICEntries() - 1);
ICEntry* curEntry = prevLookedUpEntry;
while (curEntry >= firstEntry && curEntry <= lastEntry) {
if (curEntry->pcOffset() == pcOffset && !curEntry->isForPrologue()) {
if (curEntry->pcOffset() == pcOffset) {
return curEntry;
}
curEntry++;
@@ -503,7 +495,7 @@ ICEntry* ICScript::interpreterICEntryFromPCOffset(uint32_t pcOffset) {
// pcOffset does not necessarily have an ICEntry, so we want to return the
// first ICEntry for which the following is true:
//
// !entry.isForPrologue() && entry.pcOffset() >= pcOffset
// entry.pcOffset() >= pcOffset
//
// Fortunately, ComputeBinarySearchMid returns exactly this entry.
@@ -512,7 +504,6 @@ ICEntry* ICScript::interpreterICEntryFromPCOffset(uint32_t pcOffset) {
if (mid < numICEntries()) {
ICEntry& entry = icEntry(mid);
MOZ_ASSERT(!entry.isForPrologue());
MOZ_ASSERT(entry.pcOffset() >= pcOffset);
return &entry;
}
@@ -551,39 +542,25 @@ void ICScript::purgeOptimizedStubs(Zone* zone) {
lastStub = lastStub->next();
}
if (lastStub->isFallback()) {
// Unlink all stubs allocated in the optimized space.
ICStub* stub = entry.firstStub();
ICStub* prev = nullptr;
MOZ_ASSERT(lastStub->isFallback());
while (stub->next()) {
if (!stub->allocatedInFallbackSpace()) {
// Note: this is called when discarding JIT code, after invalidating
// all Warp code, so we don't need to check for that here.
lastStub->toFallbackStub()->clearUsedByTranspiler();
lastStub->toFallbackStub()->unlinkStubDontInvalidateWarp(zone, prev,
stub);
stub = stub->next();
continue;
}
// Unlink all stubs allocated in the optimized space.
ICStub* stub = entry.firstStub();
ICStub* prev = nullptr;
prev = stub;
while (stub->next()) {
if (!stub->allocatedInFallbackSpace()) {
// Note: this is called when discarding JIT code, after invalidating
// all Warp code, so we don't need to check for that here.
lastStub->toFallbackStub()->clearUsedByTranspiler();
lastStub->toFallbackStub()->unlinkStubDontInvalidateWarp(zone, prev,
stub);
stub = stub->next();
continue;
}
if (lastStub->isMonitoredFallback()) {
// Monitor stubs can't make calls, so are always in the
// optimized stub space.
ICTypeMonitor_Fallback* lastMonStub =
lastStub->toMonitoredFallbackStub()->maybeFallbackMonitorStub();
if (lastMonStub) {
lastMonStub->resetMonitorStubChain(zone);
}
}
} else if (lastStub->isTypeMonitor_Fallback()) {
lastStub->toTypeMonitor_Fallback()->resetMonitorStubChain(zone);
} else {
MOZ_CRASH("Unknown fallback stub");
prev = stub;
stub = stub->next();
}
}
-2
View File
@@ -121,7 +121,6 @@ namespace jit {
_(DoSpreadCallFallback, js::jit::DoSpreadCallFallback) \
_(DoStringToInt64, js::jit::DoStringToInt64) \
_(DoTrialInlining, js::jit::DoTrialInlining) \
_(DoTypeUpdateFallback, js::jit::DoTypeUpdateFallback) \
_(EnterWith, js::jit::EnterWith) \
_(FinalSuspend, js::jit::FinalSuspend) \
_(FinishBoundFunctionInit, JSFunction::finishBoundFunctionInit) \
@@ -307,7 +306,6 @@ namespace jit {
_(DoSetPropFallback, js::jit::DoSetPropFallback, 1) \
_(DoToBoolFallback, js::jit::DoToBoolFallback, 0) \
_(DoToPropertyKeyFallback, js::jit::DoToPropertyKeyFallback, 0) \
_(DoTypeMonitorFallback, js::jit::DoTypeMonitorFallback, 0) \
_(DoTypeOfFallback, js::jit::DoTypeOfFallback, 0) \
_(DoUnaryArithFallback, js::jit::DoUnaryArithFallback, 1)
-16
View File
@@ -39,22 +39,6 @@ inline void EmitCallIC(MacroAssembler& masm, CodeOffset* callOffset) {
*callOffset = CodeOffset(masm.currentOffset());
}
inline void EmitEnterTypeMonitorIC(
MacroAssembler& masm,
size_t monitorStubOffset = ICMonitoredStub::offsetOfFirstMonitorStub()) {
// This is expected to be called from within an IC, when ICStubReg is
// properly initialized to point to the stub.
masm.loadPtr(Address(ICStubReg, (uint32_t)monitorStubOffset), ICStubReg);
// Load stubcode pointer from BaselineStubEntry.
// R2 won't be active when we call ICs, so we can use r0.
static_assert(R2 == ValueOperand(r1, r0));
masm.loadPtr(Address(ICStubReg, ICStub::offsetOfStubCode()), r0);
// Jump to the stubcode.
masm.branch(r0);
}
inline void EmitReturnFromIC(MacroAssembler& masm) { masm.ma_mov(lr, pc); }
inline void EmitBaselineLeaveStubFrame(MacroAssembler& masm,
-16
View File
@@ -39,22 +39,6 @@ inline void EmitCallIC(MacroAssembler& masm, CodeOffset* callOffset) {
*callOffset = CodeOffset(masm.currentOffset());
}
inline void EmitEnterTypeMonitorIC(
MacroAssembler& masm,
size_t monitorStubOffset = ICMonitoredStub::offsetOfFirstMonitorStub()) {
// This is expected to be called from within an IC, when ICStubReg is
// properly initialized to point to the stub.
masm.loadPtr(Address(ICStubReg, (uint32_t)monitorStubOffset), ICStubReg);
// Load stubcode pointer from BaselineStubEntry.
// R2 won't be active when we call ICs, so we can use r0.
static_assert(R2 == ValueOperand(r0));
masm.loadPtr(Address(ICStubReg, ICStub::offsetOfStubCode()), r0);
// Jump to the stubcode.
masm.Br(x0);
}
inline void EmitReturnFromIC(MacroAssembler& masm) {
masm.abiret(); // Defaults to lr.
}
@@ -50,21 +50,6 @@ inline void EmitCallIC(MacroAssembler& masm, CodeOffset* callOffset) {
*callOffset = CodeOffset(masm.currentOffset());
}
inline void EmitEnterTypeMonitorIC(
MacroAssembler& masm,
size_t monitorStubOffset = ICMonitoredStub::offsetOfFirstMonitorStub()) {
// This is expected to be called from within an IC, when ICStubReg
// is properly initialized to point to the stub.
masm.loadPtr(Address(ICStubReg, (uint32_t)monitorStubOffset), ICStubReg);
// Load stubcode pointer from BaselineStubEntry.
// R2 won't be active when we call ICs, so we can use it.
masm.loadPtr(Address(ICStubReg, ICStub::offsetOfStubCode()), R2.scratchReg());
// Jump to the stubcode.
masm.branch(R2.scratchReg());
}
inline void EmitReturnFromIC(MacroAssembler& masm) { masm.branch(ra); }
inline void EmitBaselineLeaveStubFrame(MacroAssembler& masm,
-3
View File
@@ -15,9 +15,6 @@ static const size_t ICStackValueOffset = 0;
inline void EmitRestoreTailCallReg(MacroAssembler&) { MOZ_CRASH(); }
inline void EmitRepushTailCallReg(MacroAssembler&) { MOZ_CRASH(); }
inline void EmitCallIC(MacroAssembler&, CodeOffset*) { MOZ_CRASH(); }
inline void EmitEnterTypeMonitorIC(MacroAssembler&, size_t v = 0) {
MOZ_CRASH();
}
inline void EmitReturnFromIC(MacroAssembler&) { MOZ_CRASH(); }
inline void EmitBaselineLeaveStubFrame(MacroAssembler&, bool v = false) {
MOZ_CRASH();
-11
View File
@@ -34,17 +34,6 @@ inline void EmitCallIC(MacroAssembler& masm, CodeOffset* callOffset) {
*callOffset = CodeOffset(masm.currentOffset());
}
inline void EmitEnterTypeMonitorIC(
MacroAssembler& masm,
size_t monitorStubOffset = ICMonitoredStub::offsetOfFirstMonitorStub()) {
// This is expected to be called from within an IC, when ICStubReg
// is properly initialized to point to the stub.
masm.loadPtr(Address(ICStubReg, (int32_t)monitorStubOffset), ICStubReg);
// Jump to the stubcode.
masm.jmp(Operand(ICStubReg, (int32_t)ICStub::offsetOfStubCode()));
}
inline void EmitReturnFromIC(MacroAssembler& masm) { masm.ret(); }
inline void EmitBaselineLeaveStubFrame(MacroAssembler& masm,
-11
View File
@@ -34,17 +34,6 @@ inline void EmitCallIC(MacroAssembler& masm, CodeOffset* callOffset) {
*callOffset = CodeOffset(masm.currentOffset());
}
inline void EmitEnterTypeMonitorIC(
MacroAssembler& masm,
size_t monitorStubOffset = ICMonitoredStub::offsetOfFirstMonitorStub()) {
// This is expected to be called from within an IC, when ICStubReg
// is properly initialized to point to the stub.
masm.loadPtr(Address(ICStubReg, (int32_t)monitorStubOffset), ICStubReg);
// Jump to the stubcode.
masm.jmp(Operand(ICStubReg, (int32_t)ICStub::offsetOfStubCode()));
}
inline void EmitReturnFromIC(MacroAssembler& masm) { masm.ret(); }
inline void EmitBaselineLeaveStubFrame(MacroAssembler& masm,
-3
View File
@@ -3490,8 +3490,6 @@ static MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER bool Interpret(JSContext* cx,
if (!GetImportOperation(cx, envChain, script, REGS.pc, rval)) {
goto error;
}
JitScript::MonitorBytecodeType(cx, script, REGS.pc, rval);
}
END_CASE(GetImport)
@@ -3659,7 +3657,6 @@ static MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER bool Interpret(JSContext* cx,
}
#endif
PUSH_COPY(val);
JitScript::MonitorBytecodeType(cx, script, REGS.pc, REGS.sp[-1]);
}
END_CASE(GetAliasedVar)
+2 -2
View File
@@ -2941,7 +2941,7 @@
* Operands: uint8_t hops, uint24_t slot
* Stack: => aliasedVar
*/ \
MACRO(GetAliasedVar, get_aliased_var, NULL, 5, 0, 1, JOF_ENVCOORD|JOF_NAME|JOF_TYPESET|JOF_IC) \
MACRO(GetAliasedVar, get_aliased_var, NULL, 5, 0, 1, JOF_ENVCOORD|JOF_NAME) \
/*
* Get the value of a module import by name and pushes it onto the stack.
*
@@ -2950,7 +2950,7 @@
* Operands: uint32_t nameIndex
* Stack: => val
*/ \
MACRO(GetImport, get_import, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME|JOF_TYPESET|JOF_IC) \
MACRO(GetImport, get_import, NULL, 5, 0, 1, JOF_ATOM|JOF_NAME) \
/*
* Get the value of a binding from the environment `env`. If the name is
* not bound in `env`, throw a ReferenceError.