Bug 1337773 - Add IonInIC r=jandem

MozReview-Commit-ID: BmHPnJnMjVP

--HG--
extra : rebase_source : d8ca3f631dd2da0bfb5b87b4db1ceac323f6131d
This commit is contained in:
Ted Campbell 2017-04-17 13:55:27 -04:00
Родитель 26f948c0f3
Коммит 8e7ddb1ceb
4 изменённых файлов: 98 добавлений и 2 удалений

Просмотреть файл

@ -158,6 +158,10 @@ typedef JSObject* (*IonBindNameICFn)(JSContext*, HandleScript, IonBindNameIC*, H
static const VMFunction IonBindNameICInfo =
FunctionInfo<IonBindNameICFn>(IonBindNameIC::update, "IonBindNameIC::update");
typedef bool (*IonInICFn)(JSContext*, HandleScript, IonInIC*, HandleValue, HandleObject, bool*);
static const VMFunction IonInICInfo =
FunctionInfo<IonInICFn>(IonInIC::update, "IonInIC::update");
void
CodeGenerator::visitOutOfLineICFallback(OutOfLineICFallback* ool)
{
@ -243,7 +247,24 @@ CodeGenerator::visitOutOfLineICFallback(OutOfLineICFallback* ool)
masm.jump(ool->rejoin());
return;
}
case CacheKind::In:
case CacheKind::In: {
IonInIC* inIC = ic->asInIC();
saveLive(lir);
pushArg(inIC->object());
pushArg(inIC->key());
icInfo_[cacheInfoIndex].icOffsetForPush = pushArgWithPatch(ImmWord(-1));
pushArg(ImmGCPtr(gen->info().script()));
callVM(IonInICInfo, lir);
StoreRegisterTo(inIC->output()).generate(this);
restoreLiveIgnore(lir, StoreRegisterTo(inIC->output()).clobbered());
masm.jump(ool->rejoin());
return;
}
case CacheKind::TypeOf:
MOZ_CRASH("Baseline-specific for now");
case CacheKind::HasOwn: {

Просмотреть файл

@ -440,7 +440,21 @@ IonCacheIRCompiler::init()
allocator.initInputLocation(0, ic->environment(), JSVAL_TYPE_OBJECT);
break;
}
case CacheKind::In:
case CacheKind::In: {
IonInIC* ic = ic_->asInIC();
Register output = ic->output();
available.add(output);
liveRegs_.emplace(ic->liveRegs());
outputUnchecked_.emplace(TypedOrValueRegister(MIRType::Boolean, AnyRegister(output)));
MOZ_ASSERT(numInputs == 2);
allocator.initInputLocation(0, ic->key());
allocator.initInputLocation(1, TypedOrValueRegister(MIRType::Object,
AnyRegister(ic->object())));
break;
}
case CacheKind::TypeOf:
MOZ_CRASH("Invalid cache");
case CacheKind::HasOwn: {

Просмотреть файл

@ -49,6 +49,7 @@ IonIC::scratchRegisterForEntryJump()
case CacheKind::BindName:
return asBindNameIC()->temp();
case CacheKind::In:
return asInIC()->temp();
case CacheKind::TypeOf:
MOZ_CRASH("Baseline-specific for now");
case CacheKind::HasOwn:
@ -371,6 +372,31 @@ IonHasOwnIC::update(JSContext* cx, HandleScript outerScript, IonHasOwnIC* ic,
return true;
}
/* static */ bool
IonInIC::update(JSContext* cx, HandleScript outerScript, IonInIC* ic,
HandleValue key, HandleObject obj, bool* res)
{
IonScript* ionScript = outerScript->ionScript();
if (ic->state().maybeTransition())
ic->discardStubs(cx->zone());
if (ic->state().canAttachStub()) {
bool attached = false;
RootedScript script(cx, ic->script());
RootedValue objV(cx, ObjectValue(*obj));
jsbytecode* pc = ic->pc();
HasPropIRGenerator gen(cx, script, pc, CacheKind::In, ic->state().mode(), key, objV);
if (gen.tryAttachStub())
ic->attachCacheIRStub(cx, gen.writerRef(), gen.cacheKind(), ionScript, &attached);
if (!attached)
ic->state().trackNotAttached();
}
return OperatorIn(cx, key, obj, res);
}
uint8_t*
IonICStub::stubDataStart()
{

Просмотреть файл

@ -61,6 +61,7 @@ class IonSetPropertyIC;
class IonGetNameIC;
class IonBindNameIC;
class IonHasOwnIC;
class IonInIC;
class IonIC
{
@ -152,6 +153,10 @@ class IonIC
MOZ_ASSERT(kind_ == CacheKind::HasOwn);
return (IonHasOwnIC*)this;
}
IonInIC* asInIC() {
MOZ_ASSERT(kind_ == CacheKind::In);
return (IonInIC*)this;
}
void updateBaseAddress(JitCode* code, MacroAssembler& masm);
@ -336,6 +341,36 @@ class IonHasOwnIC : public IonIC
HandleValue val, HandleValue idVal, int32_t* res);
};
class IonInIC : public IonIC
{
LiveRegisterSet liveRegs_;
ConstantOrRegister key_;
Register object_;
Register output_;
Register temp_;
public:
IonInIC(LiveRegisterSet liveRegs, const ConstantOrRegister& key,
Register object, Register output, Register temp)
: IonIC(CacheKind::In),
liveRegs_(liveRegs),
key_(key),
object_(object),
output_(output),
temp_(temp)
{ }
ConstantOrRegister key() const { return key_; }
Register object() const { return object_; }
Register output() const { return output_; }
Register temp() const { return temp_; }
LiveRegisterSet liveRegs() const { return liveRegs_; }
static MOZ_MUST_USE bool update(JSContext* cx, HandleScript outerScript, IonInIC* ic,
HandleValue key, HandleObject obj, bool* res);
};
} // namespace jit
} // namespace js