| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 | 420 |
| 421 void Assembler::arithmetic_op_32(byte opcode, Register dst, Register src) { | 421 void Assembler::arithmetic_op_32(byte opcode, Register dst, Register src) { |
| 422 EnsureSpace ensure_space(this); | 422 EnsureSpace ensure_space(this); |
| 423 last_pc_ = pc_; | 423 last_pc_ = pc_; |
| 424 emit_optional_rex_32(dst, src); | 424 emit_optional_rex_32(dst, src); |
| 425 emit(opcode); | 425 emit(opcode); |
| 426 emit_modrm(dst, src); | 426 emit_modrm(dst, src); |
| 427 } | 427 } |
| 428 | 428 |
| 429 | 429 |
| 430 void Assembler::arithmetic_op_32(byte opcode, |
| 431 const Operand& dst, |
| 432 Register src) { |
| 433 EnsureSpace ensure_space(this); |
| 434 last_pc_ = pc_; |
| 435 emit_optional_rex_32(src, dst); |
| 436 emit(opcode); |
| 437 emit_operand(src, dst); |
| 438 } |
| 439 |
| 440 |
| 430 void Assembler::immediate_arithmetic_op(byte subcode, | 441 void Assembler::immediate_arithmetic_op(byte subcode, |
| 431 Register dst, | 442 Register dst, |
| 432 Immediate src) { | 443 Immediate src) { |
| 433 EnsureSpace ensure_space(this); | 444 EnsureSpace ensure_space(this); |
| 434 last_pc_ = pc_; | 445 last_pc_ = pc_; |
| 435 emit_rex_64(dst); | 446 emit_rex_64(dst); |
| 436 if (is_int8(src.value_)) { | 447 if (is_int8(src.value_)) { |
| 437 emit(0x83); | 448 emit(0x83); |
| 438 emit_modrm(subcode, dst); | 449 emit_modrm(subcode, dst); |
| 439 emit(src.value_); | 450 emit(src.value_); |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 void Assembler::movq(Register dst, void* value, RelocInfo::Mode rmode) { | 1072 void Assembler::movq(Register dst, void* value, RelocInfo::Mode rmode) { |
| 1062 EnsureSpace ensure_space(this); | 1073 EnsureSpace ensure_space(this); |
| 1063 last_pc_ = pc_; | 1074 last_pc_ = pc_; |
| 1064 emit_rex_64(dst); | 1075 emit_rex_64(dst); |
| 1065 emit(0xB8 | dst.low_bits()); | 1076 emit(0xB8 | dst.low_bits()); |
| 1066 emitq(reinterpret_cast<uintptr_t>(value), rmode); | 1077 emitq(reinterpret_cast<uintptr_t>(value), rmode); |
| 1067 } | 1078 } |
| 1068 | 1079 |
| 1069 | 1080 |
| 1070 void Assembler::movq(Register dst, int64_t value, RelocInfo::Mode rmode) { | 1081 void Assembler::movq(Register dst, int64_t value, RelocInfo::Mode rmode) { |
| 1071 EnsureSpace ensure_space(this); | 1082 // Non-relocatable values might not need a 64-bit representation. |
| 1072 last_pc_ = pc_; | 1083 if (rmode == RelocInfo::NONE) { |
| 1073 emit_rex_64(dst); | 1084 // Sadly, there is no zero or sign extending move for 8-bit immediates. |
| 1074 emit(0xB8 | dst.low_bits()); | 1085 if (is_int32(value)) { |
| 1075 emitq(value, rmode); | 1086 movq(dst, Immediate(static_cast<int32_t>(value))); |
| 1087 } else if (is_uint32(value)) { |
| 1088 movl(dst, Immediate(static_cast<int32_t>(value))); |
| 1089 } |
| 1090 // Value cannot be represented by 32 bits, so do a full 64 bit immediate |
| 1091 // value. |
| 1092 } else { |
| 1093 EnsureSpace ensure_space(this); |
| 1094 last_pc_ = pc_; |
| 1095 emit_rex_64(dst); |
| 1096 emit(0xB8 | dst.low_bits()); |
| 1097 emitq(value, rmode); |
| 1098 } |
| 1076 } | 1099 } |
| 1077 | 1100 |
| 1078 | 1101 |
| 1079 void Assembler::movq(Register dst, ExternalReference ref) { | 1102 void Assembler::movq(Register dst, ExternalReference ref) { |
| 1080 EnsureSpace ensure_space(this); | 1103 EnsureSpace ensure_space(this); |
| 1081 last_pc_ = pc_; | 1104 last_pc_ = pc_; |
| 1082 emit_rex_64(dst); | 1105 emit_rex_64(dst); |
| 1083 emit(0xB8 | dst.low_bits()); | 1106 emit(0xB8 | dst.low_bits()); |
| 1084 emitq(reinterpret_cast<uintptr_t>(ref.address()), | 1107 emitq(reinterpret_cast<uintptr_t>(ref.address()), |
| 1085 RelocInfo::EXTERNAL_REFERENCE); | 1108 RelocInfo::EXTERNAL_REFERENCE); |
| 1086 } | 1109 } |
| 1087 | 1110 |
| 1088 | 1111 |
| 1089 void Assembler::movq(const Operand& dst, Immediate value) { | 1112 void Assembler::movq(const Operand& dst, Immediate value) { |
| 1090 EnsureSpace ensure_space(this); | 1113 EnsureSpace ensure_space(this); |
| 1091 last_pc_ = pc_; | 1114 last_pc_ = pc_; |
| 1092 emit_rex_64(dst); | 1115 emit_rex_64(dst); |
| 1093 emit(0xC7); | 1116 emit(0xC7); |
| 1094 emit_operand(0, dst); | 1117 emit_operand(0, dst); |
| 1095 emit(value); | 1118 emit(value); |
| 1096 } | 1119 } |
| 1097 | 1120 |
| 1098 | 1121 |
| 1099 void Assembler::movq(Register dst, Handle<Object> value, RelocInfo::Mode mode) { | 1122 void Assembler::movq(Register dst, Handle<Object> value, RelocInfo::Mode mode) { |
| 1100 EnsureSpace ensure_space(this); | 1123 // If there is no relocation info, emit the value of the handle efficiently |
| 1101 last_pc_ = pc_; | 1124 // (possibly using less that 8 bytes for the value). |
| 1102 ASSERT(!Heap::InNewSpace(*value)); | 1125 if (mode == RelocInfo::NONE) { |
| 1103 emit_rex_64(dst); | 1126 // There is no possible reason to store a heap pointer without relocation |
| 1104 emit(0xB8 | dst.low_bits()); | 1127 // info, so it must be a smi. |
| 1105 if (value->IsHeapObject()) { | 1128 ASSERT(value->IsSmi()); |
| 1129 // Smis never have more than 32 significant bits, but they might |
| 1130 // have garbage in the high bits. |
| 1131 movq(dst, |
| 1132 Immediate(static_cast<int32_t>(reinterpret_cast<intptr_t>(*value)))); |
| 1133 } else { |
| 1134 EnsureSpace ensure_space(this); |
| 1135 last_pc_ = pc_; |
| 1136 ASSERT(value->IsHeapObject()); |
| 1137 ASSERT(!Heap::InNewSpace(*value)); |
| 1138 emit_rex_64(dst); |
| 1139 emit(0xB8 | dst.low_bits()); |
| 1106 emitq(reinterpret_cast<uintptr_t>(value.location()), mode); | 1140 emitq(reinterpret_cast<uintptr_t>(value.location()), mode); |
| 1107 } else { | |
| 1108 ASSERT_EQ(RelocInfo::NONE, mode); | |
| 1109 emitq(reinterpret_cast<uintptr_t>(*value), RelocInfo::NONE); | |
| 1110 } | 1141 } |
| 1111 } | 1142 } |
| 1112 | 1143 |
| 1113 | 1144 |
| 1114 void Assembler::movsxlq(Register dst, Register src) { | 1145 void Assembler::movsxlq(Register dst, Register src) { |
| 1115 EnsureSpace ensure_space(this); | 1146 EnsureSpace ensure_space(this); |
| 1116 last_pc_ = pc_; | 1147 last_pc_ = pc_; |
| 1117 emit_rex_64(dst, src); | 1148 emit_rex_64(dst, src); |
| 1118 emit(0x63); | 1149 emit(0x63); |
| 1119 emit_modrm(dst, src); | 1150 emit_modrm(dst, src); |
| (...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2144 bool BreakLocationIterator::IsDebugBreakAtReturn() { | 2175 bool BreakLocationIterator::IsDebugBreakAtReturn() { |
| 2145 UNIMPLEMENTED(); | 2176 UNIMPLEMENTED(); |
| 2146 return false; | 2177 return false; |
| 2147 } | 2178 } |
| 2148 | 2179 |
| 2149 void BreakLocationIterator::SetDebugBreakAtReturn() { | 2180 void BreakLocationIterator::SetDebugBreakAtReturn() { |
| 2150 UNIMPLEMENTED(); | 2181 UNIMPLEMENTED(); |
| 2151 } | 2182 } |
| 2152 | 2183 |
| 2153 } } // namespace v8::internal | 2184 } } // namespace v8::internal |
| OLD | NEW |