| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 patcher.masm()->push(rbp); | 674 patcher.masm()->push(rbp); |
| 675 patcher.masm()->movq(rbp, rsp); | 675 patcher.masm()->movq(rbp, rsp); |
| 676 patcher.masm()->push(rsi); | 676 patcher.masm()->push(rsi); |
| 677 patcher.masm()->push(rdi); | 677 patcher.masm()->push(rdi); |
| 678 initialized = true; | 678 initialized = true; |
| 679 } | 679 } |
| 680 return sequence; | 680 return sequence; |
| 681 } | 681 } |
| 682 | 682 |
| 683 | 683 |
| 684 byte* Code::FindPlatformCodeAgeSequence() { | |
| 685 byte* start = instruction_start(); | |
| 686 uint32_t young_length; | |
| 687 byte* young_sequence = GetNoCodeAgeSequence(&young_length); | |
| 688 if (!memcmp(start, young_sequence, young_length) || | |
| 689 *start == kCallOpcode) { | |
| 690 return start; | |
| 691 } else { | |
| 692 byte* start_after_strict = NULL; | |
| 693 if (kind() == FUNCTION) { | |
| 694 start_after_strict = start + kSizeOfFullCodegenStrictModePrologue; | |
| 695 } else { | |
| 696 ASSERT(kind() == OPTIMIZED_FUNCTION); | |
| 697 start_after_strict = start + kSizeOfOptimizedStrictModePrologue; | |
| 698 } | |
| 699 ASSERT(!memcmp(start_after_strict, young_sequence, young_length) || | |
| 700 *start_after_strict == kCallOpcode); | |
| 701 return start_after_strict; | |
| 702 } | |
| 703 } | |
| 704 | |
| 705 | |
| 706 bool Code::IsYoungSequence(byte* sequence) { | 684 bool Code::IsYoungSequence(byte* sequence) { |
| 707 uint32_t young_length; | 685 uint32_t young_length; |
| 708 byte* young_sequence = GetNoCodeAgeSequence(&young_length); | 686 byte* young_sequence = GetNoCodeAgeSequence(&young_length); |
| 709 bool result = (!memcmp(sequence, young_sequence, young_length)); | 687 bool result = (!memcmp(sequence, young_sequence, young_length)); |
| 710 ASSERT(result || *sequence == kCallOpcode); | 688 ASSERT(result || *sequence == kCallOpcode); |
| 711 return result; | 689 return result; |
| 712 } | 690 } |
| 713 | 691 |
| 714 | 692 |
| 715 void Code::GetCodeAgeAndParity(byte* sequence, Age* age, | 693 void Code::GetCodeAgeAndParity(byte* sequence, Age* age, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 740 CodePatcher patcher(sequence, young_length); | 718 CodePatcher patcher(sequence, young_length); |
| 741 patcher.masm()->call(stub->instruction_start()); | 719 patcher.masm()->call(stub->instruction_start()); |
| 742 patcher.masm()->nop(); | 720 patcher.masm()->nop(); |
| 743 } | 721 } |
| 744 } | 722 } |
| 745 | 723 |
| 746 | 724 |
| 747 } } // namespace v8::internal | 725 } } // namespace v8::internal |
| 748 | 726 |
| 749 #endif // V8_TARGET_ARCH_X64 | 727 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |