OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/ppc/codegen-ppc.h" | 5 #include "src/ppc/codegen-ppc.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_PPC | 7 #if V8_TARGET_ARCH_PPC |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 188 } |
189 #endif | 189 #endif |
190 | 190 |
191 | 191 |
192 bool Code::IsYoungSequence(Isolate* isolate, byte* sequence) { | 192 bool Code::IsYoungSequence(Isolate* isolate, byte* sequence) { |
193 bool result = isolate->code_aging_helper()->IsYoung(sequence); | 193 bool result = isolate->code_aging_helper()->IsYoung(sequence); |
194 DCHECK(result || isolate->code_aging_helper()->IsOld(sequence)); | 194 DCHECK(result || isolate->code_aging_helper()->IsOld(sequence)); |
195 return result; | 195 return result; |
196 } | 196 } |
197 | 197 |
198 | 198 Code::Age Code::GetCodeAge(Isolate* isolate, byte* sequence) { |
199 void Code::GetCodeAgeAndParity(Isolate* isolate, byte* sequence, Age* age, | |
200 MarkingParity* parity) { | |
201 if (IsYoungSequence(isolate, sequence)) { | 199 if (IsYoungSequence(isolate, sequence)) { |
202 *age = kNoAgeCodeAge; | 200 return kNoAgeCodeAge; |
203 *parity = NO_MARKING_PARITY; | |
204 } else { | 201 } else { |
205 Code* code = NULL; | 202 Code* code = NULL; |
206 Address target_address = | 203 Address target_address = |
207 Assembler::target_address_at(sequence + kCodeAgingTargetDelta, code); | 204 Assembler::target_address_at(sequence + kCodeAgingTargetDelta, code); |
208 Code* stub = GetCodeFromTargetAddress(target_address); | 205 Code* stub = GetCodeFromTargetAddress(target_address); |
209 GetCodeAgeAndParity(stub, age, parity); | 206 return GetAgeOfCodeAgeStub(stub); |
210 } | 207 } |
211 } | 208 } |
212 | 209 |
213 | 210 void Code::PatchPlatformCodeAge(Isolate* isolate, byte* sequence, |
214 void Code::PatchPlatformCodeAge(Isolate* isolate, byte* sequence, Code::Age age, | 211 Code::Age age) { |
215 MarkingParity parity) { | |
216 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); | 212 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); |
217 if (age == kNoAgeCodeAge) { | 213 if (age == kNoAgeCodeAge) { |
218 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); | 214 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); |
219 Assembler::FlushICache(isolate, sequence, young_length); | 215 Assembler::FlushICache(isolate, sequence, young_length); |
220 } else { | 216 } else { |
221 // FIXED_SEQUENCE | 217 // FIXED_SEQUENCE |
222 Code* stub = GetCodeAgeStub(isolate, age, parity); | 218 Code* stub = GetCodeAgeStub(isolate, age); |
223 CodePatcher patcher(isolate, sequence, | 219 CodePatcher patcher(isolate, sequence, |
224 young_length / Assembler::kInstrSize); | 220 young_length / Assembler::kInstrSize); |
225 Assembler::BlockTrampolinePoolScope block_trampoline_pool(patcher.masm()); | 221 Assembler::BlockTrampolinePoolScope block_trampoline_pool(patcher.masm()); |
226 intptr_t target = reinterpret_cast<intptr_t>(stub->instruction_start()); | 222 intptr_t target = reinterpret_cast<intptr_t>(stub->instruction_start()); |
227 // Don't use Call -- we need to preserve ip and lr. | 223 // Don't use Call -- we need to preserve ip and lr. |
228 // GenerateMakeCodeYoungAgainCommon for the stub code. | 224 // GenerateMakeCodeYoungAgainCommon for the stub code. |
229 patcher.masm()->nop(); // marker to detect sequence (see IsOld) | 225 patcher.masm()->nop(); // marker to detect sequence (see IsOld) |
230 patcher.masm()->mov(r3, Operand(target)); | 226 patcher.masm()->mov(r3, Operand(target)); |
231 patcher.masm()->Jump(r3); | 227 patcher.masm()->Jump(r3); |
232 for (int i = 0; i < kCodeAgingSequenceNops; i++) { | 228 for (int i = 0; i < kCodeAgingSequenceNops; i++) { |
233 patcher.masm()->nop(); | 229 patcher.masm()->nop(); |
234 } | 230 } |
235 } | 231 } |
236 } | 232 } |
237 } // namespace internal | 233 } // namespace internal |
238 } // namespace v8 | 234 } // namespace v8 |
239 | 235 |
240 #endif // V8_TARGET_ARCH_PPC | 236 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |