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 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 #endif | 1041 #endif |
1042 | 1042 |
1043 static byte* GetNoCodeAgeSequence(uint32_t* length) { | 1043 static byte* GetNoCodeAgeSequence(uint32_t* length) { |
1044 // The sequence of instructions that is patched out for aging code is the | 1044 // The sequence of instructions that is patched out for aging code is the |
1045 // following boilerplate stack-building prologue that is found in FUNCTIONS | 1045 // following boilerplate stack-building prologue that is found in FUNCTIONS |
1046 static bool initialized = false; | 1046 static bool initialized = false; |
1047 static uint32_t sequence[kNoCodeAgeSequenceLength]; | 1047 static uint32_t sequence[kNoCodeAgeSequenceLength]; |
1048 byte* byte_sequence = reinterpret_cast<byte*>(sequence); | 1048 byte* byte_sequence = reinterpret_cast<byte*>(sequence); |
1049 *length = kNoCodeAgeSequenceLength * Assembler::kInstrSize; | 1049 *length = kNoCodeAgeSequenceLength * Assembler::kInstrSize; |
1050 if (!initialized) { | 1050 if (!initialized) { |
1051 CodePatcher patcher(byte_sequence, kNoCodeAgeSequenceLength); | 1051 // Since patcher is a large object, allocate it dynamically when needed, |
1052 patcher.masm()->Push(ra, fp, cp, a1); | 1052 // to avoid overloading the stack in stress conditions. |
1053 patcher.masm()->nop(Assembler::CODE_AGE_SEQUENCE_NOP); | 1053 SmartPointer<CodePatcher> |
1054 patcher.masm()->Addu(fp, sp, | 1054 patcher(new CodePatcher(byte_sequence, kNoCodeAgeSequenceLength)); |
1055 Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 1055 PredictableCodeSizeScope scope(patcher->masm(), *length); |
| 1056 patcher->masm()->Push(ra, fp, cp, a1); |
| 1057 patcher->masm()->nop(Assembler::CODE_AGE_SEQUENCE_NOP); |
| 1058 patcher->masm()->Addu( |
| 1059 fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
1056 initialized = true; | 1060 initialized = true; |
1057 } | 1061 } |
1058 return byte_sequence; | 1062 return byte_sequence; |
1059 } | 1063 } |
1060 | 1064 |
1061 | 1065 |
1062 bool Code::IsYoungSequence(byte* sequence) { | 1066 bool Code::IsYoungSequence(byte* sequence) { |
1063 uint32_t young_length; | 1067 uint32_t young_length; |
1064 byte* young_sequence = GetNoCodeAgeSequence(&young_length); | 1068 byte* young_sequence = GetNoCodeAgeSequence(&young_length); |
1065 bool result = !memcmp(sequence, young_sequence, young_length); | 1069 bool result = !memcmp(sequence, young_sequence, young_length); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 patcher.masm()->nop(); // Pad the empty space. | 1113 patcher.masm()->nop(); // Pad the empty space. |
1110 } | 1114 } |
1111 } | 1115 } |
1112 | 1116 |
1113 | 1117 |
1114 #undef __ | 1118 #undef __ |
1115 | 1119 |
1116 } } // namespace v8::internal | 1120 } } // namespace v8::internal |
1117 | 1121 |
1118 #endif // V8_TARGET_ARCH_MIPS | 1122 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |