Commit 4e0e4187 authored by palfia@homejinni.com's avatar palfia@homejinni.com

MIPS: Improve code aging sequence.

Port r15697 (61d56196)

Original commit message:
The code aging sequence contains a load which is unecessary for optimised
function. This has been replaced by a nop.

BUG=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15733 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 462f6be9
...@@ -583,7 +583,8 @@ class Assembler : public AssemblerBase { ...@@ -583,7 +583,8 @@ class Assembler : public AssemblerBase {
LAST_CODE_MARKER, LAST_CODE_MARKER,
FIRST_IC_MARKER = PROPERTY_ACCESS_INLINED, FIRST_IC_MARKER = PROPERTY_ACCESS_INLINED,
// Code aging // Code aging
CODE_AGE_MARKER_NOP = 6 CODE_AGE_MARKER_NOP = 6,
CODE_AGE_SEQUENCE_NOP
}; };
// Type == 0 is the default non-marking nop. For mips this is a // Type == 0 is the default non-marking nop. For mips this is a
......
...@@ -603,7 +603,7 @@ static byte* GetNoCodeAgeSequence(uint32_t* length) { ...@@ -603,7 +603,7 @@ static byte* GetNoCodeAgeSequence(uint32_t* length) {
if (!initialized) { if (!initialized) {
CodePatcher patcher(byte_sequence, kNoCodeAgeSequenceLength); CodePatcher patcher(byte_sequence, kNoCodeAgeSequenceLength);
patcher.masm()->Push(ra, fp, cp, a1); patcher.masm()->Push(ra, fp, cp, a1);
patcher.masm()->LoadRoot(at, Heap::kUndefinedValueRootIndex); patcher.masm()->nop(Assembler::CODE_AGE_SEQUENCE_NOP);
patcher.masm()->Addu(fp, sp, Operand(2 * kPointerSize)); patcher.masm()->Addu(fp, sp, Operand(2 * kPointerSize));
initialized = true; initialized = true;
} }
......
...@@ -174,9 +174,7 @@ void FullCodeGenerator::Generate() { ...@@ -174,9 +174,7 @@ void FullCodeGenerator::Generate() {
// The following three instructions must remain together and unmodified for // The following three instructions must remain together and unmodified for
// code aging to work properly. // code aging to work properly.
__ Push(ra, fp, cp, a1); __ Push(ra, fp, cp, a1);
// Load undefined value here, so the value is ready for the loop __ nop(Assembler::CODE_AGE_SEQUENCE_NOP);
// below.
__ LoadRoot(at, Heap::kUndefinedValueRootIndex);
// Adjust fp to point to caller's fp. // Adjust fp to point to caller's fp.
__ Addu(fp, sp, Operand(2 * kPointerSize)); __ Addu(fp, sp, Operand(2 * kPointerSize));
info->AddNoFrameRange(0, masm_->pc_offset()); info->AddNoFrameRange(0, masm_->pc_offset());
...@@ -185,8 +183,11 @@ void FullCodeGenerator::Generate() { ...@@ -185,8 +183,11 @@ void FullCodeGenerator::Generate() {
int locals_count = info->scope()->num_stack_slots(); int locals_count = info->scope()->num_stack_slots();
// Generators allocate locals, if any, in context slots. // Generators allocate locals, if any, in context slots.
ASSERT(!info->function()->is_generator() || locals_count == 0); ASSERT(!info->function()->is_generator() || locals_count == 0);
for (int i = 0; i < locals_count; i++) { if (locals_count > 0) {
__ push(at); __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
for (int i = 0; i < locals_count; i++) {
__ push(at);
}
} }
} }
......
...@@ -159,9 +159,9 @@ bool LCodeGen::GeneratePrologue() { ...@@ -159,9 +159,9 @@ bool LCodeGen::GeneratePrologue() {
// The following three instructions must remain together and unmodified // The following three instructions must remain together and unmodified
// for code aging to work properly. // for code aging to work properly.
__ Push(ra, fp, cp, a1); __ Push(ra, fp, cp, a1);
// Add unused load of ip to ensure prologue sequence is identical for // Add unused nop to ensure prologue sequence is identical for
// full-codegen and lithium-codegen. // full-codegen and lithium-codegen.
__ LoadRoot(at, Heap::kUndefinedValueRootIndex); __ nop(Assembler::CODE_AGE_SEQUENCE_NOP);
// Adj. FP to point to saved FP. // Adj. FP to point to saved FP.
__ Addu(fp, sp, Operand(2 * kPointerSize)); __ Addu(fp, sp, Operand(2 * kPointerSize));
} }
......
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