Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1153)

Side by Side Diff: src/arm/assembler-arm.cc

Issue 609843002: Refactor FrameAndConstantPoolScope and ConstantPoolUnavailableScope to be architecture independent (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Eliminate unreachable paths. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/assembler-arm.h ('k') | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 (FLAG_enable_ool_constant_pool && assembler != NULL &&
1059 !assembler->is_ool_constant_pool_available()) {
1060 return true; 1060 return true;
1061 } else if (CpuFeatures::IsSupported(MOVW_MOVT_IMMEDIATE_LOADS) && 1061 } else if (CpuFeatures::IsSupported(MOVW_MOVT_IMMEDIATE_LOADS) &&
1062 (assembler == NULL || !assembler->predictable_code_size())) { 1062 (assembler == NULL || !assembler->predictable_code_size())) {
1063 // Prefer movw / movt to constant pool if it is more efficient on the CPU. 1063 // Prefer movw / movt to constant pool if it is more efficient on the CPU.
1064 return true; 1064 return true;
1065 } else if (x.must_output_reloc_info(assembler)) { 1065 } else if (x.must_output_reloc_info(assembler)) {
1066 // Prefer constant pool if data is likely to be patched. 1066 // Prefer constant pool if data is likely to be patched.
1067 return false; 1067 return false;
1068 } else { 1068 } else {
1069 // Otherwise, use immediate load if movw / movt is available. 1069 // Otherwise, use immediate load if movw / movt is available.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 DCHECK(FLAG_enable_ool_constant_pool); 1130 DCHECK(FLAG_enable_ool_constant_pool);
1131 mov(target, Operand(imm32 & kImm8Mask), LeaveCC, cond); 1131 mov(target, Operand(imm32 & kImm8Mask), LeaveCC, cond);
1132 orr(target, target, Operand(imm32 & (kImm8Mask << 8)), LeaveCC, cond); 1132 orr(target, target, Operand(imm32 & (kImm8Mask << 8)), LeaveCC, cond);
1133 orr(target, target, Operand(imm32 & (kImm8Mask << 16)), LeaveCC, cond); 1133 orr(target, target, Operand(imm32 & (kImm8Mask << 16)), LeaveCC, cond);
1134 orr(target, target, Operand(imm32 & (kImm8Mask << 24)), LeaveCC, cond); 1134 orr(target, target, Operand(imm32 & (kImm8Mask << 24)), LeaveCC, cond);
1135 } 1135 }
1136 if (target.code() != rd.code()) { 1136 if (target.code() != rd.code()) {
1137 mov(rd, target, LeaveCC, cond); 1137 mov(rd, target, LeaveCC, cond);
1138 } 1138 }
1139 } else { 1139 } else {
1140 DCHECK(is_constant_pool_available()); 1140 DCHECK(!FLAG_enable_ool_constant_pool || is_ool_constant_pool_available());
1141 ConstantPoolArray::LayoutSection section = ConstantPoolAddEntry(rinfo); 1141 ConstantPoolArray::LayoutSection section = ConstantPoolAddEntry(rinfo);
1142 if (section == ConstantPoolArray::EXTENDED_SECTION) { 1142 if (section == ConstantPoolArray::EXTENDED_SECTION) {
1143 DCHECK(FLAG_enable_ool_constant_pool); 1143 DCHECK(FLAG_enable_ool_constant_pool);
1144 Register target = rd.code() == pc.code() ? ip : rd; 1144 Register target = rd.code() == pc.code() ? ip : rd;
1145 // Emit instructions to load constant pool offset. 1145 // Emit instructions to load constant pool offset.
1146 if (CpuFeatures::IsSupported(ARMv7)) { 1146 if (CpuFeatures::IsSupported(ARMv7)) {
1147 movw(target, 0, cond); 1147 movw(target, 0, cond);
1148 movt(target, 0, cond); 1148 movt(target, 0, cond);
1149 } else { 1149 } else {
1150 mov(target, Operand(0), LeaveCC, cond); 1150 mov(target, Operand(0), LeaveCC, cond);
(...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after
2485 if (CpuFeatures::IsSupported(VFP3) && FitsVMOVDoubleImmediate(imm, &enc)) { 2485 if (CpuFeatures::IsSupported(VFP3) && FitsVMOVDoubleImmediate(imm, &enc)) {
2486 // The double can be encoded in the instruction. 2486 // The double can be encoded in the instruction.
2487 // 2487 //
2488 // Dd = immediate 2488 // Dd = immediate
2489 // Instruction details available in ARM DDI 0406C.b, A8-936. 2489 // 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) | 2490 // 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) 2491 // Vd(15-12) | 101(11-9) | sz=1(8) | imm4L(3-0)
2492 int vd, d; 2492 int vd, d;
2493 dst.split_code(&vd, &d); 2493 dst.split_code(&vd, &d);
2494 emit(al | 0x1D*B23 | d*B22 | 0x3*B20 | vd*B12 | 0x5*B9 | B8 | enc); 2494 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()) { 2495 } else if (FLAG_enable_vldr_imm && is_ool_constant_pool_available()) {
2496 // TODO(jfb) Temporarily turned off until we have constant blinding or 2496 // TODO(jfb) Temporarily turned off until we have constant blinding or
2497 // some equivalent mitigation: an attacker can otherwise control 2497 // some equivalent mitigation: an attacker can otherwise control
2498 // generated data which also happens to be executable, a Very Bad 2498 // generated data which also happens to be executable, a Very Bad
2499 // Thing indeed. 2499 // Thing indeed.
2500 // Blinding gets tricky because we don't have xor, we probably 2500 // Blinding gets tricky because we don't have xor, we probably
2501 // need to add/subtract without losing precision, which requires a 2501 // need to add/subtract without losing precision, which requires a
2502 // cookie value that Lithium is probably better positioned to 2502 // cookie value that Lithium is probably better positioned to
2503 // choose. 2503 // choose.
2504 // We could also add a few peepholes here like detecting 0.0 and 2504 // 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 2505 // -0.0 and doing a vmov from the sequestered d14, forcing denorms
(...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after
3835 assm->instr_at_put( 3835 assm->instr_at_put(
3836 rinfo.pc(), Assembler::SetLdrRegisterImmediateOffset(instr, offset)); 3836 rinfo.pc(), Assembler::SetLdrRegisterImmediateOffset(instr, offset));
3837 } 3837 }
3838 } 3838 }
3839 } 3839 }
3840 3840
3841 3841
3842 } } // namespace v8::internal 3842 } } // namespace v8::internal
3843 3843
3844 #endif // V8_TARGET_ARCH_ARM 3844 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.h ('k') | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698