OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 bool result = !memcmp(sequence, young_sequence, young_length); | 864 bool result = !memcmp(sequence, young_sequence, young_length); |
865 ASSERT(result || | 865 ASSERT(result || |
866 Memory::uint32_at(sequence) == kCodeAgePatchFirstInstruction); | 866 Memory::uint32_at(sequence) == kCodeAgePatchFirstInstruction); |
867 return result; | 867 return result; |
868 } | 868 } |
869 | 869 |
870 | 870 |
871 void Code::GetCodeAgeAndParity(byte* sequence, Age* age, | 871 void Code::GetCodeAgeAndParity(byte* sequence, Age* age, |
872 MarkingParity* parity) { | 872 MarkingParity* parity) { |
873 if (IsYoungSequence(sequence)) { | 873 if (IsYoungSequence(sequence)) { |
874 *age = kNoAge; | 874 *age = kNoAgeCodeAge; |
875 *parity = NO_MARKING_PARITY; | 875 *parity = NO_MARKING_PARITY; |
876 } else { | 876 } else { |
877 Address target_address = Memory::Address_at( | 877 Address target_address = Memory::Address_at( |
878 sequence + Assembler::kInstrSize * (kNoCodeAgeSequenceLength - 1)); | 878 sequence + Assembler::kInstrSize * (kNoCodeAgeSequenceLength - 1)); |
879 Code* stub = GetCodeFromTargetAddress(target_address); | 879 Code* stub = GetCodeFromTargetAddress(target_address); |
880 GetCodeAgeAndParity(stub, age, parity); | 880 GetCodeAgeAndParity(stub, age, parity); |
881 } | 881 } |
882 } | 882 } |
883 | 883 |
884 | 884 |
885 void Code::PatchPlatformCodeAge(Isolate* isolate, | 885 void Code::PatchPlatformCodeAge(Isolate* isolate, |
886 byte* sequence, | 886 byte* sequence, |
887 Code::Age age, | 887 Code::Age age, |
888 MarkingParity parity) { | 888 MarkingParity parity) { |
889 uint32_t young_length; | 889 uint32_t young_length; |
890 byte* young_sequence = GetNoCodeAgeSequence(&young_length); | 890 byte* young_sequence = GetNoCodeAgeSequence(&young_length); |
891 if (age == kNoAge) { | 891 if (age == kNoAgeCodeAge) { |
892 CopyBytes(sequence, young_sequence, young_length); | 892 CopyBytes(sequence, young_sequence, young_length); |
893 CPU::FlushICache(sequence, young_length); | 893 CPU::FlushICache(sequence, young_length); |
894 } else { | 894 } else { |
895 Code* stub = GetCodeAgeStub(isolate, age, parity); | 895 Code* stub = GetCodeAgeStub(isolate, age, parity); |
896 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize); | 896 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize); |
897 patcher.masm()->add(r0, pc, Operand(-8)); | 897 patcher.masm()->add(r0, pc, Operand(-8)); |
898 patcher.masm()->ldr(pc, MemOperand(pc, -4)); | 898 patcher.masm()->ldr(pc, MemOperand(pc, -4)); |
899 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); | 899 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); |
900 } | 900 } |
901 } | 901 } |
902 | 902 |
903 | 903 |
904 } } // namespace v8::internal | 904 } } // namespace v8::internal |
905 | 905 |
906 #endif // V8_TARGET_ARCH_ARM | 906 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |