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/x64/codegen-x64.h" | 5 #include "src/x64/codegen-x64.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
(...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 sequence++; // Skip the kCallOpcode byte | 202 sequence++; // Skip the kCallOpcode byte |
206 Address target_address = sequence + *reinterpret_cast<int*>(sequence) + | 203 Address target_address = sequence + *reinterpret_cast<int*>(sequence) + |
207 Assembler::kCallTargetAddressOffset; | 204 Assembler::kCallTargetAddressOffset; |
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, | 211 Code::Age age) { |
215 byte* sequence, | |
216 Code::Age age, | |
217 MarkingParity parity) { | |
218 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); | 212 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); |
219 if (age == kNoAgeCodeAge) { | 213 if (age == kNoAgeCodeAge) { |
220 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); | 214 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); |
221 Assembler::FlushICache(isolate, sequence, young_length); | 215 Assembler::FlushICache(isolate, sequence, young_length); |
222 } else { | 216 } else { |
223 Code* stub = GetCodeAgeStub(isolate, age, parity); | 217 Code* stub = GetCodeAgeStub(isolate, age); |
224 CodePatcher patcher(isolate, sequence, young_length); | 218 CodePatcher patcher(isolate, sequence, young_length); |
225 patcher.masm()->call(stub->instruction_start()); | 219 patcher.masm()->call(stub->instruction_start()); |
226 patcher.masm()->Nop( | 220 patcher.masm()->Nop( |
227 kNoCodeAgeSequenceLength - Assembler::kShortCallInstructionLength); | 221 kNoCodeAgeSequenceLength - Assembler::kShortCallInstructionLength); |
228 } | 222 } |
229 } | 223 } |
230 | 224 |
231 | 225 |
232 Operand StackArgumentsAccessor::GetArgumentOperand(int index) { | 226 Operand StackArgumentsAccessor::GetArgumentOperand(int index) { |
233 DCHECK(index >= 0); | 227 DCHECK(index >= 0); |
(...skipping 13 matching lines...) Expand all Loading... |
247 return Operand(base_reg_, argument_count_reg_, times_pointer_size, | 241 return Operand(base_reg_, argument_count_reg_, times_pointer_size, |
248 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); | 242 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); |
249 } | 243 } |
250 } | 244 } |
251 | 245 |
252 | 246 |
253 } // namespace internal | 247 } // namespace internal |
254 } // namespace v8 | 248 } // namespace v8 |
255 | 249 |
256 #endif // V8_TARGET_ARCH_X64 | 250 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |