| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // Moved to ARM32::AssemberARM32::orr() | 279 // Moved to ARM32::AssemberARM32::orr() |
| 280 void Assembler::orr(Register rd, Register rn, Operand o, Condition cond) { | 280 void Assembler::orr(Register rd, Register rn, Operand o, Condition cond) { |
| 281 EmitType01(cond, o.type(), ORR, 0, rn, rd, o); | 281 EmitType01(cond, o.type(), ORR, 0, rn, rd, o); |
| 282 } | 282 } |
| 283 | 283 |
| 284 // Moved to ARM32::AssemberARM32::orr() | 284 // Moved to ARM32::AssemberARM32::orr() |
| 285 void Assembler::orrs(Register rd, Register rn, Operand o, Condition cond) { | 285 void Assembler::orrs(Register rd, Register rn, Operand o, Condition cond) { |
| 286 EmitType01(cond, o.type(), ORR, 1, rn, rd, o); | 286 EmitType01(cond, o.type(), ORR, 1, rn, rd, o); |
| 287 } | 287 } |
| 288 | 288 |
| 289 // Moved to AssemblerARM32::mov() | 289 // Moved to ARM32::AssemblerARM32::mov() |
| 290 // TODO(kschimpf) other forms of move. | 290 // TODO(kschimpf) other forms of move. |
| 291 void Assembler::mov(Register rd, Operand o, Condition cond) { | 291 void Assembler::mov(Register rd, Operand o, Condition cond) { |
| 292 EmitType01(cond, o.type(), MOV, 0, R0, rd, o); | 292 EmitType01(cond, o.type(), MOV, 0, R0, rd, o); |
| 293 } | 293 } |
| 294 #endif | 294 #endif |
| 295 | 295 |
| 296 void Assembler::movs(Register rd, Operand o, Condition cond) { | 296 void Assembler::movs(Register rd, Operand o, Condition cond) { |
| 297 EmitType01(cond, o.type(), MOV, 1, R0, rd, o); | 297 EmitType01(cond, o.type(), MOV, 1, R0, rd, o); |
| 298 } | 298 } |
| 299 | 299 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 326 ASSERT(rm != PC); | 326 ASSERT(rm != PC); |
| 327 int32_t encoding = (static_cast<int32_t>(cond) << kConditionShift) | | 327 int32_t encoding = (static_cast<int32_t>(cond) << kConditionShift) | |
| 328 B24 | B22 | B21 | (0xf << 16) | | 328 B24 | B22 | B21 | (0xf << 16) | |
| 329 (static_cast<int32_t>(rd) << kRdShift) | | 329 (static_cast<int32_t>(rd) << kRdShift) | |
| 330 (0xf << 8) | B4 | static_cast<int32_t>(rm); | 330 (0xf << 8) | B4 | static_cast<int32_t>(rm); |
| 331 Emit(encoding); | 331 Emit(encoding); |
| 332 } | 332 } |
| 333 | 333 |
| 334 | 334 |
| 335 #if | 335 #if |
| 336 // Moved to ARM::AssemblerARM32::movw | 336 // Moved to ARM32::AssemblerARM32::movw |
| 337 void Assembler::movw(Register rd, uint16_t imm16, Condition cond) { | 337 void Assembler::movw(Register rd, uint16_t imm16, Condition cond) { |
| 338 ASSERT(cond != kNoCondition); | 338 ASSERT(cond != kNoCondition); |
| 339 int32_t encoding = static_cast<int32_t>(cond) << kConditionShift | | 339 int32_t encoding = static_cast<int32_t>(cond) << kConditionShift | |
| 340 B25 | B24 | ((imm16 >> 12) << 16) | | 340 B25 | B24 | ((imm16 >> 12) << 16) | |
| 341 static_cast<int32_t>(rd) << kRdShift | (imm16 & 0xfff); | 341 static_cast<int32_t>(rd) << kRdShift | (imm16 & 0xfff); |
| 342 Emit(encoding); | 342 Emit(encoding); |
| 343 } | 343 } |
| 344 | 344 |
| 345 | 345 |
| 346 // Moved to ARM::AssemblerARM32::movt | 346 // Moved to ARM32::AssemblerARM32::movt |
| 347 void Assembler::movt(Register rd, uint16_t imm16, Condition cond) { | 347 void Assembler::movt(Register rd, uint16_t imm16, Condition cond) { |
| 348 ASSERT(cond != kNoCondition); | 348 ASSERT(cond != kNoCondition); |
| 349 int32_t encoding = static_cast<int32_t>(cond) << kConditionShift | | 349 int32_t encoding = static_cast<int32_t>(cond) << kConditionShift | |
| 350 B25 | B24 | B22 | ((imm16 >> 12) << 16) | | 350 B25 | B24 | B22 | ((imm16 >> 12) << 16) | |
| 351 static_cast<int32_t>(rd) << kRdShift | (imm16 & 0xfff); | 351 static_cast<int32_t>(rd) << kRdShift | (imm16 & 0xfff); |
| 352 Emit(encoding); | 352 Emit(encoding); |
| 353 } | 353 } |
| 354 #endif | 354 #endif |
| 355 | 355 |
| 356 #if 0 | 356 #if 0 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 EmitMulOp(AL, B22, rd_lo, rd_hi, rn, rm); | 439 EmitMulOp(AL, B22, rd_lo, rd_hi, rn, rm); |
| 440 } else { | 440 } else { |
| 441 mov(IP, Operand(0)); | 441 mov(IP, Operand(0)); |
| 442 umlal(rd_lo, IP, rn, rm); | 442 umlal(rd_lo, IP, rn, rm); |
| 443 adds(rd_lo, rd_lo, Operand(rd_hi)); | 443 adds(rd_lo, rd_lo, Operand(rd_hi)); |
| 444 adc(rd_hi, IP, Operand(0)); | 444 adc(rd_hi, IP, Operand(0)); |
| 445 } | 445 } |
| 446 } | 446 } |
| 447 | 447 |
| 448 | 448 |
| 449 #if 0 |
| 450 // Moved to ARM32::AssemblerARM32::emitDivOp() |
| 449 void Assembler::EmitDivOp(Condition cond, int32_t opcode, | 451 void Assembler::EmitDivOp(Condition cond, int32_t opcode, |
| 450 Register rd, Register rn, Register rm) { | 452 Register rd, Register rn, Register rm) { |
| 451 ASSERT(TargetCPUFeatures::integer_division_supported()); | 453 ASSERT(TargetCPUFeatures::integer_division_supported()); |
| 452 ASSERT(rd != kNoRegister); | 454 ASSERT(rd != kNoRegister); |
| 453 ASSERT(rn != kNoRegister); | 455 ASSERT(rn != kNoRegister); |
| 454 ASSERT(rm != kNoRegister); | 456 ASSERT(rm != kNoRegister); |
| 455 ASSERT(cond != kNoCondition); | 457 ASSERT(cond != kNoCondition); |
| 456 int32_t encoding = opcode | | 458 int32_t encoding = opcode | |
| 457 (static_cast<int32_t>(cond) << kConditionShift) | | 459 (static_cast<int32_t>(cond) << kConditionShift) | |
| 458 (static_cast<int32_t>(rn) << kDivRnShift) | | 460 (static_cast<int32_t>(rn) << kDivRnShift) | |
| 459 (static_cast<int32_t>(rd) << kDivRdShift) | | 461 (static_cast<int32_t>(rd) << kDivRdShift) | |
| 462 // TODO(kschimpf): Why not also: B15 | B14 | B13 | B12? |
| 460 B26 | B25 | B24 | B20 | B4 | | 463 B26 | B25 | B24 | B20 | B4 | |
| 461 (static_cast<int32_t>(rm) << kDivRmShift); | 464 (static_cast<int32_t>(rm) << kDivRmShift); |
| 462 Emit(encoding); | 465 Emit(encoding); |
| 463 } | 466 } |
| 464 | 467 |
| 465 | 468 // Moved to ARM32::AssemblerARM32::sdiv() |
| 466 void Assembler::sdiv(Register rd, Register rn, Register rm, Condition cond) { | 469 void Assembler::sdiv(Register rd, Register rn, Register rm, Condition cond) { |
| 467 EmitDivOp(cond, 0, rd, rn, rm); | 470 EmitDivOp(cond, 0, rd, rn, rm); |
| 468 } | 471 } |
| 469 | 472 #endif |
| 470 | 473 |
| 471 void Assembler::udiv(Register rd, Register rn, Register rm, Condition cond) { | 474 void Assembler::udiv(Register rd, Register rn, Register rm, Condition cond) { |
| 472 EmitDivOp(cond, B21 , rd, rn, rm); | 475 EmitDivOp(cond, B21 , rd, rn, rm); |
| 473 } | 476 } |
| 474 | 477 |
| 475 | 478 |
| 476 #if 0 | 479 #if 0 |
| 477 // Moved to ARM32::AssemblerARM32::ldr() | 480 // Moved to ARM32::AssemblerARM32::ldr() |
| 478 void Assembler::ldr(Register rd, Address ad, Condition cond) { | 481 void Assembler::ldr(Register rd, Address ad, Condition cond) { |
| 479 EmitMemOp(cond, true, false, rd, ad); | 482 EmitMemOp(cond, true, false, rd, ad); |
| (...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2089 | 2092 |
| 2090 #if 0 | 2093 #if 0 |
| 2091 // Moved to ::canEncodeBranchoffset in IceAssemblerARM32.cpp. | 2094 // Moved to ::canEncodeBranchoffset in IceAssemblerARM32.cpp. |
| 2092 static bool CanEncodeBranchOffset(int32_t offset) { | 2095 static bool CanEncodeBranchOffset(int32_t offset) { |
| 2093 ASSERT(Utils::IsAligned(offset, 4)); | 2096 ASSERT(Utils::IsAligned(offset, 4)); |
| 2094 // Note: This check doesn't take advantage of the fact that offset>>2 | 2097 // Note: This check doesn't take advantage of the fact that offset>>2 |
| 2095 // is stored (allowing two more bits in address space). | 2098 // is stored (allowing two more bits in address space). |
| 2096 return Utils::IsInt(Utils::CountOneBits(kBranchOffsetMask), offset); | 2099 return Utils::IsInt(Utils::CountOneBits(kBranchOffsetMask), offset); |
| 2097 } | 2100 } |
| 2098 | 2101 |
| 2099 // Moved to AssemblerARM32::encodeBranchOffset. | 2102 // Moved to ARM32::AssemblerARM32::encodeBranchOffset. |
| 2100 int32_t Assembler::EncodeBranchOffset(int32_t offset, int32_t inst) { | 2103 int32_t Assembler::EncodeBranchOffset(int32_t offset, int32_t inst) { |
| 2101 // The offset is off by 8 due to the way the ARM CPUs read PC. | 2104 // The offset is off by 8 due to the way the ARM CPUs read PC. |
| 2102 offset -= Instr::kPCReadOffset; | 2105 offset -= Instr::kPCReadOffset; |
| 2103 | 2106 |
| 2104 if (!CanEncodeBranchOffset(offset)) { | 2107 if (!CanEncodeBranchOffset(offset)) { |
| 2105 ASSERT(!use_far_branches()); | 2108 ASSERT(!use_far_branches()); |
| 2106 Thread::Current()->long_jump_base()->Jump( | 2109 Thread::Current()->long_jump_base()->Jump( |
| 2107 1, Object::branch_offset_error()); | 2110 1, Object::branch_offset_error()); |
| 2108 } | 2111 } |
| 2109 | 2112 |
| (...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3674 | 3677 |
| 3675 | 3678 |
| 3676 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3679 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
| 3677 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); | 3680 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); |
| 3678 return fpu_reg_names[reg]; | 3681 return fpu_reg_names[reg]; |
| 3679 } | 3682 } |
| 3680 | 3683 |
| 3681 } // namespace dart | 3684 } // namespace dart |
| 3682 | 3685 |
| 3683 #endif // defined TARGET_ARCH_ARM | 3686 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |