Index: src/arm64/codegen-arm64.cc |
diff --git a/src/arm64/codegen-arm64.cc b/src/arm64/codegen-arm64.cc |
index 7276024e15939bed10e2e9926568bc00402e58ec..ff06eda86ab593ca3df7f5df56b74b9fd9b72403 100644 |
--- a/src/arm64/codegen-arm64.cc |
+++ b/src/arm64/codegen-arm64.cc |
@@ -350,14 +350,41 @@ void ElementsTransitionGenerator::GenerateDoubleToObject( |
} |
-bool Code::IsYoungSequence(byte* sequence) { |
- return MacroAssembler::IsYoungSequence(sequence); |
+CodeAgingHelper::CodeAgingHelper() { |
+ ASSERT(young_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: |
+ PatchingAssembler patcher(young_sequence_.start(), |
+ young_sequence_.length() / kInstructionSize); |
+ // The young sequence is the frame setup code for FUNCTION code types. It is |
+ // generated by FullCodeGenerator::Generate. |
+ MacroAssembler::EmitFrameSetupForCodeAgePatching(&patcher); |
+ |
+#ifdef DEBUG |
+ const int length = kCodeAgeStubEntryOffset / kInstructionSize; |
+ ASSERT(old_sequence_.length() >= kCodeAgeStubEntryOffset); |
+ PatchingAssembler patcher_old(old_sequence_.start(), length); |
+ MacroAssembler::EmitCodeAgeSequence(&patcher_old, NULL); |
+#endif |
+} |
+ |
+ |
+#ifdef DEBUG |
+bool CodeAgingHelper::IsOld(byte* candidate) const { |
+ return memcmp(candidate, old_sequence_.start(), kCodeAgeStubEntryOffset) == 0; |
+} |
+#endif |
+ |
+ |
+bool Code::IsYoungSequence(Isolate* isolate, byte* sequence) { |
+ return MacroAssembler::IsYoungSequence(isolate, sequence); |
} |
-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 { |
@@ -372,7 +399,8 @@ void Code::PatchPlatformCodeAge(Isolate* isolate, |
byte* sequence, |
Code::Age age, |
MarkingParity parity) { |
- PatchingAssembler patcher(sequence, kCodeAgeSequenceSize / kInstructionSize); |
+ PatchingAssembler patcher(sequence, |
+ kNoCodeAgeSequenceLength / kInstructionSize); |
if (age == kNoAgeCodeAge) { |
MacroAssembler::EmitFrameSetupForCodeAgePatching(&patcher); |
} else { |