X87: Skip write barriers in the fast case when setting up local context.

Port r21481 (5973b48)

Original commit message:
The FastNewContextStub always allocates in new space, so we don't
need to update the write barrier when copying the parameters to
the newly allocated context.

BUG=
R=danno@chromium.org

Review URL: https://codereview.chromium.org/307433004

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21541 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 382619d3
......@@ -198,6 +198,7 @@ void FullCodeGenerator::Generate() {
int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
if (heap_slots > 0) {
Comment cmnt(masm_, "[ Allocate context");
bool need_write_barrier = true;
// Argument to NewContext is the function, which is still in edi.
if (FLAG_harmony_scoping && info->scope()->is_global_scope()) {
__ push(edi);
......@@ -206,6 +207,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(edi);
__ CallRuntime(Runtime::kHiddenNewFunctionContext, 1);
......@@ -229,10 +232,17 @@ void FullCodeGenerator::Generate() {
int context_offset = Context::SlotOffset(var->index());
__ mov(Operand(esi, context_offset), eax);
// Update the write barrier. This clobbers eax and ebx.
__ RecordWriteContextSlot(esi,
context_offset,
eax,
ebx);
if (need_write_barrier) {
__ RecordWriteContextSlot(esi,
context_offset,
eax,
ebx);
} else if (FLAG_debug_code) {
Label done;
__ JumpIfInNewSpace(esi, eax, &done, Label::kNear);
__ Abort(kExpectedNewSpaceObject);
__ bind(&done);
}
}
}
}
......
......@@ -221,10 +221,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 still in edi.
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(edi);
__ CallRuntime(Runtime::kHiddenNewFunctionContext, 1);
......@@ -248,10 +251,17 @@ bool LCodeGen::GeneratePrologue() {
int context_offset = Context::SlotOffset(var->index());
__ mov(Operand(esi, context_offset), eax);
// Update the write barrier. This clobbers eax and ebx.
__ RecordWriteContextSlot(esi,
context_offset,
eax,
ebx);
if (need_write_barrier) {
__ RecordWriteContextSlot(esi,
context_offset,
eax,
ebx);
} else if (FLAG_debug_code) {
Label done;
__ JumpIfInNewSpace(esi, eax, &done, Label::kNear);
__ Abort(kExpectedNewSpaceObject);
__ bind(&done);
}
}
}
Comment(";;; End allocate local context");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment