| 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/ia32/codegen-ia32.h" |    5 #include "src/ia32/codegen-ia32.h" | 
|    6  |    6  | 
|    7 #if V8_TARGET_ARCH_IA32 |    7 #if V8_TARGET_ARCH_IA32 | 
|    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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  609 } |  609 } | 
|  610 #endif |  610 #endif | 
|  611  |  611  | 
|  612  |  612  | 
|  613 bool Code::IsYoungSequence(Isolate* isolate, byte* sequence) { |  613 bool Code::IsYoungSequence(Isolate* isolate, byte* sequence) { | 
|  614   bool result = isolate->code_aging_helper()->IsYoung(sequence); |  614   bool result = isolate->code_aging_helper()->IsYoung(sequence); | 
|  615   DCHECK(result || isolate->code_aging_helper()->IsOld(sequence)); |  615   DCHECK(result || isolate->code_aging_helper()->IsOld(sequence)); | 
|  616   return result; |  616   return result; | 
|  617 } |  617 } | 
|  618  |  618  | 
|  619  |  619 Code::Age Code::GetCodeAge(Isolate* isolate, byte* sequence) { | 
|  620 void Code::GetCodeAgeAndParity(Isolate* isolate, byte* sequence, Age* age, |  | 
|  621                                MarkingParity* parity) { |  | 
|  622   if (IsYoungSequence(isolate, sequence)) { |  620   if (IsYoungSequence(isolate, sequence)) { | 
|  623     *age = kNoAgeCodeAge; |  621     return kNoAgeCodeAge; | 
|  624     *parity = NO_MARKING_PARITY; |  | 
|  625   } else { |  622   } else { | 
|  626     sequence++;  // Skip the kCallOpcode byte |  623     sequence++;  // Skip the kCallOpcode byte | 
|  627     Address target_address = sequence + *reinterpret_cast<int*>(sequence) + |  624     Address target_address = sequence + *reinterpret_cast<int*>(sequence) + | 
|  628         Assembler::kCallTargetAddressOffset; |  625         Assembler::kCallTargetAddressOffset; | 
|  629     Code* stub = GetCodeFromTargetAddress(target_address); |  626     Code* stub = GetCodeFromTargetAddress(target_address); | 
|  630     GetCodeAgeAndParity(stub, age, parity); |  627     return GetAgeOfCodeAgeStub(stub); | 
|  631   } |  628   } | 
|  632 } |  629 } | 
|  633  |  630  | 
|  634  |  631 void Code::PatchPlatformCodeAge(Isolate* isolate, byte* sequence, | 
|  635 void Code::PatchPlatformCodeAge(Isolate* isolate, |  632                                 Code::Age age) { | 
|  636                                 byte* sequence, |  | 
|  637                                 Code::Age age, |  | 
|  638                                 MarkingParity parity) { |  | 
|  639   uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); |  633   uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); | 
|  640   if (age == kNoAgeCodeAge) { |  634   if (age == kNoAgeCodeAge) { | 
|  641     isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); |  635     isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); | 
|  642     Assembler::FlushICache(isolate, sequence, young_length); |  636     Assembler::FlushICache(isolate, sequence, young_length); | 
|  643   } else { |  637   } else { | 
|  644     Code* stub = GetCodeAgeStub(isolate, age, parity); |  638     Code* stub = GetCodeAgeStub(isolate, age); | 
|  645     CodePatcher patcher(isolate, sequence, young_length); |  639     CodePatcher patcher(isolate, sequence, young_length); | 
|  646     patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |  640     patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 
|  647   } |  641   } | 
|  648 } |  642 } | 
|  649  |  643  | 
|  650  |  644  | 
|  651 }  // namespace internal |  645 }  // namespace internal | 
|  652 }  // namespace v8 |  646 }  // namespace v8 | 
|  653  |  647  | 
|  654 #endif  // V8_TARGET_ARCH_IA32 |  648 #endif  // V8_TARGET_ARCH_IA32 | 
| OLD | NEW |