| 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 Code::Age Code::GetCodeAge(Isolate* isolate, byte* sequence) { |
| 348 if (IsYoungSequence(isolate, sequence)) return kNoAgeCodeAge; |
| 347 | 349 |
| 348 void Code::GetCodeAgeAndParity(Isolate* isolate, byte* sequence, Age* age, | 350 sequence++; // Skip the kCallOpcode byte |
| 349 MarkingParity* parity) { | 351 Address target_address = sequence + *reinterpret_cast<int*>(sequence) + |
| 350 if (IsYoungSequence(isolate, sequence)) { | 352 Assembler::kCallTargetAddressOffset; |
| 351 *age = kNoAgeCodeAge; | 353 Code* stub = GetCodeFromTargetAddress(target_address); |
| 352 *parity = NO_MARKING_PARITY; | 354 return GetAgeOfCodeAgeStub(stub); |
| 353 } else { | |
| 354 sequence++; // Skip the kCallOpcode byte | |
| 355 Address target_address = sequence + *reinterpret_cast<int*>(sequence) + | |
| 356 Assembler::kCallTargetAddressOffset; | |
| 357 Code* stub = GetCodeFromTargetAddress(target_address); | |
| 358 GetCodeAgeAndParity(stub, age, parity); | |
| 359 } | |
| 360 } | 355 } |
| 361 | 356 |
| 362 | 357 void Code::PatchPlatformCodeAge(Isolate* isolate, byte* sequence, |
| 363 void Code::PatchPlatformCodeAge(Isolate* isolate, | 358 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(); | 359 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); |
| 368 if (age == kNoAgeCodeAge) { | 360 if (age == kNoAgeCodeAge) { |
| 369 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); | 361 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); |
| 370 Assembler::FlushICache(isolate, sequence, young_length); | 362 Assembler::FlushICache(isolate, sequence, young_length); |
| 371 } else { | 363 } else { |
| 372 Code* stub = GetCodeAgeStub(isolate, age, parity); | 364 Code* stub = GetCodeAgeStub(isolate, age); |
| 373 CodePatcher patcher(isolate, sequence, young_length); | 365 CodePatcher patcher(isolate, sequence, young_length); |
| 374 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 366 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
| 375 } | 367 } |
| 376 } | 368 } |
| 377 | 369 |
| 378 | 370 |
| 379 } // namespace internal | 371 } // namespace internal |
| 380 } // namespace v8 | 372 } // namespace v8 |
| 381 | 373 |
| 382 #endif // V8_TARGET_ARCH_X87 | 374 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |