Bug 1401568 - [Ion] Add ResumePoint to JSOP_SETPROP TypedObject case r=jandem

This adds the required IonBuilder::resumeAfter calls to this case. There
is also some refactoring so that this call is done where the MIR store
node is.

MozReview-Commit-ID: 94udSQzPmyh

--HG--
extra : rebase_source : a44555e21db924374d6516eaf638f56fbf2d970e
This commit is contained in:
Ted Campbell 2017-09-20 15:44:59 -04:00
Родитель da50499b6d
Коммит 0c0f65b002
2 изменённых файлов: 42 добавлений и 55 удалений

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

@ -9035,15 +9035,8 @@ IonBuilder::setElemTryReferenceElemOfTypedObject(bool* emitted,
if (!checkTypedObjectIndexInBounds(elemSize, obj, index, objPrediction, &indexAsByteOffset))
return Ok();
MOZ_TRY_VAR(*emitted, storeReferenceTypedObjectValue(obj, indexAsByteOffset, elemType, value, nullptr));
if (!*emitted)
return Ok();
current->push(value);
trackOptimizationSuccess();
*emitted = true;
return Ok();
return setPropTryReferenceTypedObjectValue(emitted, obj, indexAsByteOffset,
elemType, value, nullptr);
}
AbortReasonOr<Ok>
@ -9063,14 +9056,7 @@ IonBuilder::setElemTryScalarElemOfTypedObject(bool* emitted,
if (!checkTypedObjectIndexInBounds(elemSize, obj, index, objPrediction, &indexAsByteOffset))
return Ok();
// Store the element
MOZ_TRY(storeScalarTypedObjectValue(obj, indexAsByteOffset, elemType, value));
current->push(value);
trackOptimizationSuccess();
*emitted = true;
return Ok();
return setPropTryScalarTypedObjectValue(emitted, obj, indexAsByteOffset, elemType, value);
}
AbortReasonOr<Ok>
@ -11756,15 +11742,7 @@ IonBuilder::setPropTryReferencePropOfTypedObject(bool* emitted,
if (!byteOffset.add(fieldOffset))
return abort(AbortReason::Disable, "Overflow of field offset.");
MOZ_TRY_VAR(*emitted, storeReferenceTypedObjectValue(obj, byteOffset, fieldType, value, name));
if (!*emitted)
return Ok();
current->push(value);
trackOptimizationSuccess();
*emitted = true;
return Ok();
return setPropTryReferenceTypedObjectValue(emitted, obj, byteOffset, fieldType, value, name);
}
AbortReasonOr<Ok>
@ -11786,13 +11764,7 @@ IonBuilder::setPropTryScalarPropOfTypedObject(bool* emitted,
if (!byteOffset.add(fieldOffset))
return abort(AbortReason::Disable, "Overflow of field offet.");
MOZ_TRY(storeScalarTypedObjectValue(obj, byteOffset, fieldType, value));
current->push(value);
trackOptimizationSuccess();
*emitted = true;
return Ok();
return setPropTryScalarTypedObjectValue(emitted, obj, byteOffset, fieldType, value);
}
AbortReasonOr<Ok>
@ -13480,11 +13452,14 @@ IonBuilder::typeObjectForFieldFromStructType(MDefinition* typeObj,
}
AbortReasonOr<Ok>
IonBuilder::storeScalarTypedObjectValue(MDefinition* typedObj,
const LinearSum& byteOffset,
ScalarTypeDescr::Type type,
MDefinition* value)
IonBuilder::setPropTryScalarTypedObjectValue(bool* emitted,
MDefinition* typedObj,
const LinearSum& byteOffset,
ScalarTypeDescr::Type type,
MDefinition* value)
{
MOZ_ASSERT(!*emitted);
// Find location within the owner object.
MDefinition* elements;
MDefinition* scaledOffset;
@ -13505,17 +13480,23 @@ IonBuilder::storeScalarTypedObjectValue(MDefinition* typedObj,
type, MStoreUnboxedScalar::TruncateInput,
DoesNotRequireMemoryBarrier, adjustment);
current->add(store);
current->push(value);
return Ok();
trackOptimizationSuccess();
*emitted = true;
return resumeAfter(store);
}
AbortReasonOr<bool>
IonBuilder::storeReferenceTypedObjectValue(MDefinition* typedObj,
const LinearSum& byteOffset,
ReferenceTypeDescr::Type type,
MDefinition* value,
PropertyName* name)
AbortReasonOr<Ok>
IonBuilder::setPropTryReferenceTypedObjectValue(bool* emitted,
MDefinition* typedObj,
const LinearSum& byteOffset,
ReferenceTypeDescr::Type type,
MDefinition* value,
PropertyName* name)
{
MOZ_ASSERT(!*emitted);
// Make sure we aren't adding new type information for writes of object and value
// references.
if (type != ReferenceTypeDescr::TYPE_STRING) {
@ -13528,7 +13509,7 @@ IonBuilder::storeReferenceTypedObjectValue(MDefinition* typedObj,
/* canModify = */ true, implicitType))
{
trackOptimizationOutcome(TrackedOutcome::NeedsTypeBarrier);
return false;
return Ok();
}
}
@ -13563,7 +13544,11 @@ IonBuilder::storeReferenceTypedObjectValue(MDefinition* typedObj,
}
current->add(store);
return true;
current->push(value);
trackOptimizationSuccess();
*emitted = true;
return resumeAfter(store);
}
JSObject*

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

@ -283,11 +283,22 @@ class IonBuilder
int32_t fieldOffset, MDefinition* value,
TypedObjectPrediction fieldPrediction,
PropertyName* name);
AbortReasonOr<Ok> setPropTryReferenceTypedObjectValue(bool* emitted,
MDefinition* typedObj,
const LinearSum& byteOffset,
ReferenceTypeDescr::Type type,
MDefinition* value,
PropertyName* name);
AbortReasonOr<Ok> setPropTryScalarPropOfTypedObject(bool* emitted,
MDefinition* obj,
int32_t fieldOffset,
MDefinition* value,
TypedObjectPrediction fieldTypeReprs);
AbortReasonOr<Ok> setPropTryScalarTypedObjectValue(bool* emitted,
MDefinition* typedObj,
const LinearSum& byteOffset,
ScalarTypeDescr::Type type,
MDefinition* value);
AbortReasonOr<Ok> setPropTryCache(bool* emitted, MDefinition* obj,
PropertyName* name, MDefinition* value,
bool barrier, TemporaryTypeSet* objTypes);
@ -358,15 +369,6 @@ class IonBuilder
MDefinition* typeObjectForElementFromArrayStructType(MDefinition* typedObj);
MDefinition* typeObjectForFieldFromStructType(MDefinition* type,
size_t fieldIndex);
AbortReasonOr<bool> storeReferenceTypedObjectValue(MDefinition* typedObj,
const LinearSum& byteOffset,
ReferenceTypeDescr::Type type,
MDefinition* value,
PropertyName* name);
AbortReasonOr<Ok> storeScalarTypedObjectValue(MDefinition* typedObj,
const LinearSum& byteOffset,
ScalarTypeDescr::Type type,
MDefinition* value);
bool checkTypedObjectIndexInBounds(uint32_t elemSize,
MDefinition* obj,
MDefinition* index,