| Index: src/arm/codegen-arm.cc
|
| diff --git a/src/arm/codegen-arm.cc b/src/arm/codegen-arm.cc
|
| index faf7b54d43a139139d37789afca4ce46eb639c24..fd82f80bb0619df1a942f8119cd7f527fbef80ef 100644
|
| --- a/src/arm/codegen-arm.cc
|
| +++ b/src/arm/codegen-arm.cc
|
| @@ -847,7 +847,27 @@ static byte* GetNoCodeAgeSequence(uint32_t* length) {
|
| CodePatcher patcher(byte_sequence, kNoCodeAgeSequenceLength);
|
| PredictableCodeSizeScope scope(patcher.masm(), *length);
|
| patcher.masm()->stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit());
|
| - patcher.masm()->nop(ip.code());
|
| + patcher.masm()->nop(kNoAgeCodeNopType);
|
| + patcher.masm()->add(fp, sp, Operand(2 * kPointerSize));
|
| + initialized = true;
|
| + }
|
| + return byte_sequence;
|
| +}
|
| +
|
| +
|
| +static byte* GetPreAgedCodeAgeSequence(uint32_t* length) {
|
| + // If code is "pre-aged" then this sequence of instructions is found in the
|
| + // boilerplate stack-building prologue that is found in FUNCTIONS, and is
|
| + // patched out for code aging.
|
| + static bool initialized = false;
|
| + static uint32_t sequence[kNoCodeAgeSequenceLength];
|
| + byte* byte_sequence = reinterpret_cast<byte*>(sequence);
|
| + *length = kNoCodeAgeSequenceLength * Assembler::kInstrSize;
|
| + if (!initialized) {
|
| + CodePatcher patcher(byte_sequence, kNoCodeAgeSequenceLength);
|
| + PredictableCodeSizeScope scope(patcher.masm(), *length);
|
| + patcher.masm()->stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit());
|
| + patcher.masm()->nop(kPreAgeCodeNopType);
|
| patcher.masm()->add(fp, sp, Operand(2 * kPointerSize));
|
| initialized = true;
|
| }
|
| @@ -860,7 +880,19 @@ bool Code::IsYoungSequence(byte* sequence) {
|
| byte* young_sequence = GetNoCodeAgeSequence(&young_length);
|
| bool result = !memcmp(sequence, young_sequence, young_length);
|
| ASSERT(result ||
|
| - Memory::uint32_at(sequence) == kCodeAgePatchFirstInstruction);
|
| + Memory::uint32_at(sequence) == kCodeAgePatchFirstInstruction ||
|
| + IsPreAgedSequence(sequence));
|
| + return result;
|
| +}
|
| +
|
| +
|
| +bool Code::IsPreAgedSequence(byte* sequence) {
|
| + uint32_t pre_aged_length;
|
| + byte* pre_aged_sequence = GetPreAgedCodeAgeSequence(&pre_aged_length);
|
| + bool result = !memcmp(sequence, pre_aged_sequence, pre_aged_length);
|
| + ASSERT(result ||
|
| + Memory::uint32_at(sequence) == kCodeAgePatchFirstInstruction ||
|
| + IsYoungSequence(sequence));
|
| return result;
|
| }
|
|
|
| @@ -870,6 +902,9 @@ void Code::GetCodeAgeAndParity(byte* sequence, Age* age,
|
| if (IsYoungSequence(sequence)) {
|
| *age = kNoAge;
|
| *parity = NO_MARKING_PARITY;
|
| + } else if (IsPreAgedSequence(sequence)) {
|
| + *age = kPreAgedCodeAge;
|
| + *parity = NO_MARKING_PARITY;
|
| } else {
|
| Address target_address = Memory::Address_at(
|
| sequence + Assembler::kInstrSize * (kNoCodeAgeSequenceLength - 1));
|
|
|