| 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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 positions_recorder_(this) { | 465 positions_recorder_(this) { |
| 466 reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_); | 466 reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_); |
| 467 num_pending_32_bit_reloc_info_ = 0; | 467 num_pending_32_bit_reloc_info_ = 0; |
| 468 num_pending_64_bit_reloc_info_ = 0; | 468 num_pending_64_bit_reloc_info_ = 0; |
| 469 next_buffer_check_ = 0; | 469 next_buffer_check_ = 0; |
| 470 const_pool_blocked_nesting_ = 0; | 470 const_pool_blocked_nesting_ = 0; |
| 471 no_const_pool_before_ = 0; | 471 no_const_pool_before_ = 0; |
| 472 first_const_pool_32_use_ = -1; | 472 first_const_pool_32_use_ = -1; |
| 473 first_const_pool_64_use_ = -1; | 473 first_const_pool_64_use_ = -1; |
| 474 last_bound_pos_ = 0; | 474 last_bound_pos_ = 0; |
| 475 constant_pool_available_ = !FLAG_enable_ool_constant_pool; | |
| 476 ClearRecordedAstId(); | 475 ClearRecordedAstId(); |
| 477 } | 476 } |
| 478 | 477 |
| 479 | 478 |
| 480 Assembler::~Assembler() { | 479 Assembler::~Assembler() { |
| 481 DCHECK(const_pool_blocked_nesting_ == 0); | 480 DCHECK(const_pool_blocked_nesting_ == 0); |
| 482 } | 481 } |
| 483 | 482 |
| 484 | 483 |
| 485 void Assembler::GetCode(CodeDesc* desc) { | 484 void Assembler::GetCode(CodeDesc* desc) { |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 return assembler->serializer_enabled(); | 1048 return assembler->serializer_enabled(); |
| 1050 } else if (RelocInfo::IsNone(rmode_)) { | 1049 } else if (RelocInfo::IsNone(rmode_)) { |
| 1051 return false; | 1050 return false; |
| 1052 } | 1051 } |
| 1053 return true; | 1052 return true; |
| 1054 } | 1053 } |
| 1055 | 1054 |
| 1056 | 1055 |
| 1057 static bool use_mov_immediate_load(const Operand& x, | 1056 static bool use_mov_immediate_load(const Operand& x, |
| 1058 const Assembler* assembler) { | 1057 const Assembler* assembler) { |
| 1059 if (assembler != NULL && !assembler->is_constant_pool_available()) { | 1058 if (assembler != NULL && !assembler->is_ool_constant_pool_available()) { |
| 1060 return true; | 1059 return true; |
| 1061 } else if (CpuFeatures::IsSupported(MOVW_MOVT_IMMEDIATE_LOADS) && | 1060 } else if (CpuFeatures::IsSupported(MOVW_MOVT_IMMEDIATE_LOADS) && |
| 1062 (assembler == NULL || !assembler->predictable_code_size())) { | 1061 (assembler == NULL || !assembler->predictable_code_size())) { |
| 1063 // Prefer movw / movt to constant pool if it is more efficient on the CPU. | 1062 // Prefer movw / movt to constant pool if it is more efficient on the CPU. |
| 1064 return true; | 1063 return true; |
| 1065 } else if (x.must_output_reloc_info(assembler)) { | 1064 } else if (x.must_output_reloc_info(assembler)) { |
| 1066 // Prefer constant pool if data is likely to be patched. | 1065 // Prefer constant pool if data is likely to be patched. |
| 1067 return false; | 1066 return false; |
| 1068 } else { | 1067 } else { |
| 1069 // Otherwise, use immediate load if movw / movt is available. | 1068 // Otherwise, use immediate load if movw / movt is available. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 DCHECK(FLAG_enable_ool_constant_pool); | 1129 DCHECK(FLAG_enable_ool_constant_pool); |
| 1131 mov(target, Operand(imm32 & kImm8Mask), LeaveCC, cond); | 1130 mov(target, Operand(imm32 & kImm8Mask), LeaveCC, cond); |
| 1132 orr(target, target, Operand(imm32 & (kImm8Mask << 8)), LeaveCC, cond); | 1131 orr(target, target, Operand(imm32 & (kImm8Mask << 8)), LeaveCC, cond); |
| 1133 orr(target, target, Operand(imm32 & (kImm8Mask << 16)), LeaveCC, cond); | 1132 orr(target, target, Operand(imm32 & (kImm8Mask << 16)), LeaveCC, cond); |
| 1134 orr(target, target, Operand(imm32 & (kImm8Mask << 24)), LeaveCC, cond); | 1133 orr(target, target, Operand(imm32 & (kImm8Mask << 24)), LeaveCC, cond); |
| 1135 } | 1134 } |
| 1136 if (target.code() != rd.code()) { | 1135 if (target.code() != rd.code()) { |
| 1137 mov(rd, target, LeaveCC, cond); | 1136 mov(rd, target, LeaveCC, cond); |
| 1138 } | 1137 } |
| 1139 } else { | 1138 } else { |
| 1140 DCHECK(is_constant_pool_available()); | 1139 DCHECK(is_ool_constant_pool_available()); |
| 1141 ConstantPoolArray::LayoutSection section = ConstantPoolAddEntry(rinfo); | 1140 ConstantPoolArray::LayoutSection section = ConstantPoolAddEntry(rinfo); |
| 1142 if (section == ConstantPoolArray::EXTENDED_SECTION) { | 1141 if (section == ConstantPoolArray::EXTENDED_SECTION) { |
| 1143 DCHECK(FLAG_enable_ool_constant_pool); | 1142 DCHECK(FLAG_enable_ool_constant_pool); |
| 1144 Register target = rd.code() == pc.code() ? ip : rd; | 1143 Register target = rd.code() == pc.code() ? ip : rd; |
| 1145 // Emit instructions to load constant pool offset. | 1144 // Emit instructions to load constant pool offset. |
| 1146 if (CpuFeatures::IsSupported(ARMv7)) { | 1145 if (CpuFeatures::IsSupported(ARMv7)) { |
| 1147 movw(target, 0, cond); | 1146 movw(target, 0, cond); |
| 1148 movt(target, 0, cond); | 1147 movt(target, 0, cond); |
| 1149 } else { | 1148 } else { |
| 1150 mov(target, Operand(0), LeaveCC, cond); | 1149 mov(target, Operand(0), LeaveCC, cond); |
| (...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2485 if (CpuFeatures::IsSupported(VFP3) && FitsVMOVDoubleImmediate(imm, &enc)) { | 2484 if (CpuFeatures::IsSupported(VFP3) && FitsVMOVDoubleImmediate(imm, &enc)) { |
| 2486 // The double can be encoded in the instruction. | 2485 // The double can be encoded in the instruction. |
| 2487 // | 2486 // |
| 2488 // Dd = immediate | 2487 // Dd = immediate |
| 2489 // Instruction details available in ARM DDI 0406C.b, A8-936. | 2488 // Instruction details available in ARM DDI 0406C.b, A8-936. |
| 2490 // cond(31-28) | 11101(27-23) | D(22) | 11(21-20) | imm4H(19-16) | | 2489 // cond(31-28) | 11101(27-23) | D(22) | 11(21-20) | imm4H(19-16) | |
| 2491 // Vd(15-12) | 101(11-9) | sz=1(8) | imm4L(3-0) | 2490 // Vd(15-12) | 101(11-9) | sz=1(8) | imm4L(3-0) |
| 2492 int vd, d; | 2491 int vd, d; |
| 2493 dst.split_code(&vd, &d); | 2492 dst.split_code(&vd, &d); |
| 2494 emit(al | 0x1D*B23 | d*B22 | 0x3*B20 | vd*B12 | 0x5*B9 | B8 | enc); | 2493 emit(al | 0x1D*B23 | d*B22 | 0x3*B20 | vd*B12 | 0x5*B9 | B8 | enc); |
| 2495 } else if (FLAG_enable_vldr_imm && is_constant_pool_available()) { | 2494 } else if (FLAG_enable_vldr_imm && is_ool_constant_pool_available()) { |
| 2496 // TODO(jfb) Temporarily turned off until we have constant blinding or | 2495 // TODO(jfb) Temporarily turned off until we have constant blinding or |
| 2497 // some equivalent mitigation: an attacker can otherwise control | 2496 // some equivalent mitigation: an attacker can otherwise control |
| 2498 // generated data which also happens to be executable, a Very Bad | 2497 // generated data which also happens to be executable, a Very Bad |
| 2499 // Thing indeed. | 2498 // Thing indeed. |
| 2500 // Blinding gets tricky because we don't have xor, we probably | 2499 // Blinding gets tricky because we don't have xor, we probably |
| 2501 // need to add/subtract without losing precision, which requires a | 2500 // need to add/subtract without losing precision, which requires a |
| 2502 // cookie value that Lithium is probably better positioned to | 2501 // cookie value that Lithium is probably better positioned to |
| 2503 // choose. | 2502 // choose. |
| 2504 // We could also add a few peepholes here like detecting 0.0 and | 2503 // We could also add a few peepholes here like detecting 0.0 and |
| 2505 // -0.0 and doing a vmov from the sequestered d14, forcing denorms | 2504 // -0.0 and doing a vmov from the sequestered d14, forcing denorms |
| (...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3835 assm->instr_at_put( | 3834 assm->instr_at_put( |
| 3836 rinfo.pc(), Assembler::SetLdrRegisterImmediateOffset(instr, offset)); | 3835 rinfo.pc(), Assembler::SetLdrRegisterImmediateOffset(instr, offset)); |
| 3837 } | 3836 } |
| 3838 } | 3837 } |
| 3839 } | 3838 } |
| 3840 | 3839 |
| 3841 | 3840 |
| 3842 } } // namespace v8::internal | 3841 } } // namespace v8::internal |
| 3843 | 3842 |
| 3844 #endif // V8_TARGET_ARCH_ARM | 3843 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |