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

Side by Side Diff: src/DartARM32/assembler_arm.cc

Issue 1418313003: Handle branch relative to pc in ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 5 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // 4 //
5 // This is forked from Dart revision df52deea9f25690eb8b66c5995da92b70f7ac1fe 5 // This is forked from Dart revision df52deea9f25690eb8b66c5995da92b70f7ac1fe
6 // Please update the (git) revision if we merge changes from Dart. 6 // Please update the (git) revision if we merge changes from Dart.
7 // https://code.google.com/p/dart/wiki/GettingTheSource 7 // https://code.google.com/p/dart/wiki/GettingTheSource
8 8
9 #include "vm/globals.h" // NOLINT 9 #include "vm/globals.h" // NOLINT
10 #if defined(TARGET_ARCH_ARM) 10 #if defined(TARGET_ARCH_ARM)
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 type << kTypeShift | 86 type << kTypeShift |
87 static_cast<int32_t>(opcode) << kOpcodeShift | 87 static_cast<int32_t>(opcode) << kOpcodeShift |
88 set_cc << kSShift | 88 set_cc << kSShift |
89 static_cast<int32_t>(rn) << kRnShift | 89 static_cast<int32_t>(rn) << kRnShift |
90 static_cast<int32_t>(rd) << kRdShift | 90 static_cast<int32_t>(rd) << kRdShift |
91 o.encoding(); 91 o.encoding();
92 Emit(encoding); 92 Emit(encoding);
93 } 93 }
94 #endif 94 #endif
95 95
96 #if 0
97 // Moved to ARM32::AssemblerARM32::emitType05.
96 void Assembler::EmitType5(Condition cond, int32_t offset, bool link) { 98 void Assembler::EmitType5(Condition cond, int32_t offset, bool link) {
97 ASSERT(cond != kNoCondition); 99 ASSERT(cond != kNoCondition);
98 int32_t encoding = static_cast<int32_t>(cond) << kConditionShift | 100 int32_t encoding = static_cast<int32_t>(cond) << kConditionShift |
99 5 << kTypeShift | 101 5 << kTypeShift |
100 (link ? 1 : 0) << kLinkShift; 102 (link ? 1 : 0) << kLinkShift;
101 Emit(Assembler::EncodeBranchOffset(offset, encoding)); 103 Emit(Assembler::EncodeBranchOffset(offset, encoding));
102 } 104 }
103 105 #endif
104 106
105 #if 0 107 #if 0
106 // Moved to ARM32::AssemblerARM32::emitMemOp() 108 // Moved to ARM32::AssemblerARM32::emitMemOp()
107 void Assembler::EmitMemOp(Condition cond, 109 void Assembler::EmitMemOp(Condition cond,
108 bool load, 110 bool load,
109 bool byte, 111 bool byte,
110 Register rd, 112 Register rd,
111 Address ad) { 113 Address ad) {
112 ASSERT(rd != kNoRegister); 114 ASSERT(rd != kNoRegister);
113 ASSERT(cond != kNoCondition); 115 ASSERT(cond != kNoCondition);
(...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after
2082 Operand(scratch1, LSL, ICData::RangeFeedbackShift(index))); 2084 Operand(scratch1, LSL, ICData::RangeFeedbackShift(index)));
2083 str(scratch2, FieldAddress(ic_data, ICData::state_bits_offset())); 2085 str(scratch2, FieldAddress(ic_data, ICData::state_bits_offset()));
2084 } 2086 }
2085 2087
2086 2088
2087 static bool CanEncodeBranchOffset(int32_t offset) { 2089 static bool CanEncodeBranchOffset(int32_t offset) {
2088 ASSERT(Utils::IsAligned(offset, 4)); 2090 ASSERT(Utils::IsAligned(offset, 4));
2089 return Utils::IsInt(Utils::CountOneBits(kBranchOffsetMask), offset); 2091 return Utils::IsInt(Utils::CountOneBits(kBranchOffsetMask), offset);
2090 } 2092 }
2091 2093
2092 2094 #if 0
2095 // Moved to AssemblerARM32::encodeBranchOffset.
2093 int32_t Assembler::EncodeBranchOffset(int32_t offset, int32_t inst) { 2096 int32_t Assembler::EncodeBranchOffset(int32_t offset, int32_t inst) {
2094 // The offset is off by 8 due to the way the ARM CPUs read PC. 2097 // The offset is off by 8 due to the way the ARM CPUs read PC.
2095 offset -= Instr::kPCReadOffset; 2098 offset -= Instr::kPCReadOffset;
2096 2099
2097 if (!CanEncodeBranchOffset(offset)) { 2100 if (!CanEncodeBranchOffset(offset)) {
2098 ASSERT(!use_far_branches()); 2101 ASSERT(!use_far_branches());
2099 Thread::Current()->long_jump_base()->Jump( 2102 Thread::Current()->long_jump_base()->Jump(
2100 1, Object::branch_offset_error()); 2103 1, Object::branch_offset_error());
2101 } 2104 }
2102 2105
2103 // Properly preserve only the bits supported in the instruction. 2106 // Properly preserve only the bits supported in the instruction.
2104 offset >>= 2; 2107 offset >>= 2;
2105 offset &= kBranchOffsetMask; 2108 offset &= kBranchOffsetMask;
2106 return (inst & ~kBranchOffsetMask) | offset; 2109 return (inst & ~kBranchOffsetMask) | offset;
2107 } 2110 }
2111 #endif
2108 2112
2109 2113 #if 0
2114 // Moved to AssemberARM32::decodeBranchOffset.
2110 int Assembler::DecodeBranchOffset(int32_t inst) { 2115 int Assembler::DecodeBranchOffset(int32_t inst) {
2111 // Sign-extend, left-shift by 2, then add 8. 2116 // Sign-extend, left-shift by 2, then add 8.
2112 return ((((inst & kBranchOffsetMask) << 8) >> 6) + Instr::kPCReadOffset); 2117 return ((((inst & kBranchOffsetMask) << 8) >> 6) + Instr::kPCReadOffset);
2113 } 2118 }
2114 2119 #endif
2115 2120
2116 static int32_t DecodeARMv7LoadImmediate(int32_t movt, int32_t movw) { 2121 static int32_t DecodeARMv7LoadImmediate(int32_t movt, int32_t movw) {
2117 int32_t offset = 0; 2122 int32_t offset = 0;
2118 offset |= (movt & 0xf0000) << 12; 2123 offset |= (movt & 0xf0000) << 12;
2119 offset |= (movt & 0xfff) << 16; 2124 offset |= (movt & 0xfff) << 16;
2120 offset |= (movw & 0xf0000) >> 4; 2125 offset |= (movw & 0xf0000) >> 4;
2121 offset |= movw & 0xfff; 2126 offset |= movw & 0xfff;
2122 return offset; 2127 return offset;
2123 } 2128 }
2124 2129
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after
3667 3672
3668 3673
3669 const char* Assembler::FpuRegisterName(FpuRegister reg) { 3674 const char* Assembler::FpuRegisterName(FpuRegister reg) {
3670 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); 3675 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters));
3671 return fpu_reg_names[reg]; 3676 return fpu_reg_names[reg];
3672 } 3677 }
3673 3678
3674 } // namespace dart 3679 } // namespace dart
3675 3680
3676 #endif // defined TARGET_ARCH_ARM 3681 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698