| 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 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 patcher.masm()->push(ebp); | 865 patcher.masm()->push(ebp); |
| 866 patcher.masm()->mov(ebp, esp); | 866 patcher.masm()->mov(ebp, esp); |
| 867 patcher.masm()->push(esi); | 867 patcher.masm()->push(esi); |
| 868 patcher.masm()->push(edi); | 868 patcher.masm()->push(edi); |
| 869 initialized = true; | 869 initialized = true; |
| 870 } | 870 } |
| 871 return sequence; | 871 return sequence; |
| 872 } | 872 } |
| 873 | 873 |
| 874 | 874 |
| 875 byte* Code::FindPlatformCodeAgeSequence() { | |
| 876 byte* start = instruction_start(); | |
| 877 uint32_t young_length; | |
| 878 byte* young_sequence = GetNoCodeAgeSequence(&young_length); | |
| 879 if (!memcmp(start, young_sequence, young_length) || | |
| 880 *start == kCallOpcode) { | |
| 881 return start; | |
| 882 } else { | |
| 883 if (kind() == FUNCTION) { | |
| 884 byte* start_after_strict = | |
| 885 start + kSizeOfFullCodegenStrictModePrologue; | |
| 886 ASSERT(!memcmp(start_after_strict, young_sequence, young_length) || | |
| 887 start[kSizeOfFullCodegenStrictModePrologue] == kCallOpcode); | |
| 888 return start_after_strict; | |
| 889 } else { | |
| 890 ASSERT(kind() == OPTIMIZED_FUNCTION); | |
| 891 start = instruction_start() + kSizeOfOptimizedStrictModePrologue; | |
| 892 if (!memcmp(start, young_sequence, young_length) || | |
| 893 *start == kCallOpcode) { | |
| 894 return start; | |
| 895 } | |
| 896 start = instruction_start() + kSizeOfOptimizedAlignStackPrologue; | |
| 897 if (!memcmp(start, young_sequence, young_length) || | |
| 898 *start == kCallOpcode) { | |
| 899 return start; | |
| 900 } | |
| 901 start = instruction_start() + kSizeOfOptimizedAlignStackPrologue + | |
| 902 kSizeOfOptimizedStrictModePrologue; | |
| 903 ASSERT(!memcmp(start, young_sequence, young_length) || | |
| 904 *start == kCallOpcode); | |
| 905 return start; | |
| 906 } | |
| 907 } | |
| 908 } | |
| 909 | |
| 910 | |
| 911 bool Code::IsYoungSequence(byte* sequence) { | 875 bool Code::IsYoungSequence(byte* sequence) { |
| 912 uint32_t young_length; | 876 uint32_t young_length; |
| 913 byte* young_sequence = GetNoCodeAgeSequence(&young_length); | 877 byte* young_sequence = GetNoCodeAgeSequence(&young_length); |
| 914 bool result = (!memcmp(sequence, young_sequence, young_length)); | 878 bool result = (!memcmp(sequence, young_sequence, young_length)); |
| 915 ASSERT(result || *sequence == kCallOpcode); | 879 ASSERT(result || *sequence == kCallOpcode); |
| 916 return result; | 880 return result; |
| 917 } | 881 } |
| 918 | 882 |
| 919 | 883 |
| 920 void Code::GetCodeAgeAndParity(byte* sequence, Age* age, | 884 void Code::GetCodeAgeAndParity(byte* sequence, Age* age, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 944 Code* stub = GetCodeAgeStub(age, parity); | 908 Code* stub = GetCodeAgeStub(age, parity); |
| 945 CodePatcher patcher(sequence, young_length); | 909 CodePatcher patcher(sequence, young_length); |
| 946 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE); | 910 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE); |
| 947 } | 911 } |
| 948 } | 912 } |
| 949 | 913 |
| 950 | 914 |
| 951 } } // namespace v8::internal | 915 } } // namespace v8::internal |
| 952 | 916 |
| 953 #endif // V8_TARGET_ARCH_IA32 | 917 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |