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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 DCHECK(IsWasmMemorySizeReference(rmode_)); | 200 DCHECK(IsWasmMemorySizeReference(rmode_)); |
201 return Memory::uint32_at(pc_); | 201 return Memory::uint32_at(pc_); |
202 } | 202 } |
203 | 203 |
204 uint32_t RelocInfo::wasm_function_table_size_reference() { | 204 uint32_t RelocInfo::wasm_function_table_size_reference() { |
205 DCHECK(IsWasmFunctionTableSizeReference(rmode_)); | 205 DCHECK(IsWasmFunctionTableSizeReference(rmode_)); |
206 return Memory::uint32_at(pc_); | 206 return Memory::uint32_at(pc_); |
207 } | 207 } |
208 | 208 |
209 void RelocInfo::unchecked_update_wasm_memory_reference( | 209 void RelocInfo::unchecked_update_wasm_memory_reference( |
210 Address address, ICacheFlushMode icache_flush_mode) { | 210 Isolate* isolate, Address address, ICacheFlushMode icache_flush_mode) { |
211 Memory::Address_at(pc_) = address; | 211 Memory::Address_at(pc_) = address; |
212 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 212 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
213 Assembler::FlushICache(isolate_, pc_, sizeof(Address)); | 213 Assembler::FlushICache(isolate, pc_, sizeof(Address)); |
214 } | 214 } |
215 } | 215 } |
216 | 216 |
217 void RelocInfo::unchecked_update_wasm_size(uint32_t size, | 217 void RelocInfo::unchecked_update_wasm_size(Isolate* isolate, uint32_t size, |
218 ICacheFlushMode icache_flush_mode) { | 218 ICacheFlushMode icache_flush_mode) { |
219 Memory::uint32_at(pc_) = size; | 219 Memory::uint32_at(pc_) = size; |
220 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 220 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
221 Assembler::FlushICache(isolate_, pc_, sizeof(uint32_t)); | 221 Assembler::FlushICache(isolate, pc_, sizeof(uint32_t)); |
222 } | 222 } |
223 } | 223 } |
224 | 224 |
225 // ----------------------------------------------------------------------------- | 225 // ----------------------------------------------------------------------------- |
226 // Implementation of Operand | 226 // Implementation of Operand |
227 | 227 |
228 Operand::Operand(Register base, int32_t disp, RelocInfo::Mode rmode) { | 228 Operand::Operand(Register base, int32_t disp, RelocInfo::Mode rmode) { |
229 // [base + disp/r] | 229 // [base + disp/r] |
230 if (disp == 0 && RelocInfo::IsNone(rmode) && !base.is(ebp)) { | 230 if (disp == 0 && RelocInfo::IsNone(rmode) && !base.is(ebp)) { |
231 // [base] | 231 // [base] |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 } | 299 } |
300 | 300 |
301 | 301 |
302 // ----------------------------------------------------------------------------- | 302 // ----------------------------------------------------------------------------- |
303 // Implementation of Assembler. | 303 // Implementation of Assembler. |
304 | 304 |
305 // Emit a single byte. Must always be inlined. | 305 // Emit a single byte. Must always be inlined. |
306 #define EMIT(x) \ | 306 #define EMIT(x) \ |
307 *pc_++ = (x) | 307 *pc_++ = (x) |
308 | 308 |
309 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) | 309 Assembler::Assembler(IsolateData isolate_data, void* buffer, int buffer_size) |
310 : AssemblerBase(isolate, buffer, buffer_size) { | 310 : AssemblerBase(isolate_data, buffer, buffer_size) { |
311 // Clear the buffer in debug mode unless it was provided by the | 311 // Clear the buffer in debug mode unless it was provided by the |
312 // caller in which case we can't be sure it's okay to overwrite | 312 // caller in which case we can't be sure it's okay to overwrite |
313 // existing code in it; see CodePatcher::CodePatcher(...). | 313 // existing code in it; see CodePatcher::CodePatcher(...). |
314 #ifdef DEBUG | 314 #ifdef DEBUG |
315 if (own_buffer_) { | 315 if (own_buffer_) { |
316 memset(buffer_, 0xCC, buffer_size_); // int3 | 316 memset(buffer_, 0xCC, buffer_size_); // int3 |
317 } | 317 } |
318 #endif | 318 #endif |
319 | 319 |
320 reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_); | 320 reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_); |
(...skipping 2645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2966 if (!own_buffer_) FATAL("external code buffer is too small"); | 2966 if (!own_buffer_) FATAL("external code buffer is too small"); |
2967 | 2967 |
2968 // Compute new buffer size. | 2968 // Compute new buffer size. |
2969 CodeDesc desc; // the new buffer | 2969 CodeDesc desc; // the new buffer |
2970 desc.buffer_size = 2 * buffer_size_; | 2970 desc.buffer_size = 2 * buffer_size_; |
2971 | 2971 |
2972 // Some internal data structures overflow for very large buffers, | 2972 // Some internal data structures overflow for very large buffers, |
2973 // they must ensure that kMaximalBufferSize is not too large. | 2973 // they must ensure that kMaximalBufferSize is not too large. |
2974 if (desc.buffer_size > kMaximalBufferSize || | 2974 if (desc.buffer_size > kMaximalBufferSize || |
2975 static_cast<size_t>(desc.buffer_size) > | 2975 static_cast<size_t>(desc.buffer_size) > |
2976 isolate()->heap()->MaxOldGenerationSize()) { | 2976 isolate_data().max_old_generation_size_) { |
2977 V8::FatalProcessOutOfMemory("Assembler::GrowBuffer"); | 2977 V8::FatalProcessOutOfMemory("Assembler::GrowBuffer"); |
2978 } | 2978 } |
2979 | 2979 |
2980 // Set up new buffer. | 2980 // Set up new buffer. |
2981 desc.buffer = NewArray<byte>(desc.buffer_size); | 2981 desc.buffer = NewArray<byte>(desc.buffer_size); |
2982 desc.origin = this; | 2982 desc.origin = this; |
2983 desc.instr_size = pc_offset(); | 2983 desc.instr_size = pc_offset(); |
2984 desc.reloc_size = (buffer_ + buffer_size_) - (reloc_info_writer.pos()); | 2984 desc.reloc_size = (buffer_ + buffer_size_) - (reloc_info_writer.pos()); |
2985 | 2985 |
2986 // Clear the buffer in debug mode. Use 'int3' instructions to make | 2986 // Clear the buffer in debug mode. Use 'int3' instructions to make |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3109 } | 3109 } |
3110 | 3110 |
3111 | 3111 |
3112 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { | 3112 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { |
3113 DCHECK(!RelocInfo::IsNone(rmode)); | 3113 DCHECK(!RelocInfo::IsNone(rmode)); |
3114 // Don't record external references unless the heap will be serialized. | 3114 // Don't record external references unless the heap will be serialized. |
3115 if (rmode == RelocInfo::EXTERNAL_REFERENCE && | 3115 if (rmode == RelocInfo::EXTERNAL_REFERENCE && |
3116 !serializer_enabled() && !emit_debug_code()) { | 3116 !serializer_enabled() && !emit_debug_code()) { |
3117 return; | 3117 return; |
3118 } | 3118 } |
3119 RelocInfo rinfo(isolate(), pc_, rmode, data, NULL); | 3119 RelocInfo rinfo(pc_, rmode, data, NULL); |
3120 reloc_info_writer.Write(&rinfo); | 3120 reloc_info_writer.Write(&rinfo); |
3121 } | 3121 } |
3122 | 3122 |
3123 | 3123 |
3124 } // namespace internal | 3124 } // namespace internal |
3125 } // namespace v8 | 3125 } // namespace v8 |
3126 | 3126 |
3127 #endif // V8_TARGET_ARCH_IA32 | 3127 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |