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 are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 own_buffer_ = true; | 294 own_buffer_ = true; |
295 | 295 |
296 } else { | 296 } else { |
297 // Use externally provided buffer instead. | 297 // Use externally provided buffer instead. |
298 ASSERT(buffer_size > 0); | 298 ASSERT(buffer_size > 0); |
299 buffer_ = static_cast<byte*>(buffer); | 299 buffer_ = static_cast<byte*>(buffer); |
300 buffer_size_ = buffer_size; | 300 buffer_size_ = buffer_size; |
301 own_buffer_ = false; | 301 own_buffer_ = false; |
302 } | 302 } |
303 | 303 |
304 // Setup buffer pointers. | 304 // Set up buffer pointers. |
305 ASSERT(buffer_ != NULL); | 305 ASSERT(buffer_ != NULL); |
306 pc_ = buffer_; | 306 pc_ = buffer_; |
307 reloc_info_writer.Reposition(buffer_ + buffer_size, pc_); | 307 reloc_info_writer.Reposition(buffer_ + buffer_size, pc_); |
308 | 308 |
309 last_trampoline_pool_end_ = 0; | 309 last_trampoline_pool_end_ = 0; |
310 no_trampoline_pool_before_ = 0; | 310 no_trampoline_pool_before_ = 0; |
311 trampoline_pool_blocked_nesting_ = 0; | 311 trampoline_pool_blocked_nesting_ = 0; |
312 // We leave space (16 * kTrampolineSlotsSize) | 312 // We leave space (16 * kTrampolineSlotsSize) |
313 // for BlockTrampolinePoolScope buffer. | 313 // for BlockTrampolinePoolScope buffer. |
314 next_buffer_check_ = kMaxBranchOffset - kTrampolineSlotsSize * 16; | 314 next_buffer_check_ = kMaxBranchOffset - kTrampolineSlotsSize * 16; |
(...skipping 15 matching lines...) Expand all Loading... |
330 isolate()->set_assembler_spare_buffer(buffer_); | 330 isolate()->set_assembler_spare_buffer(buffer_); |
331 } else { | 331 } else { |
332 DeleteArray(buffer_); | 332 DeleteArray(buffer_); |
333 } | 333 } |
334 } | 334 } |
335 } | 335 } |
336 | 336 |
337 | 337 |
338 void Assembler::GetCode(CodeDesc* desc) { | 338 void Assembler::GetCode(CodeDesc* desc) { |
339 ASSERT(pc_ <= reloc_info_writer.pos()); // No overlap. | 339 ASSERT(pc_ <= reloc_info_writer.pos()); // No overlap. |
340 // Setup code descriptor. | 340 // Set up code descriptor. |
341 desc->buffer = buffer_; | 341 desc->buffer = buffer_; |
342 desc->buffer_size = buffer_size_; | 342 desc->buffer_size = buffer_size_; |
343 desc->instr_size = pc_offset(); | 343 desc->instr_size = pc_offset(); |
344 desc->reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); | 344 desc->reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); |
345 } | 345 } |
346 | 346 |
347 | 347 |
348 void Assembler::Align(int m) { | 348 void Assembler::Align(int m) { |
349 ASSERT(m >= 4 && IsPowerOf2(m)); | 349 ASSERT(m >= 4 && IsPowerOf2(m)); |
350 while ((pc_offset() & (m - 1)) != 0) { | 350 while ((pc_offset() & (m - 1)) != 0) { |
(...skipping 1612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1963 CodeDesc desc; // The new buffer. | 1963 CodeDesc desc; // The new buffer. |
1964 if (buffer_size_ < 4*KB) { | 1964 if (buffer_size_ < 4*KB) { |
1965 desc.buffer_size = 4*KB; | 1965 desc.buffer_size = 4*KB; |
1966 } else if (buffer_size_ < 1*MB) { | 1966 } else if (buffer_size_ < 1*MB) { |
1967 desc.buffer_size = 2*buffer_size_; | 1967 desc.buffer_size = 2*buffer_size_; |
1968 } else { | 1968 } else { |
1969 desc.buffer_size = buffer_size_ + 1*MB; | 1969 desc.buffer_size = buffer_size_ + 1*MB; |
1970 } | 1970 } |
1971 CHECK_GT(desc.buffer_size, 0); // No overflow. | 1971 CHECK_GT(desc.buffer_size, 0); // No overflow. |
1972 | 1972 |
1973 // Setup new buffer. | 1973 // Set up new buffer. |
1974 desc.buffer = NewArray<byte>(desc.buffer_size); | 1974 desc.buffer = NewArray<byte>(desc.buffer_size); |
1975 | 1975 |
1976 desc.instr_size = pc_offset(); | 1976 desc.instr_size = pc_offset(); |
1977 desc.reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); | 1977 desc.reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); |
1978 | 1978 |
1979 // Copy the data. | 1979 // Copy the data. |
1980 int pc_delta = desc.buffer - buffer_; | 1980 int pc_delta = desc.buffer - buffer_; |
1981 int rc_delta = (desc.buffer + desc.buffer_size) - (buffer_ + buffer_size_); | 1981 int rc_delta = (desc.buffer + desc.buffer_size) - (buffer_ + buffer_size_); |
1982 memmove(desc.buffer, buffer_, desc.instr_size); | 1982 memmove(desc.buffer, buffer_, desc.instr_size); |
1983 memmove(reloc_info_writer.pos() + rc_delta, | 1983 memmove(reloc_info_writer.pos() + rc_delta, |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2267 } | 2267 } |
2268 | 2268 |
2269 if (patched) { | 2269 if (patched) { |
2270 CPU::FlushICache(pc+2, sizeof(Address)); | 2270 CPU::FlushICache(pc+2, sizeof(Address)); |
2271 } | 2271 } |
2272 } | 2272 } |
2273 | 2273 |
2274 } } // namespace v8::internal | 2274 } } // namespace v8::internal |
2275 | 2275 |
2276 #endif // V8_TARGET_ARCH_MIPS | 2276 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |