OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "codegen.h" | 9 #include "codegen.h" |
10 #include "macro-assembler.h" | 10 #include "macro-assembler.h" |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 __ Pop(lr); | 343 __ Pop(lr); |
344 | 344 |
345 __ Bind(&only_change_map); | 345 __ Bind(&only_change_map); |
346 __ Str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); | 346 __ Str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
347 __ RecordWriteField(receiver, HeapObject::kMapOffset, target_map, x13, | 347 __ RecordWriteField(receiver, HeapObject::kMapOffset, target_map, x13, |
348 kLRHasNotBeenSaved, kDontSaveFPRegs, OMIT_REMEMBERED_SET, | 348 kLRHasNotBeenSaved, kDontSaveFPRegs, OMIT_REMEMBERED_SET, |
349 OMIT_SMI_CHECK); | 349 OMIT_SMI_CHECK); |
350 } | 350 } |
351 | 351 |
352 | 352 |
353 bool Code::IsYoungSequence(byte* sequence) { | 353 CodeAgingHelper::CodeAgingHelper() { |
354 return MacroAssembler::IsYoungSequence(sequence); | 354 ASSERT(young_sequence_.length() == kNoCodeAgeSequenceLength); |
| 355 // The sequence of instructions that is patched out for aging code is the |
| 356 // following boilerplate stack-building prologue that is found both in |
| 357 // FUNCTION and OPTIMIZED_FUNCTION code: |
| 358 PatchingAssembler patcher(young_sequence_.start(), |
| 359 young_sequence_.length() / kInstructionSize); |
| 360 // The young sequence is the frame setup code for FUNCTION code types. It is |
| 361 // generated by FullCodeGenerator::Generate. |
| 362 MacroAssembler::EmitFrameSetupForCodeAgePatching(&patcher); |
| 363 |
| 364 #ifdef DEBUG |
| 365 const int length = kCodeAgeStubEntryOffset / kInstructionSize; |
| 366 ASSERT(old_sequence_.length() >= kCodeAgeStubEntryOffset); |
| 367 PatchingAssembler patcher_old(old_sequence_.start(), length); |
| 368 MacroAssembler::EmitCodeAgeSequence(&patcher_old, NULL); |
| 369 #endif |
355 } | 370 } |
356 | 371 |
357 | 372 |
358 void Code::GetCodeAgeAndParity(byte* sequence, Age* age, | 373 #ifdef DEBUG |
| 374 bool CodeAgingHelper::IsOld(byte* candidate) const { |
| 375 return memcmp(candidate, old_sequence_.start(), kCodeAgeStubEntryOffset) == 0; |
| 376 } |
| 377 #endif |
| 378 |
| 379 |
| 380 bool Code::IsYoungSequence(Isolate* isolate, byte* sequence) { |
| 381 return MacroAssembler::IsYoungSequence(isolate, sequence); |
| 382 } |
| 383 |
| 384 |
| 385 void Code::GetCodeAgeAndParity(Isolate* isolate, byte* sequence, Age* age, |
359 MarkingParity* parity) { | 386 MarkingParity* parity) { |
360 if (IsYoungSequence(sequence)) { | 387 if (IsYoungSequence(isolate, sequence)) { |
361 *age = kNoAgeCodeAge; | 388 *age = kNoAgeCodeAge; |
362 *parity = NO_MARKING_PARITY; | 389 *parity = NO_MARKING_PARITY; |
363 } else { | 390 } else { |
364 byte* target = sequence + kCodeAgeStubEntryOffset; | 391 byte* target = sequence + kCodeAgeStubEntryOffset; |
365 Code* stub = GetCodeFromTargetAddress(Memory::Address_at(target)); | 392 Code* stub = GetCodeFromTargetAddress(Memory::Address_at(target)); |
366 GetCodeAgeAndParity(stub, age, parity); | 393 GetCodeAgeAndParity(stub, age, parity); |
367 } | 394 } |
368 } | 395 } |
369 | 396 |
370 | 397 |
371 void Code::PatchPlatformCodeAge(Isolate* isolate, | 398 void Code::PatchPlatformCodeAge(Isolate* isolate, |
372 byte* sequence, | 399 byte* sequence, |
373 Code::Age age, | 400 Code::Age age, |
374 MarkingParity parity) { | 401 MarkingParity parity) { |
375 PatchingAssembler patcher(sequence, kCodeAgeSequenceSize / kInstructionSize); | 402 PatchingAssembler patcher(sequence, |
| 403 kNoCodeAgeSequenceLength / kInstructionSize); |
376 if (age == kNoAgeCodeAge) { | 404 if (age == kNoAgeCodeAge) { |
377 MacroAssembler::EmitFrameSetupForCodeAgePatching(&patcher); | 405 MacroAssembler::EmitFrameSetupForCodeAgePatching(&patcher); |
378 } else { | 406 } else { |
379 Code * stub = GetCodeAgeStub(isolate, age, parity); | 407 Code * stub = GetCodeAgeStub(isolate, age, parity); |
380 MacroAssembler::EmitCodeAgeSequence(&patcher, stub); | 408 MacroAssembler::EmitCodeAgeSequence(&patcher, stub); |
381 } | 409 } |
382 } | 410 } |
383 | 411 |
384 | 412 |
385 void StringCharLoadGenerator::Generate(MacroAssembler* masm, | 413 void StringCharLoadGenerator::Generate(MacroAssembler* masm, |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 __ Fmul(result, double_temp3, double_temp1); | 611 __ Fmul(result, double_temp3, double_temp1); |
584 | 612 |
585 __ Bind(&done); | 613 __ Bind(&done); |
586 } | 614 } |
587 | 615 |
588 #undef __ | 616 #undef __ |
589 | 617 |
590 } } // namespace v8::internal | 618 } } // namespace v8::internal |
591 | 619 |
592 #endif // V8_TARGET_ARCH_ARM64 | 620 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |