| Index: src/x64/codegen-x64.cc
|
| diff --git a/src/x64/codegen-x64.cc b/src/x64/codegen-x64.cc
|
| index bc675a10bef3c4b39d65ae124f9936cdd96557b9..eaeaf590d39913347e3843d3381e0f02d7ecc86a 100644
|
| --- a/src/x64/codegen-x64.cc
|
| +++ b/src/x64/codegen-x64.cc
|
| @@ -616,37 +616,29 @@ void MathExpGenerator::EmitMathExp(MacroAssembler* masm,
|
| #undef __
|
|
|
|
|
| -static byte* GetNoCodeAgeSequence(uint32_t* length) {
|
| - static bool initialized = false;
|
| - static byte sequence[kNoCodeAgeSequenceLength];
|
| - *length = kNoCodeAgeSequenceLength;
|
| - if (!initialized) {
|
| - // The sequence of instructions that is patched out for aging code is the
|
| - // following boilerplate stack-building prologue that is found both in
|
| - // FUNCTION and OPTIMIZED_FUNCTION code:
|
| - CodePatcher patcher(sequence, kNoCodeAgeSequenceLength);
|
| - patcher.masm()->pushq(rbp);
|
| - patcher.masm()->movp(rbp, rsp);
|
| - patcher.masm()->Push(rsi);
|
| - patcher.masm()->Push(rdi);
|
| - initialized = true;
|
| - }
|
| - return sequence;
|
| +NoCodeAgeSequence::NoCodeAgeSequence() {
|
| + ASSERT(sequence_.length() == kNoCodeAgeSequenceLength);
|
| + // The sequence of instructions that is patched out for aging code is the
|
| + // following boilerplate stack-building prologue that is found both in
|
| + // FUNCTION and OPTIMIZED_FUNCTION code:
|
| + CodePatcher patcher(sequence_.start(), sequence_.length());
|
| + patcher.masm()->pushq(rbp);
|
| + patcher.masm()->movp(rbp, rsp);
|
| + patcher.masm()->Push(rsi);
|
| + patcher.masm()->Push(rdi);
|
| }
|
|
|
|
|
| -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 || *sequence == kCallOpcode);
|
| 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 {
|
| @@ -663,10 +655,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);
|
|
|