| Index: src/arm/codegen-arm.cc
|
| diff --git a/src/arm/codegen-arm.cc b/src/arm/codegen-arm.cc
|
| index a8e38777bf5a79e44ff7be34e2d328d94d7095f3..562eaffd5ef2656373cf673c74fad615801c2a4c 100644
|
| --- a/src/arm/codegen-arm.cc
|
| +++ b/src/arm/codegen-arm.cc
|
| @@ -822,47 +822,37 @@ void MathExpGenerator::EmitMathExp(MacroAssembler* masm,
|
| static const uint32_t kCodeAgePatchFirstInstruction = 0xe24f0008;
|
| #endif
|
|
|
| -static byte* GetNoCodeAgeSequence(uint32_t* length) {
|
| - // The sequence of instructions that is patched out for aging code is the
|
| - // following boilerplate stack-building prologue that is found in FUNCTIONS
|
| - static bool initialized = false;
|
| - static uint32_t sequence[kNoCodeAgeSequenceLength];
|
| - byte* byte_sequence = reinterpret_cast<byte*>(sequence);
|
| - *length = kNoCodeAgeSequenceLength * Assembler::kInstrSize;
|
| - if (!initialized) {
|
| - // Since patcher is a large object, allocate it dynamically when needed,
|
| - // to avoid overloading the stack in stress conditions.
|
| - SmartPointer<CodePatcher>
|
| - patcher(new CodePatcher(byte_sequence, kNoCodeAgeSequenceLength));
|
| - PredictableCodeSizeScope scope(patcher->masm(), *length);
|
| - patcher->masm()->PushFixedFrame(r1);
|
| - patcher->masm()->nop(ip.code());
|
| - patcher->masm()->add(
|
| - fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
|
| - initialized = true;
|
| - }
|
| - return byte_sequence;
|
| +NoCodeAgeSequence::NoCodeAgeSequence() {
|
| + ASSERT(sequence_.length() == kNoCodeAgeSequenceLength);
|
| + // Since patcher is a large object, allocate it dynamically when needed,
|
| + // to avoid overloading the stack in stress conditions.
|
| + SmartPointer<CodePatcher>
|
| + patcher(new CodePatcher(sequence_.start(),
|
| + sequence_.length() / Assembler::kInstrSize));
|
| + PredictableCodeSizeScope scope(patcher->masm(), sequence_.length());
|
| + patcher->masm()->PushFixedFrame(r1);
|
| + patcher->masm()->nop(ip.code());
|
| + patcher->masm()->add(
|
| + fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
|
| }
|
|
|
|
|
| -bool Code::IsYoungSequence(byte* sequence) {
|
| - uint32_t young_length;
|
| - byte* young_sequence = GetNoCodeAgeSequence(&young_length);
|
| - bool result = !memcmp(sequence, young_sequence, young_length);
|
| +bool Code::IsYoungSequence(Isolate* isolate, byte* sequence) {
|
| + bool result = isolate->no_code_age_sequence()->Match(sequence);
|
| ASSERT(result ||
|
| Memory::uint32_at(sequence) == kCodeAgePatchFirstInstruction);
|
| return result;
|
| }
|
|
|
|
|
| -void Code::GetCodeAgeAndParity(byte* sequence, Age* age,
|
| +void Code::GetCodeAgeAndParity(Isolate* isolate, byte* sequence, Age* age,
|
| MarkingParity* parity) {
|
| - if (IsYoungSequence(sequence)) {
|
| + if (IsYoungSequence(isolate, sequence)) {
|
| *age = kNoAgeCodeAge;
|
| *parity = NO_MARKING_PARITY;
|
| } else {
|
| Address target_address = Memory::Address_at(
|
| - sequence + Assembler::kInstrSize * (kNoCodeAgeSequenceLength - 1));
|
| + sequence + (kNoCodeAgeSequenceLength - Assembler::kInstrSize));
|
| Code* stub = GetCodeFromTargetAddress(target_address);
|
| GetCodeAgeAndParity(stub, age, parity);
|
| }
|
| @@ -873,10 +863,9 @@ void Code::PatchPlatformCodeAge(Isolate* isolate,
|
| byte* sequence,
|
| Code::Age age,
|
| MarkingParity parity) {
|
| - uint32_t young_length;
|
| - byte* young_sequence = GetNoCodeAgeSequence(&young_length);
|
| + uint32_t young_length = isolate->no_code_age_sequence()->length();
|
| if (age == kNoAgeCodeAge) {
|
| - CopyBytes(sequence, young_sequence, young_length);
|
| + isolate->no_code_age_sequence()->CopyTo(sequence);
|
| CPU::FlushICache(sequence, young_length);
|
| } else {
|
| Code* stub = GetCodeAgeStub(isolate, age, parity);
|
|
|