| Index: src/arm/full-codegen-arm.cc
|
| diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc
|
| index cb7d7da89f854c9eeb88a327a19cc715e482917e..ccde8b6b227901c07fd5be6e9beb1d5537400963 100644
|
| --- a/src/arm/full-codegen-arm.cc
|
| +++ b/src/arm/full-codegen-arm.cc
|
| @@ -212,6 +212,7 @@ void FullCodeGenerator::Generate() {
|
| if (heap_slots > 0) {
|
| // Argument to NewContext is the function, which is still in r1.
|
| Comment cmnt(masm_, "[ Allocate context");
|
| + bool need_write_barrier = true;
|
| if (FLAG_harmony_scoping && info->scope()->is_global_scope()) {
|
| __ push(r1);
|
| __ Push(info->scope()->GetScopeInfo());
|
| @@ -219,6 +220,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(r1);
|
| __ CallRuntime(Runtime::kHiddenNewFunctionContext, 1);
|
| @@ -242,8 +245,15 @@ void FullCodeGenerator::Generate() {
|
| __ str(r0, target);
|
|
|
| // Update the write barrier.
|
| - __ RecordWriteContextSlot(
|
| - cp, target.offset(), r0, r3, kLRHasBeenSaved, kDontSaveFPRegs);
|
| + if (need_write_barrier) {
|
| + __ RecordWriteContextSlot(
|
| + cp, target.offset(), r0, r3, kLRHasBeenSaved, kDontSaveFPRegs);
|
| + } else if (FLAG_debug_code) {
|
| + Label done;
|
| + __ JumpIfInNewSpace(cp, r0, &done);
|
| + __ Abort(kExpectedNewSpaceObject);
|
| + __ bind(&done);
|
| + }
|
| }
|
| }
|
| }
|
|
|