Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(794)

Unified Diff: src/mips/lithium-codegen-mips.cc

Issue 23480031: Enable preaging of code objects when --optimize-for-size. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Rebase and add MIPS support Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/mips/lithium-codegen-mips.cc
diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc
index 7fabb9ff2e56a8521e500d83f144c7607cdc450b..984d0a0e65cbf49e48d45bc4ec3b9d1870a1431d 100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -139,14 +139,29 @@ bool LCodeGen::GeneratePrologue() {
// Adjust FP to point to saved FP.
__ Addu(fp, sp, Operand(2 * kPointerSize));
} else {
+ PredictableCodeSizeScope predictible_code_size_scope(
+ masm_, kNoCodeAgeSequenceLength * Assembler::kInstrSize);
// The following three instructions must remain together and unmodified
// for code aging to work properly.
- __ Push(ra, fp, cp, a1);
- // Add unused nop to ensure prologue sequence is identical for
- // full-codegen and lithium-codegen.
- __ nop(Assembler::CODE_AGE_SEQUENCE_NOP);
- // Adj. FP to point to saved FP.
- __ Addu(fp, sp, Operand(2 * kPointerSize));
+ if (FLAG_optimize_for_size && FLAG_age_code) {
+ // Pre-age the code.
+ Code* stub = Code::GetPreAgedCodeAgeStub(isolate());
+ __ nop(Assembler::CODE_AGE_MARKER_NOP);
+ // Save the function's original return address
+ // (it will be clobbered by Call(t9))
+ __ mov(at, ra);
+ // Load the stub address to t9 and call it
+ __ li(t9,
+ Operand(reinterpret_cast<uint32_t>(stub->instruction_start())));
+ __ Call(t9);
+ // Record the stub address in the empty space for GetCodeAgeAndParity()
+ __ dd(reinterpret_cast<uint32_t>(stub->instruction_start()));
+ } else {
+ __ Push(ra, fp, cp, a1);
+ __ nop(Assembler::CODE_AGE_SEQUENCE_NOP);
+ // Adjust fp to point to caller's fp.
+ __ Addu(fp, sp, Operand(2 * kPointerSize));
+ }
}
frame_is_built_ = true;
info_->AddNoFrameRange(0, masm_->pc_offset());
« src/arm/full-codegen-arm.cc ('K') | « src/mips/full-codegen-mips.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698