| Index: src/arm64/lithium-codegen-arm64.cc
|
| diff --git a/src/arm64/lithium-codegen-arm64.cc b/src/arm64/lithium-codegen-arm64.cc
|
| index ea259d5f95c4bf7b539e0b395bc5d67c89a73c46..b9667ab215eae4fa788e33e85c1e3352cb518352 100644
|
| --- a/src/arm64/lithium-codegen-arm64.cc
|
| +++ b/src/arm64/lithium-codegen-arm64.cc
|
| @@ -5330,6 +5330,91 @@ void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
|
| }
|
|
|
|
|
| +void LCodeGen::DoMaybeGrowElements(LMaybeGrowElements* instr) {
|
| + class DeferredMaybeGrowElements final : public LDeferredCode {
|
| + public:
|
| + DeferredMaybeGrowElements(LCodeGen* codegen, LMaybeGrowElements* instr)
|
| + : LDeferredCode(codegen), instr_(instr) {}
|
| + void Generate() override { codegen()->DoDeferredMaybeGrowElements(instr_); }
|
| + LInstruction* instr() override { return instr_; }
|
| +
|
| + private:
|
| + LMaybeGrowElements* instr_;
|
| + };
|
| +
|
| + Register result = x0;
|
| + DeferredMaybeGrowElements* deferred =
|
| + new (zone()) DeferredMaybeGrowElements(this, instr);
|
| + LOperand* key = instr->key();
|
| + LOperand* current_capacity = instr->current_capacity();
|
| +
|
| + DCHECK(instr->hydrogen()->key()->representation().IsInteger32());
|
| + DCHECK(instr->hydrogen()->current_capacity()->representation().IsInteger32());
|
| + DCHECK(key->IsConstantOperand() || key->IsRegister());
|
| + DCHECK(current_capacity->IsConstantOperand() ||
|
| + current_capacity->IsRegister());
|
| +
|
| + if (key->IsConstantOperand() && current_capacity->IsConstantOperand()) {
|
| + int32_t constant_key = ToInteger32(LConstantOperand::cast(key));
|
| + int32_t constant_capacity =
|
| + ToInteger32(LConstantOperand::cast(current_capacity));
|
| + if (constant_key >= constant_capacity) {
|
| + // Deferred case.
|
| + __ B(deferred->entry());
|
| + }
|
| + } else if (key->IsConstantOperand()) {
|
| + int32_t constant_key = ToInteger32(LConstantOperand::cast(key));
|
| + __ Cmp(ToRegister(current_capacity), Operand(constant_key));
|
| + __ B(le, deferred->entry());
|
| + } else if (current_capacity->IsConstantOperand()) {
|
| + int32_t constant_capacity =
|
| + ToInteger32(LConstantOperand::cast(current_capacity));
|
| + __ Cmp(ToRegister(key), Operand(constant_capacity));
|
| + __ B(ge, deferred->entry());
|
| + } else {
|
| + __ Cmp(ToRegister(key), ToRegister(current_capacity));
|
| + __ B(ge, deferred->entry());
|
| + }
|
| +
|
| + __ Mov(result, ToRegister(instr->elements()));
|
| +
|
| + __ Bind(deferred->exit());
|
| +}
|
| +
|
| +
|
| +void LCodeGen::DoDeferredMaybeGrowElements(LMaybeGrowElements* instr) {
|
| + // TODO(3095996): Get rid of this. For now, we need to make the
|
| + // result register contain a valid pointer because it is already
|
| + // contained in the register pointer map.
|
| + Register result = x0;
|
| + __ Mov(result, 0);
|
| +
|
| + // We have to call a stub.
|
| + {
|
| + PushSafepointRegistersScope scope(this);
|
| + __ Move(result, ToRegister(instr->object()));
|
| +
|
| + LOperand* key = instr->key();
|
| + if (key->IsConstantOperand()) {
|
| + __ Mov(x3, Operand(ToSmi(LConstantOperand::cast(key))));
|
| + } else {
|
| + __ Mov(x3, ToRegister(key));
|
| + __ SmiTag(x3);
|
| + }
|
| +
|
| + GrowArrayElementsStub stub(isolate(), instr->hydrogen()->is_js_array(),
|
| + instr->hydrogen()->kind());
|
| + __ CallStub(&stub);
|
| + RecordSafepointWithLazyDeopt(
|
| + instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS);
|
| + __ StoreToSafepointRegisterSlot(result, result);
|
| + }
|
| +
|
| + // Deopt on smi, which means the elements array changed to dictionary mode.
|
| + DeoptimizeIfSmi(result, instr, Deoptimizer::kSmi);
|
| +}
|
| +
|
| +
|
| void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
|
| Representation representation = instr->representation();
|
|
|
|
|