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 4262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4273 if ((dist32 >= kMaxDistToIntPool - kCheckPoolInterval) || | 4273 if ((dist32 >= kMaxDistToIntPool - kCheckPoolInterval) || |
4274 (!require_jump && (dist32 >= kMaxDistToIntPool / 2))) { | 4274 (!require_jump && (dist32 >= kMaxDistToIntPool / 2))) { |
4275 need_emit = true; | 4275 need_emit = true; |
4276 } | 4276 } |
4277 } | 4277 } |
4278 if (!need_emit) return; | 4278 if (!need_emit) return; |
4279 } | 4279 } |
4280 | 4280 |
4281 // Deduplicate constants. | 4281 // Deduplicate constants. |
4282 int size_after_marker = estimated_size_after_marker; | 4282 int size_after_marker = estimated_size_after_marker; |
4283 for (int i = 0; i < pending_64_bit_constants_.size(); i++) { | 4283 for (size_t i = 0; i < pending_64_bit_constants_.size(); i++) { |
4284 ConstantPoolEntry& entry = pending_64_bit_constants_[i]; | 4284 ConstantPoolEntry& entry = pending_64_bit_constants_[i]; |
4285 DCHECK(!entry.is_merged()); | 4285 DCHECK(!entry.is_merged()); |
4286 for (int j = 0; j < i; j++) { | 4286 for (size_t j = 0; j < i; j++) { |
4287 if (entry.value64() == pending_64_bit_constants_[j].value64()) { | 4287 if (entry.value64() == pending_64_bit_constants_[j].value64()) { |
4288 DCHECK(!pending_64_bit_constants_[j].is_merged()); | 4288 DCHECK(!pending_64_bit_constants_[j].is_merged()); |
4289 entry.set_merged_index(j); | 4289 entry.set_merged_index(j); |
4290 size_after_marker -= kDoubleSize; | 4290 size_after_marker -= kDoubleSize; |
4291 break; | 4291 break; |
4292 } | 4292 } |
4293 } | 4293 } |
4294 } | 4294 } |
4295 | 4295 |
4296 for (int i = 0; i < pending_32_bit_constants_.size(); i++) { | 4296 for (size_t i = 0; i < pending_32_bit_constants_.size(); i++) { |
4297 ConstantPoolEntry& entry = pending_32_bit_constants_[i]; | 4297 ConstantPoolEntry& entry = pending_32_bit_constants_[i]; |
4298 DCHECK(!entry.is_merged()); | 4298 DCHECK(!entry.is_merged()); |
4299 if (!entry.sharing_ok()) continue; | 4299 if (!entry.sharing_ok()) continue; |
4300 for (int j = 0; j < i; j++) { | 4300 for (size_t j = 0; j < i; j++) { |
4301 if (entry.value() == pending_32_bit_constants_[j].value()) { | 4301 if (entry.value() == pending_32_bit_constants_[j].value()) { |
4302 DCHECK(!pending_32_bit_constants_[j].is_merged()); | 4302 DCHECK(!pending_32_bit_constants_[j].is_merged()); |
4303 entry.set_merged_index(j); | 4303 entry.set_merged_index(j); |
4304 size_after_marker -= kPointerSize; | 4304 size_after_marker -= kPointerSize; |
4305 break; | 4305 break; |
4306 } | 4306 } |
4307 } | 4307 } |
4308 } | 4308 } |
4309 | 4309 |
4310 int size = size_up_to_marker + size_after_marker; | 4310 int size = size_up_to_marker + size_after_marker; |
(...skipping 20 matching lines...) Expand all Loading... |
4331 // The data size helps disassembly know what to print. | 4331 // The data size helps disassembly know what to print. |
4332 emit(kConstantPoolMarker | | 4332 emit(kConstantPoolMarker | |
4333 EncodeConstantPoolLength(size_after_marker / kPointerSize)); | 4333 EncodeConstantPoolLength(size_after_marker / kPointerSize)); |
4334 | 4334 |
4335 if (require_64_bit_align) { | 4335 if (require_64_bit_align) { |
4336 emit(kConstantPoolMarker); | 4336 emit(kConstantPoolMarker); |
4337 } | 4337 } |
4338 | 4338 |
4339 // Emit 64-bit constant pool entries first: their range is smaller than | 4339 // Emit 64-bit constant pool entries first: their range is smaller than |
4340 // 32-bit entries. | 4340 // 32-bit entries. |
4341 for (int i = 0; i < pending_64_bit_constants_.size(); i++) { | 4341 for (size_t i = 0; i < pending_64_bit_constants_.size(); i++) { |
4342 ConstantPoolEntry& entry = pending_64_bit_constants_[i]; | 4342 ConstantPoolEntry& entry = pending_64_bit_constants_[i]; |
4343 | 4343 |
4344 Instr instr = instr_at(entry.position()); | 4344 Instr instr = instr_at(entry.position()); |
4345 // Instruction to patch must be 'vldr rd, [pc, #offset]' with offset == 0. | 4345 // Instruction to patch must be 'vldr rd, [pc, #offset]' with offset == 0. |
4346 DCHECK((IsVldrDPcImmediateOffset(instr) && | 4346 DCHECK((IsVldrDPcImmediateOffset(instr) && |
4347 GetVldrDRegisterImmediateOffset(instr) == 0)); | 4347 GetVldrDRegisterImmediateOffset(instr) == 0)); |
4348 | 4348 |
4349 int delta = pc_offset() - entry.position() - kPcLoadDelta; | 4349 int delta = pc_offset() - entry.position() - kPcLoadDelta; |
4350 DCHECK(is_uint10(delta)); | 4350 DCHECK(is_uint10(delta)); |
4351 | 4351 |
4352 if (entry.is_merged()) { | 4352 if (entry.is_merged()) { |
4353 ConstantPoolEntry& merged = | 4353 ConstantPoolEntry& merged = |
4354 pending_64_bit_constants_[entry.merged_index()]; | 4354 pending_64_bit_constants_[entry.merged_index()]; |
4355 DCHECK(entry.value64() == merged.value64()); | 4355 DCHECK(entry.value64() == merged.value64()); |
4356 Instr merged_instr = instr_at(merged.position()); | 4356 Instr merged_instr = instr_at(merged.position()); |
4357 DCHECK(IsVldrDPcImmediateOffset(merged_instr)); | 4357 DCHECK(IsVldrDPcImmediateOffset(merged_instr)); |
4358 delta = GetVldrDRegisterImmediateOffset(merged_instr); | 4358 delta = GetVldrDRegisterImmediateOffset(merged_instr); |
4359 delta += merged.position() - entry.position(); | 4359 delta += merged.position() - entry.position(); |
4360 } | 4360 } |
4361 instr_at_put(entry.position(), | 4361 instr_at_put(entry.position(), |
4362 SetVldrDRegisterImmediateOffset(instr, delta)); | 4362 SetVldrDRegisterImmediateOffset(instr, delta)); |
4363 if (!entry.is_merged()) { | 4363 if (!entry.is_merged()) { |
4364 DCHECK(IsAligned(reinterpret_cast<intptr_t>(pc_), kDoubleAlignment)); | 4364 DCHECK(IsAligned(reinterpret_cast<intptr_t>(pc_), kDoubleAlignment)); |
4365 dq(entry.value64()); | 4365 dq(entry.value64()); |
4366 } | 4366 } |
4367 } | 4367 } |
4368 | 4368 |
4369 // Emit 32-bit constant pool entries. | 4369 // Emit 32-bit constant pool entries. |
4370 for (int i = 0; i < pending_32_bit_constants_.size(); i++) { | 4370 for (size_t i = 0; i < pending_32_bit_constants_.size(); i++) { |
4371 ConstantPoolEntry& entry = pending_32_bit_constants_[i]; | 4371 ConstantPoolEntry& entry = pending_32_bit_constants_[i]; |
4372 Instr instr = instr_at(entry.position()); | 4372 Instr instr = instr_at(entry.position()); |
4373 | 4373 |
4374 // 64-bit loads shouldn't get here. | 4374 // 64-bit loads shouldn't get here. |
4375 DCHECK(!IsVldrDPcImmediateOffset(instr)); | 4375 DCHECK(!IsVldrDPcImmediateOffset(instr)); |
4376 DCHECK(!IsMovW(instr)); | 4376 DCHECK(!IsMovW(instr)); |
4377 DCHECK(IsLdrPcImmediateOffset(instr) && | 4377 DCHECK(IsLdrPcImmediateOffset(instr) && |
4378 GetLdrRegisterImmediateOffset(instr) == 0); | 4378 GetLdrRegisterImmediateOffset(instr) == 0); |
4379 | 4379 |
4380 int delta = pc_offset() - entry.position() - kPcLoadDelta; | 4380 int delta = pc_offset() - entry.position() - kPcLoadDelta; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4473 DCHECK(is_uint12(offset)); | 4473 DCHECK(is_uint12(offset)); |
4474 instr_at_put(pc, SetLdrRegisterImmediateOffset(instr, offset)); | 4474 instr_at_put(pc, SetLdrRegisterImmediateOffset(instr, offset)); |
4475 } | 4475 } |
4476 } | 4476 } |
4477 | 4477 |
4478 | 4478 |
4479 } // namespace internal | 4479 } // namespace internal |
4480 } // namespace v8 | 4480 } // namespace v8 |
4481 | 4481 |
4482 #endif // V8_TARGET_ARCH_ARM | 4482 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |