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 3184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3195 // code. | 3195 // code. |
3196 RecordRelocInfo(RelocInfo::CONST_POOL, static_cast<intptr_t>(size)); | 3196 RecordRelocInfo(RelocInfo::CONST_POOL, static_cast<intptr_t>(size)); |
3197 } | 3197 } |
3198 | 3198 |
3199 | 3199 |
3200 void Assembler::GrowBuffer() { | 3200 void Assembler::GrowBuffer() { |
3201 if (!own_buffer_) FATAL("external code buffer is too small"); | 3201 if (!own_buffer_) FATAL("external code buffer is too small"); |
3202 | 3202 |
3203 // Compute new buffer size. | 3203 // Compute new buffer size. |
3204 CodeDesc desc; // the new buffer | 3204 CodeDesc desc; // the new buffer |
3205 if (buffer_size_ < 4*KB) { | 3205 if (buffer_size_ == 0) { |
3206 desc.buffer_size = 4*KB; | 3206 desc.buffer_size = kMinimalBufferSize; |
3207 } else if (buffer_size_ < 1*MB) { | 3207 } else if (buffer_size_ < 1*MB) { |
3208 desc.buffer_size = 2*buffer_size_; | 3208 desc.buffer_size = 2*buffer_size_; |
3209 } else { | 3209 } else { |
3210 desc.buffer_size = buffer_size_ + 1*MB; | 3210 desc.buffer_size = buffer_size_ + 1*MB; |
3211 } | 3211 } |
3212 CHECK_GT(desc.buffer_size, 0); // no overflow | 3212 CHECK_GT(desc.buffer_size, 0); // no overflow |
3213 | 3213 |
3214 // Set up new buffer. | 3214 // Set up new buffer. |
3215 desc.buffer = NewArray<byte>(desc.buffer_size); | 3215 desc.buffer = NewArray<byte>(desc.buffer_size); |
3216 | 3216 |
3217 desc.instr_size = pc_offset(); | 3217 desc.instr_size = pc_offset(); |
3218 desc.reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); | 3218 desc.reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); |
3219 | 3219 |
3220 // Copy the data. | 3220 // Copy the data. |
3221 int pc_delta = desc.buffer - buffer_; | 3221 int pc_delta = desc.buffer - buffer_; |
3222 int rc_delta = (desc.buffer + desc.buffer_size) - (buffer_ + buffer_size_); | 3222 int rc_delta = (desc.buffer + desc.buffer_size) - (buffer_ + buffer_size_); |
3223 MemMove(desc.buffer, buffer_, desc.instr_size); | 3223 MemMove(desc.buffer, buffer_, desc.instr_size); |
3224 MemMove(reloc_info_writer.pos() + rc_delta, reloc_info_writer.pos(), | 3224 MemMove(reloc_info_writer.pos() + rc_delta, reloc_info_writer.pos(), |
3225 desc.reloc_size); | 3225 desc.reloc_size); |
3226 | 3226 |
3227 // Switch buffers. | 3227 // Switch buffers. |
Igor Sheludko
2014/08/06 16:52:08
Obsolete comment.
| |
3228 DeleteArray(buffer_); | 3228 DeleteArray(buffer_); |
3229 buffer_ = desc.buffer; | 3229 buffer_ = desc.buffer; |
3230 buffer_size_ = desc.buffer_size; | 3230 buffer_size_ = desc.buffer_size; |
3231 pc_ += pc_delta; | 3231 pc_ += pc_delta; |
3232 reloc_info_writer.Reposition(reloc_info_writer.pos() + rc_delta, | 3232 reloc_info_writer.Reposition(reloc_info_writer.pos() + rc_delta, |
3233 reloc_info_writer.last_pc() + pc_delta); | 3233 reloc_info_writer.last_pc() + pc_delta); |
3234 | 3234 |
3235 // None of our relocation types are pc relative pointing outside the code | 3235 // None of our relocation types are pc relative pointing outside the code |
3236 // buffer nor pc absolute pointing inside the code buffer, so there is no need | 3236 // buffer nor pc absolute pointing inside the code buffer, so there is no need |
3237 // to relocate any emitted relocation entries. | 3237 // to relocate any emitted relocation entries. |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3763 assm->instr_at_put( | 3763 assm->instr_at_put( |
3764 rinfo.pc(), Assembler::SetLdrRegisterImmediateOffset(instr, offset)); | 3764 rinfo.pc(), Assembler::SetLdrRegisterImmediateOffset(instr, offset)); |
3765 } | 3765 } |
3766 } | 3766 } |
3767 } | 3767 } |
3768 | 3768 |
3769 | 3769 |
3770 } } // namespace v8::internal | 3770 } } // namespace v8::internal |
3771 | 3771 |
3772 #endif // V8_TARGET_ARCH_ARM | 3772 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |