| Index: src/arm64/full-codegen-arm64.cc
|
| diff --git a/src/arm64/full-codegen-arm64.cc b/src/arm64/full-codegen-arm64.cc
|
| index 87b9aa4de8157e9668ea094a6d0d0073a1180559..1dcdf3c1f9d2678934527149154814ecb3ae4563 100644
|
| --- a/src/arm64/full-codegen-arm64.cc
|
| +++ b/src/arm64/full-codegen-arm64.cc
|
| @@ -211,6 +211,7 @@ void FullCodeGenerator::Generate() {
|
| if (heap_slots > 0) {
|
| // Argument to NewContext is the function, which is still in x1.
|
| Comment cmnt(masm_, "[ Allocate context");
|
| + bool need_write_barrier = true;
|
| if (FLAG_harmony_scoping && info->scope()->is_global_scope()) {
|
| __ Mov(x10, Operand(info->scope()->GetScopeInfo()));
|
| __ Push(x1, x10);
|
| @@ -218,6 +219,8 @@ void FullCodeGenerator::Generate() {
|
| } else 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);
|
| @@ -241,8 +244,15 @@ void FullCodeGenerator::Generate() {
|
| __ Str(x10, target);
|
|
|
| // Update the write barrier.
|
| - __ RecordWriteContextSlot(
|
| - cp, target.offset(), x10, x11, kLRHasBeenSaved, kDontSaveFPRegs);
|
| + if (need_write_barrier) {
|
| + __ RecordWriteContextSlot(
|
| + cp, target.offset(), x10, x11, kLRHasBeenSaved, kDontSaveFPRegs);
|
| + } else if (FLAG_debug_code) {
|
| + Label done;
|
| + __ JumpIfInNewSpace(cp, &done);
|
| + __ Abort(kExpectedNewSpaceObject);
|
| + __ bind(&done);
|
| + }
|
| }
|
| }
|
| }
|
|
|