OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // code object moves. | 172 // code object moves. |
173 return (1 << rmode_) & kApplyMask; | 173 return (1 << rmode_) & kApplyMask; |
174 } | 174 } |
175 | 175 |
176 | 176 |
177 bool RelocInfo::IsInConstantPool() { | 177 bool RelocInfo::IsInConstantPool() { |
178 return false; | 178 return false; |
179 } | 179 } |
180 | 180 |
181 | 181 |
182 void RelocInfo::PatchCode(byte* instructions, int instruction_count) { | |
183 // Patch the code at the current address with the supplied instructions. | |
184 for (int i = 0; i < instruction_count; i++) { | |
185 *(pc_ + i) = *(instructions + i); | |
186 } | |
187 | |
188 // Indicate that code has changed. | |
189 CpuFeatures::FlushICache(pc_, instruction_count); | |
190 } | |
191 | |
192 | |
193 // Patch the code at the current PC with a call to the target address. | 182 // Patch the code at the current PC with a call to the target address. |
194 // Additional guard int3 instructions can be added if required. | 183 // Additional guard int3 instructions can be added if required. |
195 void RelocInfo::PatchCodeWithCall(Address target, int guard_bytes) { | 184 void RelocInfo::PatchCodeWithCall(Address target, int guard_bytes) { |
196 // Call instruction takes up 5 bytes and int3 takes up one byte. | 185 // Call instruction takes up 5 bytes and int3 takes up one byte. |
197 static const int kCallCodeSize = 5; | 186 static const int kCallCodeSize = 5; |
198 int code_size = kCallCodeSize + guard_bytes; | 187 int code_size = kCallCodeSize + guard_bytes; |
199 | 188 |
200 // Create a code patcher. | 189 // Create a code patcher. |
201 CodePatcher patcher(pc_, code_size); | 190 CodePatcher patcher(pc_, code_size); |
202 | 191 |
(...skipping 2613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2816 fprintf(coverage_log, "%s\n", file_line); | 2805 fprintf(coverage_log, "%s\n", file_line); |
2817 fflush(coverage_log); | 2806 fflush(coverage_log); |
2818 } | 2807 } |
2819 } | 2808 } |
2820 | 2809 |
2821 #endif | 2810 #endif |
2822 | 2811 |
2823 } } // namespace v8::internal | 2812 } } // namespace v8::internal |
2824 | 2813 |
2825 #endif // V8_TARGET_ARCH_IA32 | 2814 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |