| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/arm/codegen-arm.h" | 5 #include "src/arm/codegen-arm.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 } | 433 } |
| 434 #endif | 434 #endif |
| 435 | 435 |
| 436 | 436 |
| 437 bool Code::IsYoungSequence(Isolate* isolate, byte* sequence) { | 437 bool Code::IsYoungSequence(Isolate* isolate, byte* sequence) { |
| 438 bool result = isolate->code_aging_helper()->IsYoung(sequence); | 438 bool result = isolate->code_aging_helper()->IsYoung(sequence); |
| 439 DCHECK(result || isolate->code_aging_helper()->IsOld(sequence)); | 439 DCHECK(result || isolate->code_aging_helper()->IsOld(sequence)); |
| 440 return result; | 440 return result; |
| 441 } | 441 } |
| 442 | 442 |
| 443 Code::Age Code::GetCodeAge(Isolate* isolate, byte* sequence) { |
| 444 if (IsYoungSequence(isolate, sequence)) return kNoAgeCodeAge; |
| 443 | 445 |
| 444 void Code::GetCodeAgeAndParity(Isolate* isolate, byte* sequence, Age* age, | 446 Address target_address = Memory::Address_at( |
| 445 MarkingParity* parity) { | 447 sequence + (kNoCodeAgeSequenceLength - Assembler::kInstrSize)); |
| 446 if (IsYoungSequence(isolate, sequence)) { | 448 Code* stub = GetCodeFromTargetAddress(target_address); |
| 447 *age = kNoAgeCodeAge; | 449 return GetAgeOfCodeAgeStub(stub); |
| 448 *parity = NO_MARKING_PARITY; | |
| 449 } else { | |
| 450 Address target_address = Memory::Address_at( | |
| 451 sequence + (kNoCodeAgeSequenceLength - Assembler::kInstrSize)); | |
| 452 Code* stub = GetCodeFromTargetAddress(target_address); | |
| 453 GetCodeAgeAndParity(stub, age, parity); | |
| 454 } | |
| 455 } | 450 } |
| 456 | 451 |
| 457 | 452 void Code::PatchPlatformCodeAge(Isolate* isolate, byte* sequence, |
| 458 void Code::PatchPlatformCodeAge(Isolate* isolate, | 453 Code::Age age) { |
| 459 byte* sequence, | |
| 460 Code::Age age, | |
| 461 MarkingParity parity) { | |
| 462 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); | 454 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); |
| 463 if (age == kNoAgeCodeAge) { | 455 if (age == kNoAgeCodeAge) { |
| 464 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); | 456 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); |
| 465 Assembler::FlushICache(isolate, sequence, young_length); | 457 Assembler::FlushICache(isolate, sequence, young_length); |
| 466 } else { | 458 } else { |
| 467 Code* stub = GetCodeAgeStub(isolate, age, parity); | 459 Code* stub = GetCodeAgeStub(isolate, age); |
| 468 CodePatcher patcher(isolate, sequence, | 460 CodePatcher patcher(isolate, sequence, |
| 469 young_length / Assembler::kInstrSize); | 461 young_length / Assembler::kInstrSize); |
| 470 patcher.masm()->add(r0, pc, Operand(-8)); | 462 patcher.masm()->add(r0, pc, Operand(-8)); |
| 471 patcher.masm()->ldr(pc, MemOperand(pc, -4)); | 463 patcher.masm()->ldr(pc, MemOperand(pc, -4)); |
| 472 patcher.masm()->emit_code_stub_address(stub); | 464 patcher.masm()->emit_code_stub_address(stub); |
| 473 } | 465 } |
| 474 } | 466 } |
| 475 | 467 |
| 476 | |
| 477 } // namespace internal | 468 } // namespace internal |
| 478 } // namespace v8 | 469 } // namespace v8 |
| 479 | 470 |
| 480 #endif // V8_TARGET_ARCH_ARM | 471 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |