| Index: src/arm64/lithium-codegen-arm64.cc
|
| diff --git a/src/arm64/lithium-codegen-arm64.cc b/src/arm64/lithium-codegen-arm64.cc
|
| index 9161aaf1f2258cb0fdea8eff0fd2c2163bacccf4..36605514b7041813ee4de3d6e9796794bc731e3a 100644
|
| --- a/src/arm64/lithium-codegen-arm64.cc
|
| +++ b/src/arm64/lithium-codegen-arm64.cc
|
| @@ -694,10 +694,13 @@ bool LCodeGen::GeneratePrologue() {
|
| int heap_slots = info()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
|
| if (heap_slots > 0) {
|
| Comment(";;; Allocate local context");
|
| + bool need_write_barrier = true;
|
| // Argument to NewContext is the function, which is in x1.
|
| if (heap_slots <= FastNewContextStub::kMaximumSlots) {
|
| FastNewContextStub stub(isolate(), heap_slots);
|
| __ CallStub(&stub);
|
| + // Result of FastNewContextStub is always in new space.
|
| + need_write_barrier = false;
|
| } else {
|
| __ Push(x1);
|
| __ CallRuntime(Runtime::kHiddenNewFunctionContext, 1);
|
| @@ -723,8 +726,15 @@ bool LCodeGen::GeneratePrologue() {
|
| MemOperand target = ContextMemOperand(cp, var->index());
|
| __ Str(value, target);
|
| // Update the write barrier. This clobbers value and scratch.
|
| - __ RecordWriteContextSlot(cp, target.offset(), value, scratch,
|
| - GetLinkRegisterState(), kSaveFPRegs);
|
| + if (need_write_barrier) {
|
| + __ RecordWriteContextSlot(cp, target.offset(), value, scratch,
|
| + GetLinkRegisterState(), kSaveFPRegs);
|
| + } else if (FLAG_debug_code) {
|
| + Label done;
|
| + __ JumpIfInNewSpace(cp, &done);
|
| + __ Abort(kExpectedNewSpaceObject);
|
| + __ bind(&done);
|
| + }
|
| }
|
| }
|
| Comment(";;; End allocate local context");
|
|
|