OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 LoadRoot(r0, Heap::kUndefinedValueRootIndex); | 1173 LoadRoot(r0, Heap::kUndefinedValueRootIndex); |
1174 } | 1174 } |
1175 | 1175 |
1176 | 1176 |
1177 void MacroAssembler::IntegerToDoubleConversionWithVFP3(Register inReg, | 1177 void MacroAssembler::IntegerToDoubleConversionWithVFP3(Register inReg, |
1178 Register outHighReg, | 1178 Register outHighReg, |
1179 Register outLowReg) { | 1179 Register outLowReg) { |
1180 // ARMv7 VFP3 instructions to implement integer to double conversion. | 1180 // ARMv7 VFP3 instructions to implement integer to double conversion. |
1181 mov(r7, Operand(inReg, ASR, kSmiTagSize)); | 1181 mov(r7, Operand(inReg, ASR, kSmiTagSize)); |
1182 vmov(s15, r7); | 1182 vmov(s15, r7); |
1183 vcvt(d7, s15); | 1183 vcvt_f64_s32(d7, s15); |
1184 vmov(outLowReg, outHighReg, d7); | 1184 vmov(outLowReg, outHighReg, d7); |
1185 } | 1185 } |
1186 | 1186 |
1187 | 1187 |
1188 void MacroAssembler::GetLeastBitsFromSmi(Register dst, | 1188 void MacroAssembler::GetLeastBitsFromSmi(Register dst, |
1189 Register src, | 1189 Register src, |
1190 int num_least_bits) { | 1190 int num_least_bits) { |
1191 if (CpuFeatures::IsSupported(ARMv7)) { | 1191 if (CpuFeatures::IsSupported(ARMv7)) { |
1192 ubfx(dst, src, Operand(kSmiTagSize), Operand(num_least_bits - 1)); | 1192 ubfx(dst, src, Operand(kSmiTagSize), Operand(num_least_bits - 1)); |
1193 } else { | 1193 } else { |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1436 tst(scratch1, Operand(kSmiTagMask)); | 1436 tst(scratch1, Operand(kSmiTagMask)); |
1437 b(eq, failure); | 1437 b(eq, failure); |
1438 JumpIfNonSmisNotBothSequentialAsciiStrings(first, | 1438 JumpIfNonSmisNotBothSequentialAsciiStrings(first, |
1439 second, | 1439 second, |
1440 scratch1, | 1440 scratch1, |
1441 scratch2, | 1441 scratch2, |
1442 failure); | 1442 failure); |
1443 } | 1443 } |
1444 | 1444 |
1445 | 1445 |
| 1446 // Allocates a heap number or jumps to the need_gc label if the young space |
| 1447 // is full and a scavenge is needed. |
| 1448 void MacroAssembler::AllocateHeapNumber(Register result, |
| 1449 Register scratch1, |
| 1450 Register scratch2, |
| 1451 Label* gc_required) { |
| 1452 // Allocate an object in the heap for the heap number and tag it as a heap |
| 1453 // object. |
| 1454 AllocateInNewSpace(HeapNumber::kSize / kPointerSize, |
| 1455 result, |
| 1456 scratch1, |
| 1457 scratch2, |
| 1458 gc_required, |
| 1459 TAG_OBJECT); |
| 1460 |
| 1461 // Get heap number map and store it in the allocated object. |
| 1462 LoadRoot(scratch1, Heap::kHeapNumberMapRootIndex); |
| 1463 str(scratch1, FieldMemOperand(result, HeapObject::kMapOffset)); |
| 1464 } |
| 1465 |
| 1466 |
| 1467 void MacroAssembler::CountLeadingZeros(Register source, |
| 1468 Register scratch, |
| 1469 Register zeros) { |
| 1470 #ifdef CAN_USE_ARMV5_INSTRUCTIONS |
| 1471 clz(zeros, source); // This instruction is only supported after ARM5. |
| 1472 #else |
| 1473 mov(zeros, Operand(0)); |
| 1474 mov(scratch, source); |
| 1475 // Top 16. |
| 1476 tst(scratch, Operand(0xffff0000)); |
| 1477 add(zeros, zeros, Operand(16), LeaveCC, eq); |
| 1478 mov(scratch, Operand(scratch, LSL, 16), LeaveCC, eq); |
| 1479 // Top 8. |
| 1480 tst(scratch, Operand(0xff000000)); |
| 1481 add(zeros, zeros, Operand(8), LeaveCC, eq); |
| 1482 mov(scratch, Operand(scratch, LSL, 8), LeaveCC, eq); |
| 1483 // Top 4. |
| 1484 tst(scratch, Operand(0xf0000000)); |
| 1485 add(zeros, zeros, Operand(4), LeaveCC, eq); |
| 1486 mov(scratch, Operand(scratch, LSL, 4), LeaveCC, eq); |
| 1487 // Top 2. |
| 1488 tst(scratch, Operand(0xc0000000)); |
| 1489 add(zeros, zeros, Operand(2), LeaveCC, eq); |
| 1490 mov(scratch, Operand(scratch, LSL, 2), LeaveCC, eq); |
| 1491 // Top bit. |
| 1492 tst(scratch, Operand(0x80000000u)); |
| 1493 add(zeros, zeros, Operand(1), LeaveCC, eq); |
| 1494 #endif |
| 1495 } |
| 1496 |
| 1497 |
1446 void MacroAssembler::JumpIfBothInstanceTypesAreNotSequentialAscii( | 1498 void MacroAssembler::JumpIfBothInstanceTypesAreNotSequentialAscii( |
1447 Register first, | 1499 Register first, |
1448 Register second, | 1500 Register second, |
1449 Register scratch1, | 1501 Register scratch1, |
1450 Register scratch2, | 1502 Register scratch2, |
1451 Label* failure) { | 1503 Label* failure) { |
1452 int kFlatAsciiStringMask = | 1504 int kFlatAsciiStringMask = |
1453 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; | 1505 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; |
1454 int kFlatAsciiStringTag = ASCII_STRING_TYPE; | 1506 int kFlatAsciiStringTag = ASCII_STRING_TYPE; |
1455 and_(scratch1, first, Operand(kFlatAsciiStringMask)); | 1507 and_(scratch1, first, Operand(kFlatAsciiStringMask)); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1501 } | 1553 } |
1502 | 1554 |
1503 | 1555 |
1504 void CodePatcher::Emit(Address addr) { | 1556 void CodePatcher::Emit(Address addr) { |
1505 masm()->emit(reinterpret_cast<Instr>(addr)); | 1557 masm()->emit(reinterpret_cast<Instr>(addr)); |
1506 } | 1558 } |
1507 #endif // ENABLE_DEBUGGER_SUPPORT | 1559 #endif // ENABLE_DEBUGGER_SUPPORT |
1508 | 1560 |
1509 | 1561 |
1510 } } // namespace v8::internal | 1562 } } // namespace v8::internal |
OLD | NEW |