| 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 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 #endif | 850 #endif |
| 851 | 851 |
| 852 static byte* GetNoCodeAgeSequence(uint32_t* length) { | 852 static byte* GetNoCodeAgeSequence(uint32_t* length) { |
| 853 // The sequence of instructions that is patched out for aging code is the | 853 // The sequence of instructions that is patched out for aging code is the |
| 854 // following boilerplate stack-building prologue that is found in FUNCTIONS | 854 // following boilerplate stack-building prologue that is found in FUNCTIONS |
| 855 static bool initialized = false; | 855 static bool initialized = false; |
| 856 static uint32_t sequence[kNoCodeAgeSequenceLength]; | 856 static uint32_t sequence[kNoCodeAgeSequenceLength]; |
| 857 byte* byte_sequence = reinterpret_cast<byte*>(sequence); | 857 byte* byte_sequence = reinterpret_cast<byte*>(sequence); |
| 858 *length = kNoCodeAgeSequenceLength * Assembler::kInstrSize; | 858 *length = kNoCodeAgeSequenceLength * Assembler::kInstrSize; |
| 859 if (!initialized) { | 859 if (!initialized) { |
| 860 CodePatcher patcher(byte_sequence, kNoCodeAgeSequenceLength); | 860 // Since patcher is a large object, allocate it dynamically when needed, |
| 861 PredictableCodeSizeScope scope(patcher.masm(), *length); | 861 // to avoid overloading the stack in stress conditions. |
| 862 patcher.masm()->PushFixedFrame(r1); | 862 SmartPointer<CodePatcher> |
| 863 patcher.masm()->nop(ip.code()); | 863 patcher(new CodePatcher(byte_sequence, kNoCodeAgeSequenceLength)); |
| 864 patcher.masm()->add(fp, sp, | 864 PredictableCodeSizeScope scope(patcher->masm(), *length); |
| 865 Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 865 patcher->masm()->PushFixedFrame(r1); |
| 866 patcher->masm()->nop(ip.code()); |
| 867 patcher->masm()->add( |
| 868 fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
| 866 initialized = true; | 869 initialized = true; |
| 867 } | 870 } |
| 868 return byte_sequence; | 871 return byte_sequence; |
| 869 } | 872 } |
| 870 | 873 |
| 871 | 874 |
| 872 bool Code::IsYoungSequence(byte* sequence) { | 875 bool Code::IsYoungSequence(byte* sequence) { |
| 873 uint32_t young_length; | 876 uint32_t young_length; |
| 874 byte* young_sequence = GetNoCodeAgeSequence(&young_length); | 877 byte* young_sequence = GetNoCodeAgeSequence(&young_length); |
| 875 bool result = !memcmp(sequence, young_sequence, young_length); | 878 bool result = !memcmp(sequence, young_sequence, young_length); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 patcher.masm()->add(r0, pc, Operand(-8)); | 911 patcher.masm()->add(r0, pc, Operand(-8)); |
| 909 patcher.masm()->ldr(pc, MemOperand(pc, -4)); | 912 patcher.masm()->ldr(pc, MemOperand(pc, -4)); |
| 910 patcher.masm()->emit_code_stub_address(stub); | 913 patcher.masm()->emit_code_stub_address(stub); |
| 911 } | 914 } |
| 912 } | 915 } |
| 913 | 916 |
| 914 | 917 |
| 915 } } // namespace v8::internal | 918 } } // namespace v8::internal |
| 916 | 919 |
| 917 #endif // V8_TARGET_ARCH_ARM | 920 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |