| 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/ia32/codegen-ia32.h" | 5 #include "src/ia32/codegen-ia32.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 8 | 8 |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/heap/heap.h" | 10 #include "src/heap/heap.h" |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 } | 609 } |
| 610 #endif | 610 #endif |
| 611 | 611 |
| 612 | 612 |
| 613 bool Code::IsYoungSequence(Isolate* isolate, byte* sequence) { | 613 bool Code::IsYoungSequence(Isolate* isolate, byte* sequence) { |
| 614 bool result = isolate->code_aging_helper()->IsYoung(sequence); | 614 bool result = isolate->code_aging_helper()->IsYoung(sequence); |
| 615 DCHECK(result || isolate->code_aging_helper()->IsOld(sequence)); | 615 DCHECK(result || isolate->code_aging_helper()->IsOld(sequence)); |
| 616 return result; | 616 return result; |
| 617 } | 617 } |
| 618 | 618 |
| 619 Code::Age Code::GetCodeAge(Isolate* isolate, byte* sequence) { |
| 620 if (IsYoungSequence(isolate, sequence)) return kNoAgeCodeAge; |
| 619 | 621 |
| 620 void Code::GetCodeAgeAndParity(Isolate* isolate, byte* sequence, Age* age, | 622 sequence++; // Skip the kCallOpcode byte |
| 621 MarkingParity* parity) { | 623 Address target_address = sequence + *reinterpret_cast<int*>(sequence) + |
| 622 if (IsYoungSequence(isolate, sequence)) { | 624 Assembler::kCallTargetAddressOffset; |
| 623 *age = kNoAgeCodeAge; | 625 Code* stub = GetCodeFromTargetAddress(target_address); |
| 624 *parity = NO_MARKING_PARITY; | 626 return GetAgeOfCodeAgeStub(stub); |
| 625 } else { | |
| 626 sequence++; // Skip the kCallOpcode byte | |
| 627 Address target_address = sequence + *reinterpret_cast<int*>(sequence) + | |
| 628 Assembler::kCallTargetAddressOffset; | |
| 629 Code* stub = GetCodeFromTargetAddress(target_address); | |
| 630 GetCodeAgeAndParity(stub, age, parity); | |
| 631 } | |
| 632 } | 627 } |
| 633 | 628 |
| 634 | 629 void Code::PatchPlatformCodeAge(Isolate* isolate, byte* sequence, |
| 635 void Code::PatchPlatformCodeAge(Isolate* isolate, | 630 Code::Age age) { |
| 636 byte* sequence, | |
| 637 Code::Age age, | |
| 638 MarkingParity parity) { | |
| 639 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); | 631 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); |
| 640 if (age == kNoAgeCodeAge) { | 632 if (age == kNoAgeCodeAge) { |
| 641 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); | 633 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); |
| 642 Assembler::FlushICache(isolate, sequence, young_length); | 634 Assembler::FlushICache(isolate, sequence, young_length); |
| 643 } else { | 635 } else { |
| 644 Code* stub = GetCodeAgeStub(isolate, age, parity); | 636 Code* stub = GetCodeAgeStub(isolate, age); |
| 645 CodePatcher patcher(isolate, sequence, young_length); | 637 CodePatcher patcher(isolate, sequence, young_length); |
| 646 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 638 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
| 647 } | 639 } |
| 648 } | 640 } |
| 649 | 641 |
| 650 | 642 |
| 651 } // namespace internal | 643 } // namespace internal |
| 652 } // namespace v8 | 644 } // namespace v8 |
| 653 | 645 |
| 654 #endif // V8_TARGET_ARCH_IA32 | 646 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |