| OLD | NEW |
| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 ASSERT(cond != kNoCondition); | 84 ASSERT(cond != kNoCondition); |
| 85 int32_t encoding = static_cast<int32_t>(cond) << kConditionShift | | 85 int32_t encoding = static_cast<int32_t>(cond) << kConditionShift | |
| 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 | |
| 95 | 94 |
| 95 // Moved to ARM32::AssemblerARM32::emitType05. |
| 96 void Assembler::EmitType5(Condition cond, int32_t offset, bool link) { | 96 void Assembler::EmitType5(Condition cond, int32_t offset, bool link) { |
| 97 ASSERT(cond != kNoCondition); | 97 ASSERT(cond != kNoCondition); |
| 98 int32_t encoding = static_cast<int32_t>(cond) << kConditionShift | | 98 int32_t encoding = static_cast<int32_t>(cond) << kConditionShift | |
| 99 5 << kTypeShift | | 99 5 << kTypeShift | |
| 100 (link ? 1 : 0) << kLinkShift; | 100 (link ? 1 : 0) << kLinkShift; |
| 101 Emit(Assembler::EncodeBranchOffset(offset, encoding)); | 101 Emit(Assembler::EncodeBranchOffset(offset, encoding)); |
| 102 } | 102 } |
| 103 | 103 |
| 104 | |
| 105 #if 0 | |
| 106 // Moved to ARM32::AssemblerARM32::emitMemOp() | 104 // Moved to ARM32::AssemblerARM32::emitMemOp() |
| 107 void Assembler::EmitMemOp(Condition cond, | 105 void Assembler::EmitMemOp(Condition cond, |
| 108 bool load, | 106 bool load, |
| 109 bool byte, | 107 bool byte, |
| 110 Register rd, | 108 Register rd, |
| 111 Address ad) { | 109 Address ad) { |
| 112 ASSERT(rd != kNoRegister); | 110 ASSERT(rd != kNoRegister); |
| 113 ASSERT(cond != kNoCondition); | 111 ASSERT(cond != kNoCondition); |
| 114 int32_t encoding = (static_cast<int32_t>(cond) << kConditionShift) | | 112 int32_t encoding = (static_cast<int32_t>(cond) << kConditionShift) | |
| 115 B26 | (ad.kind() == Address::Immediate ? 0 : B25) | | 113 B26 | (ad.kind() == Address::Immediate ? 0 : B25) | |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 #if 0 | 213 #if 0 |
| 216 // Moved to ARM32::AssemberARM32::add() | 214 // Moved to ARM32::AssemberARM32::add() |
| 217 void Assembler::add(Register rd, Register rn, Operand o, Condition cond) { | 215 void Assembler::add(Register rd, Register rn, Operand o, Condition cond) { |
| 218 EmitType01(cond, o.type(), ADD, 0, rn, rd, o); | 216 EmitType01(cond, o.type(), ADD, 0, rn, rd, o); |
| 219 } | 217 } |
| 220 | 218 |
| 221 // Moved to ARM32::AssemberARM32::add() | 219 // Moved to ARM32::AssemberARM32::add() |
| 222 void Assembler::adds(Register rd, Register rn, Operand o, Condition cond) { | 220 void Assembler::adds(Register rd, Register rn, Operand o, Condition cond) { |
| 223 EmitType01(cond, o.type(), ADD, 1, rn, rd, o); | 221 EmitType01(cond, o.type(), ADD, 1, rn, rd, o); |
| 224 } | 222 } |
| 225 #endif | |
| 226 | 223 |
| 227 #if 0 | |
| 228 // Moved to ARM32::AssemberARM32::sub() | 224 // Moved to ARM32::AssemberARM32::sub() |
| 229 void Assembler::subs(Register rd, Register rn, Operand o, Condition cond) { | 225 void Assembler::subs(Register rd, Register rn, Operand o, Condition cond) { |
| 230 EmitType01(cond, o.type(), SUB, 1, rn, rd, o); | 226 EmitType01(cond, o.type(), SUB, 1, rn, rd, o); |
| 231 } | 227 } |
| 232 #endif | 228 #endif |
| 233 | 229 |
| 234 void Assembler::adc(Register rd, Register rn, Operand o, Condition cond) { | 230 void Assembler::adc(Register rd, Register rn, Operand o, Condition cond) { |
| 235 EmitType01(cond, o.type(), ADC, 0, rn, rd, o); | 231 EmitType01(cond, o.type(), ADC, 0, rn, rd, o); |
| 236 } | 232 } |
| 237 | 233 |
| (...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2076 Label* miss) { | 2072 Label* miss) { |
| 2077 ASSERT(ICData::IsValidRangeFeedbackIndex(index)); | 2073 ASSERT(ICData::IsValidRangeFeedbackIndex(index)); |
| 2078 ComputeRange(scratch1, value, scratch2, miss); | 2074 ComputeRange(scratch1, value, scratch2, miss); |
| 2079 ldr(scratch2, FieldAddress(ic_data, ICData::state_bits_offset())); | 2075 ldr(scratch2, FieldAddress(ic_data, ICData::state_bits_offset())); |
| 2080 orr(scratch2, | 2076 orr(scratch2, |
| 2081 scratch2, | 2077 scratch2, |
| 2082 Operand(scratch1, LSL, ICData::RangeFeedbackShift(index))); | 2078 Operand(scratch1, LSL, ICData::RangeFeedbackShift(index))); |
| 2083 str(scratch2, FieldAddress(ic_data, ICData::state_bits_offset())); | 2079 str(scratch2, FieldAddress(ic_data, ICData::state_bits_offset())); |
| 2084 } | 2080 } |
| 2085 | 2081 |
| 2086 | 2082 #if 0 |
| 2083 // Moved to ::canEncodeBranchoffset in IceAssemblerARM32.cpp. |
| 2087 static bool CanEncodeBranchOffset(int32_t offset) { | 2084 static bool CanEncodeBranchOffset(int32_t offset) { |
| 2088 ASSERT(Utils::IsAligned(offset, 4)); | 2085 ASSERT(Utils::IsAligned(offset, 4)); |
| 2086 // Note: This check doesn't take advantage of the fact that offset>>2 |
| 2087 // is stored (allowing two more bits in address space). |
| 2089 return Utils::IsInt(Utils::CountOneBits(kBranchOffsetMask), offset); | 2088 return Utils::IsInt(Utils::CountOneBits(kBranchOffsetMask), offset); |
| 2090 } | 2089 } |
| 2091 | 2090 |
| 2092 | 2091 // Moved to AssemblerARM32::encodeBranchOffset. |
| 2093 int32_t Assembler::EncodeBranchOffset(int32_t offset, int32_t inst) { | 2092 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. | 2093 // The offset is off by 8 due to the way the ARM CPUs read PC. |
| 2095 offset -= Instr::kPCReadOffset; | 2094 offset -= Instr::kPCReadOffset; |
| 2096 | 2095 |
| 2097 if (!CanEncodeBranchOffset(offset)) { | 2096 if (!CanEncodeBranchOffset(offset)) { |
| 2098 ASSERT(!use_far_branches()); | 2097 ASSERT(!use_far_branches()); |
| 2099 Thread::Current()->long_jump_base()->Jump( | 2098 Thread::Current()->long_jump_base()->Jump( |
| 2100 1, Object::branch_offset_error()); | 2099 1, Object::branch_offset_error()); |
| 2101 } | 2100 } |
| 2102 | 2101 |
| 2103 // Properly preserve only the bits supported in the instruction. | 2102 // Properly preserve only the bits supported in the instruction. |
| 2104 offset >>= 2; | 2103 offset >>= 2; |
| 2105 offset &= kBranchOffsetMask; | 2104 offset &= kBranchOffsetMask; |
| 2106 return (inst & ~kBranchOffsetMask) | offset; | 2105 return (inst & ~kBranchOffsetMask) | offset; |
| 2107 } | 2106 } |
| 2108 | 2107 |
| 2109 | 2108 // Moved to AssemberARM32::decodeBranchOffset. |
| 2110 int Assembler::DecodeBranchOffset(int32_t inst) { | 2109 int Assembler::DecodeBranchOffset(int32_t inst) { |
| 2111 // Sign-extend, left-shift by 2, then add 8. | 2110 // Sign-extend, left-shift by 2, then add 8. |
| 2112 return ((((inst & kBranchOffsetMask) << 8) >> 6) + Instr::kPCReadOffset); | 2111 return ((((inst & kBranchOffsetMask) << 8) >> 6) + Instr::kPCReadOffset); |
| 2113 } | 2112 } |
| 2114 | 2113 #endif |
| 2115 | 2114 |
| 2116 static int32_t DecodeARMv7LoadImmediate(int32_t movt, int32_t movw) { | 2115 static int32_t DecodeARMv7LoadImmediate(int32_t movt, int32_t movw) { |
| 2117 int32_t offset = 0; | 2116 int32_t offset = 0; |
| 2118 offset |= (movt & 0xf0000) << 12; | 2117 offset |= (movt & 0xf0000) << 12; |
| 2119 offset |= (movt & 0xfff) << 16; | 2118 offset |= (movt & 0xfff) << 16; |
| 2120 offset |= (movw & 0xf0000) >> 4; | 2119 offset |= (movw & 0xf0000) >> 4; |
| 2121 offset |= movw & 0xfff; | 2120 offset |= movw & 0xfff; |
| 2122 return offset; | 2121 return offset; |
| 2123 } | 2122 } |
| 2124 | 2123 |
| (...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3667 | 3666 |
| 3668 | 3667 |
| 3669 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3668 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 3670 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); | 3669 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); |
| 3671 return fpu_reg_names[reg]; | 3670 return fpu_reg_names[reg]; |
| 3672 } | 3671 } |
| 3673 | 3672 |
| 3674 } // namespace dart | 3673 } // namespace dart |
| 3675 | 3674 |
| 3676 #endif // defined TARGET_ARCH_ARM | 3675 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |