Commit ed160c53 authored by palfia@homejinni.com's avatar palfia@homejinni.com

MIPS: Pretenure ASCII cons string in high promotion mode.

Port r14540 (c6093a6e)

BUG=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14549 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8941cff6
...@@ -6318,8 +6318,36 @@ void StringAddStub::Generate(MacroAssembler* masm) { ...@@ -6318,8 +6318,36 @@ void StringAddStub::Generate(MacroAssembler* masm) {
__ AllocateAsciiConsString(v0, t2, t0, t1, &call_runtime); __ AllocateAsciiConsString(v0, t2, t0, t1, &call_runtime);
__ bind(&allocated); __ bind(&allocated);
// Fill the fields of the cons string. // Fill the fields of the cons string.
Label skip_write_barrier, after_writing;
ExternalReference high_promotion_mode = ExternalReference::
new_space_high_promotion_mode_active_address(masm->isolate());
__ li(t0, Operand(high_promotion_mode));
__ lw(t0, MemOperand(t0, 0));
__ Branch(&skip_write_barrier, eq, t0, Operand(zero_reg));
__ mov(t3, v0);
__ sw(a0, FieldMemOperand(t3, ConsString::kFirstOffset));
__ RecordWriteField(t3,
ConsString::kFirstOffset,
a0,
t0,
kRAHasNotBeenSaved,
kDontSaveFPRegs);
__ sw(a1, FieldMemOperand(t3, ConsString::kSecondOffset));
__ RecordWriteField(t3,
ConsString::kSecondOffset,
a1,
t0,
kRAHasNotBeenSaved,
kDontSaveFPRegs);
__ jmp(&after_writing);
__ bind(&skip_write_barrier);
__ sw(a0, FieldMemOperand(v0, ConsString::kFirstOffset)); __ sw(a0, FieldMemOperand(v0, ConsString::kFirstOffset));
__ sw(a1, FieldMemOperand(v0, ConsString::kSecondOffset)); __ sw(a1, FieldMemOperand(v0, ConsString::kSecondOffset));
__ bind(&after_writing);
__ IncrementCounter(counters->string_add_native(), 1, a2, a3); __ IncrementCounter(counters->string_add_native(), 1, a2, a3);
__ DropAndRet(2); __ DropAndRet(2);
...@@ -7199,6 +7227,9 @@ static const AheadOfTimeWriteBarrierStubList kAheadOfTime[] = { ...@@ -7199,6 +7227,9 @@ static const AheadOfTimeWriteBarrierStubList kAheadOfTime[] = {
{ REG(t1), REG(a0), REG(t2), EMIT_REMEMBERED_SET }, { REG(t1), REG(a0), REG(t2), EMIT_REMEMBERED_SET },
// FastNewClosureStub::Generate // FastNewClosureStub::Generate
{ REG(a2), REG(t0), REG(a1), EMIT_REMEMBERED_SET }, { REG(a2), REG(t0), REG(a1), EMIT_REMEMBERED_SET },
// StringAddStub::Generate
{ REG(t3), REG(a1), REG(t0), EMIT_REMEMBERED_SET },
{ REG(t3), REG(a0), REG(t0), EMIT_REMEMBERED_SET },
// Null termination. // Null termination.
{ REG(no_reg), REG(no_reg), REG(no_reg), EMIT_REMEMBERED_SET} { REG(no_reg), REG(no_reg), REG(no_reg), EMIT_REMEMBERED_SET}
}; };
......
...@@ -3135,8 +3135,34 @@ void MacroAssembler::AllocateAsciiConsString(Register result, ...@@ -3135,8 +3135,34 @@ void MacroAssembler::AllocateAsciiConsString(Register result,
Register scratch1, Register scratch1,
Register scratch2, Register scratch2,
Label* gc_required) { Label* gc_required) {
Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, Label allocate_new_space, install_map;
TAG_OBJECT); AllocationFlags flags = TAG_OBJECT;
ExternalReference high_promotion_mode = ExternalReference::
new_space_high_promotion_mode_active_address(isolate());
li(scratch1, Operand(high_promotion_mode));
lw(scratch1, MemOperand(scratch1, 0));
Branch(&allocate_new_space, eq, scratch1, Operand(zero_reg));
Allocate(ConsString::kSize,
result,
scratch1,
scratch2,
gc_required,
static_cast<AllocationFlags>(flags | PRETENURE_OLD_POINTER_SPACE));
jmp(&install_map);
bind(&allocate_new_space);
Allocate(ConsString::kSize,
result,
scratch1,
scratch2,
gc_required,
flags);
bind(&install_map);
InitializeNewString(result, InitializeNewString(result,
length, length,
Heap::kConsAsciiStringMapRootIndex, Heap::kConsAsciiStringMapRootIndex,
......
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