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 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 byte* young_sequence = GetNoCodeAgeSequence(&young_length); | 1142 byte* young_sequence = GetNoCodeAgeSequence(&young_length); |
1143 bool result = (!memcmp(sequence, young_sequence, young_length)); | 1143 bool result = (!memcmp(sequence, young_sequence, young_length)); |
1144 ASSERT(result || *sequence == kCallOpcode); | 1144 ASSERT(result || *sequence == kCallOpcode); |
1145 return result; | 1145 return result; |
1146 } | 1146 } |
1147 | 1147 |
1148 | 1148 |
1149 void Code::GetCodeAgeAndParity(byte* sequence, Age* age, | 1149 void Code::GetCodeAgeAndParity(byte* sequence, Age* age, |
1150 MarkingParity* parity) { | 1150 MarkingParity* parity) { |
1151 if (IsYoungSequence(sequence)) { | 1151 if (IsYoungSequence(sequence)) { |
1152 *age = kNoAge; | 1152 *age = kNoAgeCodeAge; |
1153 *parity = NO_MARKING_PARITY; | 1153 *parity = NO_MARKING_PARITY; |
1154 } else { | 1154 } else { |
1155 sequence++; // Skip the kCallOpcode byte | 1155 sequence++; // Skip the kCallOpcode byte |
1156 Address target_address = sequence + *reinterpret_cast<int*>(sequence) + | 1156 Address target_address = sequence + *reinterpret_cast<int*>(sequence) + |
1157 Assembler::kCallTargetAddressOffset; | 1157 Assembler::kCallTargetAddressOffset; |
1158 Code* stub = GetCodeFromTargetAddress(target_address); | 1158 Code* stub = GetCodeFromTargetAddress(target_address); |
1159 GetCodeAgeAndParity(stub, age, parity); | 1159 GetCodeAgeAndParity(stub, age, parity); |
1160 } | 1160 } |
1161 } | 1161 } |
1162 | 1162 |
1163 | 1163 |
1164 void Code::PatchPlatformCodeAge(Isolate* isolate, | 1164 void Code::PatchPlatformCodeAge(Isolate* isolate, |
1165 byte* sequence, | 1165 byte* sequence, |
1166 Code::Age age, | 1166 Code::Age age, |
1167 MarkingParity parity) { | 1167 MarkingParity parity) { |
1168 uint32_t young_length; | 1168 uint32_t young_length; |
1169 byte* young_sequence = GetNoCodeAgeSequence(&young_length); | 1169 byte* young_sequence = GetNoCodeAgeSequence(&young_length); |
1170 if (age == kNoAge) { | 1170 if (age == kNoAgeCodeAge) { |
1171 CopyBytes(sequence, young_sequence, young_length); | 1171 CopyBytes(sequence, young_sequence, young_length); |
1172 CPU::FlushICache(sequence, young_length); | 1172 CPU::FlushICache(sequence, young_length); |
1173 } else { | 1173 } else { |
1174 Code* stub = GetCodeAgeStub(isolate, age, parity); | 1174 Code* stub = GetCodeAgeStub(isolate, age, parity); |
1175 CodePatcher patcher(sequence, young_length); | 1175 CodePatcher patcher(sequence, young_length); |
1176 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 1176 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
1177 } | 1177 } |
1178 } | 1178 } |
1179 | 1179 |
1180 | 1180 |
1181 } } // namespace v8::internal | 1181 } } // namespace v8::internal |
1182 | 1182 |
1183 #endif // V8_TARGET_ARCH_IA32 | 1183 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |