Bug 1214508: SharedStubs - Part 3: Enable the getprop stubs in ionmonkey, r=jandem

This commit is contained in:
Hannes Verschore 2015-11-17 17:57:49 +01:00
parent b7158ce8c9
commit a893db58e6
7 changed files with 49 additions and 2 deletions

View File

@ -25,6 +25,7 @@ namespace JS {
_(GetProp_InlineAccess) \
_(GetProp_Innerize) \
_(GetProp_InlineCache) \
_(GetProp_SharedCache) \
\
_(SetProp_CommonSetter) \
_(SetProp_TypedObject) \

View File

@ -1758,6 +1758,11 @@ CodeGenerator::visitUnarySharedStub(LUnarySharedStub* lir)
case JSOP_NEG:
emitSharedStub(ICStub::Kind::UnaryArith_Fallback, lir);
break;
case JSOP_CALLPROP:
case JSOP_GETPROP:
case JSOP_LENGTH:
emitSharedStub(ICStub::Kind::GetProp_Fallback, lir);
break;
default:
MOZ_CRASH("Unsupported jsop in shared stubs.");
}
@ -7969,6 +7974,11 @@ CodeGenerator::linkSharedStubs(JSContext* cx)
stub = stubCompiler.getStub(&stubSpace_);
break;
}
case ICStub::Kind::GetProp_Fallback: {
ICGetProp_Fallback::Compiler stubCompiler(cx, ICStubCompiler::Engine::IonMonkey);
stub = stubCompiler.getStub(&stubSpace_);
break;
}
default:
MOZ_CRASH("Unsupported shared stub.");
}

View File

@ -10888,6 +10888,11 @@ IonBuilder::jsop_getprop(PropertyName* name)
if (!getPropTryCache(&emitted, obj, name, barrier, types) || emitted)
return emitted;
// Try to emit a shared stub.
trackOptimizationAttempt(TrackedStrategy::GetProp_SharedCache);
if (!getPropTrySharedStub(&emitted, obj) || emitted)
return emitted;
// Emit a call.
MCallGetProperty* call = MCallGetProperty::New(alloc(), obj, name);
current->add(call);
@ -11838,6 +11843,27 @@ IonBuilder::getPropTryCache(bool* emitted, MDefinition* obj, PropertyName* name,
return true;
}
bool
IonBuilder::getPropTrySharedStub(bool* emitted, MDefinition* obj)
{
MOZ_ASSERT(*emitted == false);
// Try to emit a shared stub cache.
if (js_JitOptions.disableSharedStubs)
return true;
MInstruction* stub = MUnarySharedStub::New(alloc(), obj);
current->add(stub);
current->push(stub);
if (!resumeAfter(stub))
return false;
*emitted = true;
return true;
}
MDefinition*
IonBuilder::tryInnerizeWindow(MDefinition* obj)
{

View File

@ -455,6 +455,7 @@ class IonBuilder
TemporaryTypeSet* types);
bool getPropTryCache(bool* emitted, MDefinition* obj, PropertyName* name,
BarrierKind barrier, TemporaryTypeSet* types);
bool getPropTrySharedStub(bool* emitted, MDefinition* obj);
// jsop_setprop() helpers.
bool setPropTryCommonSetter(bool* emitted, MDefinition* obj,

View File

@ -171,6 +171,9 @@ class JitFrameIterator
bool isIonStub() const {
return type_ == JitFrame_IonStub;
}
bool isIonStubMaybeUnwound() const {
return type_ == JitFrame_IonStub || type_ == JitFrame_Unwound_IonStub;
}
bool isBailoutJS() const {
return type_ == JitFrame_Bailout;
}

View File

@ -1624,10 +1624,13 @@ GetPcScript(JSContext* cx, JSScript** scriptRes, jsbytecode** pcRes)
MOZ_ASSERT(it.isBaselineStub() || it.isBaselineJS() || it.isIonJS());
}
// Skip Baseline stub frames.
// Skip Baseline or Ion stub frames.
if (it.isBaselineStubMaybeUnwound()) {
++it;
MOZ_ASSERT(it.isBaselineJS());
} else if (it.isIonStubMaybeUnwound()) {
++it;
MOZ_ASSERT(it.isIonJS());
}
MOZ_ASSERT(it.isBaselineJS() || it.isIonJS());

View File

@ -3107,7 +3107,10 @@ ICGetProp_Fallback::Compiler::generateStubCode(MacroAssembler& masm)
void
ICGetProp_Fallback::Compiler::postGenerateStubCode(MacroAssembler& masm, Handle<JitCode*> code)
{
cx->compartment()->jitCompartment()->initBaselineGetPropReturnAddr(code->raw() + returnOffset_);
if (engine_ == Engine::Baseline) {
void* address = code->raw() + returnOffset_;
cx->compartment()->jitCompartment()->initBaselineGetPropReturnAddr(address);
}
}
bool