зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1412202 - Part 3: Rename from ExpressionStack to StackStorage in anticipation of including optimized local variables in this array. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D93383
This commit is contained in:
Родитель
848b31e4ce
Коммит
61a1c23f13
|
@ -6146,10 +6146,10 @@ bool BaselineCodeGen<Handler>::emit_Resume() {
|
|||
masm.bind(&noArgsObj);
|
||||
|
||||
// Push expression slots if needed.
|
||||
Label noExprStack;
|
||||
Address exprStackSlot(genObj,
|
||||
AbstractGeneratorObject::offsetOfExpressionStackSlot());
|
||||
masm.fallibleUnboxObject(exprStackSlot, scratch2, &noExprStack);
|
||||
Label noStackStorage;
|
||||
Address stackStorageSlot(genObj,
|
||||
AbstractGeneratorObject::offsetOfStackStorageSlot());
|
||||
masm.fallibleUnboxObject(stackStorageSlot, scratch2, &noStackStorage);
|
||||
{
|
||||
Register initLength = regs.takeAny();
|
||||
masm.loadPtr(Address(scratch2, NativeObject::offsetOfElements()), scratch2);
|
||||
|
@ -6173,7 +6173,7 @@ bool BaselineCodeGen<Handler>::emit_Resume() {
|
|||
regs.add(initLength);
|
||||
}
|
||||
|
||||
masm.bind(&noExprStack);
|
||||
masm.bind(&noStackStorage);
|
||||
|
||||
// Push arg, generator, resumeKind stack Values, in that order.
|
||||
masm.pushValue(Address(callerStackPtr, sizeof(Value)));
|
||||
|
|
|
@ -1450,20 +1450,20 @@ bool NormalSuspend(JSContext* cx, HandleObject obj, BaselineFrame* frame,
|
|||
// The expression stack slots are stored on the stack in reverse order, so
|
||||
// we copy them to a Vector and pass a pointer to that instead. We use
|
||||
// stackDepth - 1 because we don't want to include the return value.
|
||||
RootedValueVector exprStack(cx);
|
||||
if (!exprStack.reserve(stackDepth - 1)) {
|
||||
RootedValueVector stackStorage(cx);
|
||||
if (!stackStorage.reserve(stackDepth - 1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t firstSlot = numValueSlots - stackDepth;
|
||||
for (size_t i = 0; i < stackDepth - 1; i++) {
|
||||
exprStack.infallibleAppend(*frame->valueSlot(firstSlot + i));
|
||||
stackStorage.infallibleAppend(*frame->valueSlot(firstSlot + i));
|
||||
}
|
||||
|
||||
MOZ_ASSERT(exprStack.length() == stackDepth - 1);
|
||||
MOZ_ASSERT(stackStorage.length() == stackDepth - 1);
|
||||
|
||||
return AbstractGeneratorObject::normalSuspend(
|
||||
cx, obj, frame, pc, exprStack.begin(), stackDepth - 1);
|
||||
cx, obj, frame, pc, stackStorage.begin(), stackDepth - 1);
|
||||
}
|
||||
|
||||
bool FinalSuspend(JSContext* cx, HandleObject obj, jsbytecode* pc) {
|
||||
|
|
|
@ -50,7 +50,7 @@ JSObject* AbstractGeneratorObject::create(JSContext* cx,
|
|||
if (frame.script()->needsArgsObj()) {
|
||||
genObj->setArgsObj(frame.argsObj());
|
||||
}
|
||||
genObj->clearExpressionStack();
|
||||
genObj->clearStackStorage();
|
||||
|
||||
if (!DebugAPI::onNewGenerator(cx, frame, genObj)) {
|
||||
return nullptr;
|
||||
|
@ -70,19 +70,19 @@ bool AbstractGeneratorObject::suspend(JSContext* cx, HandleObject obj,
|
|||
JSOp(*pc) == JSOp::Await);
|
||||
|
||||
auto genObj = obj.as<AbstractGeneratorObject>();
|
||||
MOZ_ASSERT(!genObj->hasExpressionStack() || genObj->isExpressionStackEmpty());
|
||||
MOZ_ASSERT(!genObj->hasStackStorage() || genObj->isStackStorageEmpty());
|
||||
MOZ_ASSERT_IF(JSOp(*pc) == JSOp::Await, genObj->callee().isAsync());
|
||||
MOZ_ASSERT_IF(JSOp(*pc) == JSOp::Yield, genObj->callee().isGenerator());
|
||||
|
||||
ArrayObject* stack = nullptr;
|
||||
if (nvalues > 0) {
|
||||
do {
|
||||
if (genObj->hasExpressionStack()) {
|
||||
MOZ_ASSERT(genObj->expressionStack().getDenseInitializedLength() == 0);
|
||||
auto result = genObj->expressionStack().setOrExtendDenseElements(
|
||||
if (genObj->hasStackStorage()) {
|
||||
MOZ_ASSERT(genObj->stackStorage().getDenseInitializedLength() == 0);
|
||||
auto result = genObj->stackStorage().setOrExtendDenseElements(
|
||||
cx, 0, vp, nvalues, ShouldUpdateTypes::DontUpdate);
|
||||
if (result == DenseElementResult::Success) {
|
||||
MOZ_ASSERT(genObj->expressionStack().getDenseInitializedLength() ==
|
||||
MOZ_ASSERT(genObj->stackStorage().getDenseInitializedLength() ==
|
||||
nvalues);
|
||||
break;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ bool AbstractGeneratorObject::suspend(JSContext* cx, HandleObject obj,
|
|||
genObj->setResumeIndex(pc);
|
||||
genObj->setEnvironmentChain(*frame.environmentChain());
|
||||
if (stack) {
|
||||
genObj->setExpressionStack(*stack);
|
||||
genObj->setStackStorage(*stack);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -180,13 +180,13 @@ bool AbstractGeneratorObject::resume(JSContext* cx,
|
|||
activation.regs().fp()->initArgsObj(genObj->argsObj());
|
||||
}
|
||||
|
||||
if (genObj->hasExpressionStack() && !genObj->isExpressionStackEmpty()) {
|
||||
uint32_t len = genObj->expressionStack().getDenseInitializedLength();
|
||||
if (genObj->hasStackStorage() && !genObj->isStackStorageEmpty()) {
|
||||
uint32_t len = genObj->stackStorage().getDenseInitializedLength();
|
||||
MOZ_ASSERT(activation.regs().spForStackDepth(len));
|
||||
const Value* src = genObj->expressionStack().getDenseElements();
|
||||
const Value* src = genObj->stackStorage().getDenseElements();
|
||||
mozilla::PodCopy(activation.regs().sp, src, len);
|
||||
activation.regs().sp += len;
|
||||
genObj->expressionStack().setDenseInitializedLength(0);
|
||||
genObj->stackStorage().setDenseInitializedLength(0);
|
||||
}
|
||||
|
||||
JSScript* script = callee->nonLazyScript();
|
||||
|
|
|
@ -33,7 +33,7 @@ class AbstractGeneratorObject : public NativeObject {
|
|||
CALLEE_SLOT = 0,
|
||||
ENV_CHAIN_SLOT,
|
||||
ARGS_OBJ_SLOT,
|
||||
EXPRESSION_STACK_SLOT,
|
||||
STACK_STORAGE_SLOT,
|
||||
RESUME_INDEX_SLOT,
|
||||
RESERVED_SLOTS
|
||||
};
|
||||
|
@ -84,21 +84,19 @@ class AbstractGeneratorObject : public NativeObject {
|
|||
setFixedSlot(ARGS_OBJ_SLOT, ObjectValue(argsObj));
|
||||
}
|
||||
|
||||
bool hasExpressionStack() const {
|
||||
return getFixedSlot(EXPRESSION_STACK_SLOT).isObject();
|
||||
bool hasStackStorage() const {
|
||||
return getFixedSlot(STACK_STORAGE_SLOT).isObject();
|
||||
}
|
||||
bool isExpressionStackEmpty() const {
|
||||
return expressionStack().getDenseInitializedLength() == 0;
|
||||
bool isStackStorageEmpty() const {
|
||||
return stackStorage().getDenseInitializedLength() == 0;
|
||||
}
|
||||
ArrayObject& expressionStack() const {
|
||||
return getFixedSlot(EXPRESSION_STACK_SLOT).toObject().as<ArrayObject>();
|
||||
ArrayObject& stackStorage() const {
|
||||
return getFixedSlot(STACK_STORAGE_SLOT).toObject().as<ArrayObject>();
|
||||
}
|
||||
void setExpressionStack(ArrayObject& expressionStack) {
|
||||
setFixedSlot(EXPRESSION_STACK_SLOT, ObjectValue(expressionStack));
|
||||
}
|
||||
void clearExpressionStack() {
|
||||
setFixedSlot(EXPRESSION_STACK_SLOT, NullValue());
|
||||
void setStackStorage(ArrayObject& stackStorage) {
|
||||
setFixedSlot(STACK_STORAGE_SLOT, ObjectValue(stackStorage));
|
||||
}
|
||||
void clearStackStorage() { setFixedSlot(STACK_STORAGE_SLOT, NullValue()); }
|
||||
|
||||
// The resumeIndex slot is abused for a few purposes. It's undefined if
|
||||
// it hasn't been set yet (before the initial yield), and null if the
|
||||
|
@ -153,7 +151,7 @@ class AbstractGeneratorObject : public NativeObject {
|
|||
setFixedSlot(CALLEE_SLOT, NullValue());
|
||||
setFixedSlot(ENV_CHAIN_SLOT, NullValue());
|
||||
setFixedSlot(ARGS_OBJ_SLOT, NullValue());
|
||||
setFixedSlot(EXPRESSION_STACK_SLOT, NullValue());
|
||||
setFixedSlot(STACK_STORAGE_SLOT, NullValue());
|
||||
setFixedSlot(RESUME_INDEX_SLOT, NullValue());
|
||||
}
|
||||
|
||||
|
@ -176,8 +174,8 @@ class AbstractGeneratorObject : public NativeObject {
|
|||
static size_t offsetOfResumeIndexSlot() {
|
||||
return getFixedSlotOffset(RESUME_INDEX_SLOT);
|
||||
}
|
||||
static size_t offsetOfExpressionStackSlot() {
|
||||
return getFixedSlotOffset(EXPRESSION_STACK_SLOT);
|
||||
static size_t offsetOfStackStorageSlot() {
|
||||
return getFixedSlotOffset(STACK_STORAGE_SLOT);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче