| 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/x87/codegen-x87.h" | 5 #include "src/x87/codegen-x87.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 } | 337 } |
| 338 #endif | 338 #endif |
| 339 | 339 |
| 340 | 340 |
| 341 bool Code::IsYoungSequence(Isolate* isolate, byte* sequence) { | 341 bool Code::IsYoungSequence(Isolate* isolate, byte* sequence) { |
| 342 bool result = isolate->code_aging_helper()->IsYoung(sequence); | 342 bool result = isolate->code_aging_helper()->IsYoung(sequence); |
| 343 DCHECK(result || isolate->code_aging_helper()->IsOld(sequence)); | 343 DCHECK(result || isolate->code_aging_helper()->IsOld(sequence)); |
| 344 return result; | 344 return result; |
| 345 } | 345 } |
| 346 | 346 |
| 347 | 347 Code::Age Code::GetCodeAge(Isolate* isolate, byte* sequence) { |
| 348 void Code::GetCodeAgeAndParity(Isolate* isolate, byte* sequence, Age* age, | |
| 349 MarkingParity* parity) { | |
| 350 if (IsYoungSequence(isolate, sequence)) { | 348 if (IsYoungSequence(isolate, sequence)) { |
| 351 *age = kNoAgeCodeAge; | 349 return kNoAgeCodeAge; |
| 352 *parity = NO_MARKING_PARITY; | |
| 353 } else { | 350 } else { |
| 354 sequence++; // Skip the kCallOpcode byte | 351 sequence++; // Skip the kCallOpcode byte |
| 355 Address target_address = sequence + *reinterpret_cast<int*>(sequence) + | 352 Address target_address = sequence + *reinterpret_cast<int*>(sequence) + |
| 356 Assembler::kCallTargetAddressOffset; | 353 Assembler::kCallTargetAddressOffset; |
| 357 Code* stub = GetCodeFromTargetAddress(target_address); | 354 Code* stub = GetCodeFromTargetAddress(target_address); |
| 358 GetCodeAgeAndParity(stub, age, parity); | 355 return GetAgeOfCodeAgeStub(stub); |
| 359 } | 356 } |
| 360 } | 357 } |
| 361 | 358 |
| 362 | 359 void Code::PatchPlatformCodeAge(Isolate* isolate, byte* sequence, |
| 363 void Code::PatchPlatformCodeAge(Isolate* isolate, | 360 Code::Age age) { |
| 364 byte* sequence, | |
| 365 Code::Age age, | |
| 366 MarkingParity parity) { | |
| 367 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); | 361 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); |
| 368 if (age == kNoAgeCodeAge) { | 362 if (age == kNoAgeCodeAge) { |
| 369 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); | 363 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); |
| 370 Assembler::FlushICache(isolate, sequence, young_length); | 364 Assembler::FlushICache(isolate, sequence, young_length); |
| 371 } else { | 365 } else { |
| 372 Code* stub = GetCodeAgeStub(isolate, age, parity); | 366 Code* stub = GetCodeAgeStub(isolate, age); |
| 373 CodePatcher patcher(isolate, sequence, young_length); | 367 CodePatcher patcher(isolate, sequence, young_length); |
| 374 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 368 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
| 375 } | 369 } |
| 376 } | 370 } |
| 377 | 371 |
| 378 | 372 |
| 379 } // namespace internal | 373 } // namespace internal |
| 380 } // namespace v8 | 374 } // namespace v8 |
| 381 | 375 |
| 382 #endif // V8_TARGET_ARCH_X87 | 376 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |