зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1352077 - Refactor IonBuilder.cpp::IsCallOpcode r=h4writer
MozReview-Commit-ID: F1tzVpLJOw9 --HG-- extra : rebase_source : 7ad5958963b6e5af70437e46dffeb42902fbfb0b
This commit is contained in:
Родитель
df9c9d0f27
Коммит
2e40b47644
|
@ -5771,25 +5771,21 @@ IonBuilder::compareTrySharedStub(bool* emitted, JSOp op, MDefinition* left, MDef
|
|||
return Ok();
|
||||
}
|
||||
|
||||
static bool
|
||||
IsCallOpcode(JSOp op)
|
||||
{
|
||||
// TODO: Support tracking optimizations for inlining a call and regular
|
||||
// optimization tracking at the same time.
|
||||
return op == JSOP_CALL || op == JSOP_CALL_IGNORES_RV || op == JSOP_CALLITER || op == JSOP_NEW ||
|
||||
op == JSOP_SUPERCALL || op == JSOP_EVAL || op == JSOP_STRICTEVAL;
|
||||
}
|
||||
|
||||
AbortReasonOr<Ok>
|
||||
IonBuilder::newArrayTryTemplateObject(bool* emitted, JSObject* templateObject, uint32_t length)
|
||||
{
|
||||
MOZ_ASSERT(*emitted == false);
|
||||
|
||||
if (!IsCallOpcode(JSOp(*pc)))
|
||||
// TODO: Support tracking optimizations for inlining a call and regular
|
||||
// optimization tracking at the same time. Currently just drop optimization
|
||||
// tracking when that happens.
|
||||
bool canTrackOptimization = !IsCallPC(pc);
|
||||
|
||||
if (canTrackOptimization)
|
||||
trackOptimizationAttempt(TrackedStrategy::NewArray_TemplateObject);
|
||||
|
||||
if (!templateObject) {
|
||||
if (!IsCallOpcode(JSOp(*pc)))
|
||||
if (canTrackOptimization)
|
||||
trackOptimizationOutcome(TrackedOutcome::NoTemplateObject);
|
||||
return Ok();
|
||||
}
|
||||
|
@ -5797,7 +5793,7 @@ IonBuilder::newArrayTryTemplateObject(bool* emitted, JSObject* templateObject, u
|
|||
if (templateObject->is<UnboxedArrayObject>()) {
|
||||
MOZ_ASSERT(templateObject->as<UnboxedArrayObject>().capacity() >= length);
|
||||
if (!templateObject->as<UnboxedArrayObject>().hasInlineElements()) {
|
||||
if (!IsCallOpcode(JSOp(*pc)))
|
||||
if (canTrackOptimization)
|
||||
trackOptimizationOutcome(TrackedOutcome::TemplateObjectIsUnboxedWithoutInlineElements);
|
||||
return Ok();
|
||||
}
|
||||
|
@ -5809,7 +5805,7 @@ IonBuilder::newArrayTryTemplateObject(bool* emitted, JSObject* templateObject, u
|
|||
gc::GetGCKindSlots(templateObject->asTenured().getAllocKind()) - ObjectElements::VALUES_PER_HEADER;
|
||||
|
||||
if (length > arraySlots) {
|
||||
if (!IsCallOpcode(JSOp(*pc)))
|
||||
if (canTrackOptimization)
|
||||
trackOptimizationOutcome(TrackedOutcome::LengthTooBig);
|
||||
return Ok();
|
||||
}
|
||||
|
@ -5824,7 +5820,7 @@ IonBuilder::newArrayTryTemplateObject(bool* emitted, JSObject* templateObject, u
|
|||
current->add(ins);
|
||||
current->push(ins);
|
||||
|
||||
if (!IsCallOpcode(JSOp(*pc)))
|
||||
if (canTrackOptimization)
|
||||
trackOptimizationSuccess();
|
||||
*emitted = true;
|
||||
return Ok();
|
||||
|
@ -5835,6 +5831,11 @@ IonBuilder::newArrayTrySharedStub(bool* emitted)
|
|||
{
|
||||
MOZ_ASSERT(*emitted == false);
|
||||
|
||||
// TODO: Support tracking optimizations for inlining a call and regular
|
||||
// optimization tracking at the same time. Currently just drop optimization
|
||||
// tracking when that happens.
|
||||
bool canTrackOptimization = !IsCallPC(pc);
|
||||
|
||||
// Try to emit a shared stub cache.
|
||||
|
||||
if (JitOptions.disableSharedStubs)
|
||||
|
@ -5843,7 +5844,7 @@ IonBuilder::newArrayTrySharedStub(bool* emitted)
|
|||
if (*pc != JSOP_NEWINIT && *pc != JSOP_NEWARRAY)
|
||||
return Ok();
|
||||
|
||||
if (!IsCallOpcode(JSOp(*pc)))
|
||||
if (canTrackOptimization)
|
||||
trackOptimizationAttempt(TrackedStrategy::NewArray_SharedCache);
|
||||
|
||||
MInstruction* stub = MNullarySharedStub::New(alloc());
|
||||
|
@ -5856,7 +5857,7 @@ IonBuilder::newArrayTrySharedStub(bool* emitted)
|
|||
current->add(unbox);
|
||||
current->push(unbox);
|
||||
|
||||
if (!IsCallOpcode(JSOp(*pc)))
|
||||
if (canTrackOptimization)
|
||||
trackOptimizationSuccess();
|
||||
|
||||
*emitted = true;
|
||||
|
@ -5868,8 +5869,13 @@ IonBuilder::newArrayTryVM(bool* emitted, JSObject* templateObject, uint32_t leng
|
|||
{
|
||||
MOZ_ASSERT(*emitted == false);
|
||||
|
||||
// TODO: Support tracking optimizations for inlining a call and regular
|
||||
// optimization tracking at the same time. Currently just drop optimization
|
||||
// tracking when that happens.
|
||||
bool canTrackOptimization = !IsCallPC(pc);
|
||||
|
||||
// Emit a VM call.
|
||||
if (!IsCallOpcode(JSOp(*pc)))
|
||||
if (canTrackOptimization)
|
||||
trackOptimizationAttempt(TrackedStrategy::NewArray_Call);
|
||||
|
||||
gc::InitialHeap heap = gc::DefaultHeap;
|
||||
|
@ -5886,7 +5892,7 @@ IonBuilder::newArrayTryVM(bool* emitted, JSObject* templateObject, uint32_t leng
|
|||
current->add(ins);
|
||||
current->push(ins);
|
||||
|
||||
if (!IsCallOpcode(JSOp(*pc)))
|
||||
if (canTrackOptimization)
|
||||
trackOptimizationSuccess();
|
||||
*emitted = true;
|
||||
return Ok();
|
||||
|
@ -5911,8 +5917,13 @@ IonBuilder::jsop_newarray(uint32_t length)
|
|||
AbortReasonOr<Ok>
|
||||
IonBuilder::jsop_newarray(JSObject* templateObject, uint32_t length)
|
||||
{
|
||||
// TODO: Support tracking optimizations for inlining a call and regular
|
||||
// optimization tracking at the same time. Currently just drop optimization
|
||||
// tracking when that happens.
|
||||
bool canTrackOptimization = !IsCallPC(pc);
|
||||
|
||||
bool emitted = false;
|
||||
if (!IsCallOpcode(JSOp(*pc)))
|
||||
if (canTrackOptimization)
|
||||
startTrackingOptimizations();
|
||||
|
||||
if (!forceInlineCaches()) {
|
||||
|
@ -5959,16 +5970,21 @@ IonBuilder::newObjectTryTemplateObject(bool* emitted, JSObject* templateObject)
|
|||
{
|
||||
MOZ_ASSERT(*emitted == false);
|
||||
|
||||
if (!IsCallOpcode(JSOp(*pc)))
|
||||
// TODO: Support tracking optimizations for inlining a call and regular
|
||||
// optimization tracking at the same time. Currently just drop optimization
|
||||
// tracking when that happens.
|
||||
bool canTrackOptimization = !IsCallPC(pc);
|
||||
|
||||
if (canTrackOptimization)
|
||||
trackOptimizationAttempt(TrackedStrategy::NewObject_TemplateObject);
|
||||
if (!templateObject) {
|
||||
if (!IsCallOpcode(JSOp(*pc)))
|
||||
if (canTrackOptimization)
|
||||
trackOptimizationOutcome(TrackedOutcome::NoTemplateObject);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
if (templateObject->is<PlainObject>() && templateObject->as<PlainObject>().hasDynamicSlots()) {
|
||||
if (!IsCallOpcode(JSOp(*pc)))
|
||||
if (canTrackOptimization)
|
||||
trackOptimizationOutcome(TrackedOutcome::TemplateObjectIsPlainObjectWithDynamicSlots);
|
||||
return Ok();
|
||||
}
|
||||
|
@ -5991,7 +6007,7 @@ IonBuilder::newObjectTryTemplateObject(bool* emitted, JSObject* templateObject)
|
|||
|
||||
MOZ_TRY(resumeAfter(ins));
|
||||
|
||||
if (!IsCallOpcode(JSOp(*pc)))
|
||||
if (canTrackOptimization)
|
||||
trackOptimizationSuccess();
|
||||
*emitted = true;
|
||||
return Ok();
|
||||
|
@ -6002,12 +6018,17 @@ IonBuilder::newObjectTrySharedStub(bool* emitted)
|
|||
{
|
||||
MOZ_ASSERT(*emitted == false);
|
||||
|
||||
// TODO: Support tracking optimizations for inlining a call and regular
|
||||
// optimization tracking at the same time. Currently just drop optimization
|
||||
// tracking when that happens.
|
||||
bool canTrackOptimization = !IsCallPC(pc);
|
||||
|
||||
// Try to emit a shared stub cache.
|
||||
|
||||
if (JitOptions.disableSharedStubs)
|
||||
return Ok();
|
||||
|
||||
if (!IsCallOpcode(JSOp(*pc)))
|
||||
if (canTrackOptimization)
|
||||
trackOptimizationAttempt(TrackedStrategy::NewObject_SharedCache);
|
||||
|
||||
MInstruction* stub = MNullarySharedStub::New(alloc());
|
||||
|
@ -6020,7 +6041,7 @@ IonBuilder::newObjectTrySharedStub(bool* emitted)
|
|||
current->add(unbox);
|
||||
current->push(unbox);
|
||||
|
||||
if (!IsCallOpcode(JSOp(*pc)))
|
||||
if (canTrackOptimization)
|
||||
trackOptimizationSuccess();
|
||||
*emitted = true;
|
||||
return Ok();
|
||||
|
@ -6032,8 +6053,7 @@ IonBuilder::newObjectTryVM(bool* emitted, JSObject* templateObject)
|
|||
// Emit a VM call.
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOP_NEWOBJECT || JSOp(*pc) == JSOP_NEWINIT);
|
||||
|
||||
if (!IsCallOpcode(JSOp(*pc)))
|
||||
trackOptimizationAttempt(TrackedStrategy::NewObject_Call);
|
||||
trackOptimizationAttempt(TrackedStrategy::NewObject_Call);
|
||||
|
||||
gc::InitialHeap heap = gc::DefaultHeap;
|
||||
MConstant* templateConst = MConstant::New(alloc(), NullValue());
|
||||
|
@ -6052,8 +6072,7 @@ IonBuilder::newObjectTryVM(bool* emitted, JSObject* templateObject)
|
|||
|
||||
MOZ_TRY(resumeAfter(ins));
|
||||
|
||||
if (!IsCallOpcode(JSOp(*pc)))
|
||||
trackOptimizationSuccess();
|
||||
trackOptimizationSuccess();
|
||||
*emitted = true;
|
||||
return Ok();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче