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