OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #include "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
10 #include "vm/memory_region.h" | 10 #include "vm/memory_region.h" |
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 if (value == 1) { | 1216 if (value == 1) { |
1217 decl(reg); | 1217 decl(reg); |
1218 } else if (value != 0) { | 1218 } else if (value != 0) { |
1219 subl(reg, Immediate(value)); | 1219 subl(reg, Immediate(value)); |
1220 } | 1220 } |
1221 } | 1221 } |
1222 } | 1222 } |
1223 | 1223 |
1224 | 1224 |
1225 void Assembler::LoadObject(Register dst, const Object& object) { | 1225 void Assembler::LoadObject(Register dst, const Object& object) { |
1226 ASSERT(object.IsZoneHandle()); | 1226 if (object.IsSmi()) { |
1227 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1227 movl(dst, Immediate(reinterpret_cast<int32_t>(object.raw()))); |
1228 EmitUint8(0xB8 + dst); | 1228 } else { |
1229 buffer_.EmitObject(object); | 1229 ASSERT(object.IsZoneHandle()); |
| 1230 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
| 1231 EmitUint8(0xB8 + dst); |
| 1232 buffer_.EmitObject(object); |
| 1233 } |
1230 } | 1234 } |
1231 | 1235 |
1232 | 1236 |
1233 void Assembler::PushObject(const Object& object) { | 1237 void Assembler::PushObject(const Object& object) { |
1234 ASSERT(object.IsZoneHandle()); | 1238 if (object.IsSmi()) { |
1235 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1239 pushl(Immediate(reinterpret_cast<int32_t>(object.raw()))); |
1236 EmitUint8(0x68); | 1240 } else { |
1237 buffer_.EmitObject(object); | 1241 ASSERT(object.IsZoneHandle()); |
| 1242 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
| 1243 EmitUint8(0x68); |
| 1244 buffer_.EmitObject(object); |
| 1245 } |
1238 } | 1246 } |
1239 | 1247 |
1240 | 1248 |
1241 void Assembler::CompareObject(Register reg, const Object& object) { | 1249 void Assembler::CompareObject(Register reg, const Object& object) { |
1242 ASSERT(object.IsZoneHandle()); | 1250 if (object.IsSmi()) { |
1243 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1251 cmpl(reg, Immediate(reinterpret_cast<int32_t>(object.raw()))); |
1244 if (reg == EAX) { | |
1245 EmitUint8(0x05 + (7 << 3)); | |
1246 buffer_.EmitObject(object); | |
1247 } else { | 1252 } else { |
1248 EmitUint8(0x81); | 1253 ASSERT(object.IsZoneHandle()); |
1249 EmitOperand(7, Operand(reg)); | 1254 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
1250 buffer_.EmitObject(object); | 1255 if (reg == EAX) { |
| 1256 EmitUint8(0x05 + (7 << 3)); |
| 1257 buffer_.EmitObject(object); |
| 1258 } else { |
| 1259 EmitUint8(0x81); |
| 1260 EmitOperand(7, Operand(reg)); |
| 1261 buffer_.EmitObject(object); |
| 1262 } |
1251 } | 1263 } |
1252 } | 1264 } |
1253 | 1265 |
1254 | 1266 |
1255 void Assembler::StoreIntoObject(Register object, | 1267 void Assembler::StoreIntoObject(Register object, |
1256 const FieldAddress& dest, | 1268 const FieldAddress& dest, |
1257 Register value) { | 1269 Register value) { |
1258 // TODO(iposva): Add write barrier. | 1270 // TODO(iposva): Add write barrier. |
1259 movl(dest, value); | 1271 movl(dest, value); |
1260 } | 1272 } |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1456 Register shifter) { | 1468 Register shifter) { |
1457 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1469 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
1458 ASSERT(shifter == ECX); | 1470 ASSERT(shifter == ECX); |
1459 EmitUint8(0xD3); | 1471 EmitUint8(0xD3); |
1460 EmitOperand(rm, Operand(operand)); | 1472 EmitOperand(rm, Operand(operand)); |
1461 } | 1473 } |
1462 | 1474 |
1463 } // namespace dart | 1475 } // namespace dart |
1464 | 1476 |
1465 #endif // defined TARGET_ARCH_IA32 | 1477 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |