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 2305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2316 desc.buffer_size = buffer_size_ + 1 * MB; | 2316 desc.buffer_size = buffer_size_ + 1 * MB; |
2317 } | 2317 } |
2318 int space = buffer_space() + (desc.buffer_size - buffer_size_); | 2318 int space = buffer_space() + (desc.buffer_size - buffer_size_); |
2319 if (space < needed) { | 2319 if (space < needed) { |
2320 desc.buffer_size += needed - space; | 2320 desc.buffer_size += needed - space; |
2321 } | 2321 } |
2322 CHECK_GT(desc.buffer_size, 0); // no overflow | 2322 CHECK_GT(desc.buffer_size, 0); // no overflow |
2323 | 2323 |
2324 // Set up new buffer. | 2324 // Set up new buffer. |
2325 desc.buffer = NewArray<byte>(desc.buffer_size); | 2325 desc.buffer = NewArray<byte>(desc.buffer_size); |
| 2326 desc.origin = this; |
2326 | 2327 |
2327 desc.instr_size = pc_offset(); | 2328 desc.instr_size = pc_offset(); |
2328 desc.reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); | 2329 desc.reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); |
2329 | 2330 |
2330 // Copy the data. | 2331 // Copy the data. |
2331 intptr_t pc_delta = desc.buffer - buffer_; | 2332 intptr_t pc_delta = desc.buffer - buffer_; |
2332 intptr_t rc_delta = | 2333 intptr_t rc_delta = |
2333 (desc.buffer + desc.buffer_size) - (buffer_ + buffer_size_); | 2334 (desc.buffer + desc.buffer_size) - (buffer_ + buffer_size_); |
2334 memmove(desc.buffer, buffer_, desc.instr_size); | 2335 memmove(desc.buffer, buffer_, desc.instr_size); |
2335 memmove(reloc_info_writer.pos() + rc_delta, reloc_info_writer.pos(), | 2336 memmove(reloc_info_writer.pos() + rc_delta, reloc_info_writer.pos(), |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2394 | 2395 |
2395 | 2396 |
2396 void Assembler::EmitRelocations() { | 2397 void Assembler::EmitRelocations() { |
2397 EnsureSpaceFor(relocations_.size() * kMaxRelocSize); | 2398 EnsureSpaceFor(relocations_.size() * kMaxRelocSize); |
2398 | 2399 |
2399 for (std::vector<DeferredRelocInfo>::iterator it = relocations_.begin(); | 2400 for (std::vector<DeferredRelocInfo>::iterator it = relocations_.begin(); |
2400 it != relocations_.end(); it++) { | 2401 it != relocations_.end(); it++) { |
2401 RelocInfo::Mode rmode = it->rmode(); | 2402 RelocInfo::Mode rmode = it->rmode(); |
2402 Address pc = buffer_ + it->position(); | 2403 Address pc = buffer_ + it->position(); |
2403 Code* code = NULL; | 2404 Code* code = NULL; |
2404 RelocInfo rinfo(pc, rmode, it->data(), code); | 2405 RelocInfo rinfo(isolate(), pc, rmode, it->data(), code); |
2405 | 2406 |
2406 // Fix up internal references now that they are guaranteed to be bound. | 2407 // Fix up internal references now that they are guaranteed to be bound. |
2407 if (RelocInfo::IsInternalReference(rmode)) { | 2408 if (RelocInfo::IsInternalReference(rmode)) { |
2408 // Jump table entry | 2409 // Jump table entry |
2409 intptr_t pos = reinterpret_cast<intptr_t>(Memory::Address_at(pc)); | 2410 intptr_t pos = reinterpret_cast<intptr_t>(Memory::Address_at(pc)); |
2410 Memory::Address_at(pc) = buffer_ + pos; | 2411 Memory::Address_at(pc) = buffer_ + pos; |
2411 } else if (RelocInfo::IsInternalReferenceEncoded(rmode)) { | 2412 } else if (RelocInfo::IsInternalReferenceEncoded(rmode)) { |
2412 // mov sequence | 2413 // mov sequence |
2413 intptr_t pos = reinterpret_cast<intptr_t>(target_address_at(pc, code)); | 2414 intptr_t pos = reinterpret_cast<intptr_t>(target_address_at(pc, code)); |
2414 set_target_address_at(pc, code, buffer_ + pos, SKIP_ICACHE_FLUSH); | 2415 set_target_address_at(pc, code, buffer_ + pos, SKIP_ICACHE_FLUSH); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2455 | 2456 |
2456 trampoline_ = Trampoline(pc_offset() - size, tracked_branch_count_); | 2457 trampoline_ = Trampoline(pc_offset() - size, tracked_branch_count_); |
2457 } | 2458 } |
2458 } | 2459 } |
2459 | 2460 |
2460 | 2461 |
2461 } // namespace internal | 2462 } // namespace internal |
2462 } // namespace v8 | 2463 } // namespace v8 |
2463 | 2464 |
2464 #endif // V8_TARGET_ARCH_PPC | 2465 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |