OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1330 __ Ret(); | 1330 __ Ret(); |
1331 | 1331 |
1332 StubRuntimeCallHelper call_helper; | 1332 StubRuntimeCallHelper call_helper; |
1333 char_at_generator.GenerateSlow(masm, call_helper); | 1333 char_at_generator.GenerateSlow(masm, call_helper); |
1334 | 1334 |
1335 __ bind(&miss); | 1335 __ bind(&miss); |
1336 GenerateMiss(masm); | 1336 GenerateMiss(masm); |
1337 } | 1337 } |
1338 | 1338 |
1339 | 1339 |
1340 // Convert unsigned integer with specified number of leading zeroes in binary | |
1341 // representation to IEEE 754 double. | |
1342 // Integer to convert is passed in register hiword. | |
1343 // Resulting double is returned in registers hiword:loword. | |
1344 // This functions does not work correctly for 0. | |
1345 static void GenerateUInt2Double(MacroAssembler* masm, | |
1346 Register hiword, | |
1347 Register loword, | |
1348 Register scratch, | |
1349 int leading_zeroes) { | |
1350 const int meaningful_bits = kBitsPerInt - leading_zeroes - 1; | |
1351 const int biased_exponent = HeapNumber::kExponentBias + meaningful_bits; | |
1352 | |
1353 const int mantissa_shift_for_hi_word = | |
1354 meaningful_bits - HeapNumber::kMantissaBitsInTopWord; | |
1355 | |
1356 const int mantissa_shift_for_lo_word = | |
1357 kBitsPerInt - mantissa_shift_for_hi_word; | |
1358 | |
1359 __ mov(scratch, Operand(biased_exponent << HeapNumber::kExponentShift)); | |
1360 if (mantissa_shift_for_hi_word > 0) { | |
1361 __ mov(loword, Operand(hiword, LSL, mantissa_shift_for_lo_word)); | |
1362 __ orr(hiword, scratch, Operand(hiword, LSR, mantissa_shift_for_hi_word)); | |
1363 } else { | |
1364 __ mov(loword, Operand(0, RelocInfo::NONE)); | |
1365 __ orr(hiword, scratch, Operand(hiword, LSL, mantissa_shift_for_hi_word)); | |
1366 } | |
1367 | |
1368 // If least significant bit of biased exponent was not 1 it was corrupted | |
1369 // by most significant bit of mantissa so we should fix that. | |
1370 if (!(biased_exponent & 1)) { | |
1371 __ bic(hiword, hiword, Operand(1 << HeapNumber::kExponentShift)); | |
1372 } | |
1373 } | |
1374 | |
1375 | |
1376 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { | 1340 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { |
1377 // ---------- S t a t e -------------- | 1341 // ---------- S t a t e -------------- |
1378 // -- lr : return address | 1342 // -- lr : return address |
1379 // -- r0 : key | 1343 // -- r0 : key |
1380 // -- r1 : receiver | 1344 // -- r1 : receiver |
1381 // ----------------------------------- | 1345 // ----------------------------------- |
1382 Label slow; | 1346 Label slow; |
1383 | 1347 |
1384 // Check that the receiver isn't a smi. | 1348 // Check that the receiver isn't a smi. |
1385 __ BranchOnSmi(r1, &slow); | 1349 __ BranchOnSmi(r1, &slow); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1562 __ tst(value, Operand(kSmiTagMask)); | 1526 __ tst(value, Operand(kSmiTagMask)); |
1563 __ Ret(eq); | 1527 __ Ret(eq); |
1564 // Update write barrier for the elements array address. | 1528 // Update write barrier for the elements array address. |
1565 __ sub(r4, r5, Operand(elements)); | 1529 __ sub(r4, r5, Operand(elements)); |
1566 __ RecordWrite(elements, Operand(r4), r5, r6); | 1530 __ RecordWrite(elements, Operand(r4), r5, r6); |
1567 | 1531 |
1568 __ Ret(); | 1532 __ Ret(); |
1569 } | 1533 } |
1570 | 1534 |
1571 | 1535 |
1572 // Convert and store int passed in register ival to IEEE 754 single precision | |
1573 // floating point value at memory location (dst + 4 * wordoffset) | |
1574 // If VFP3 is available use it for conversion. | |
1575 static void StoreIntAsFloat(MacroAssembler* masm, | |
1576 Register dst, | |
1577 Register wordoffset, | |
1578 Register ival, | |
1579 Register fval, | |
1580 Register scratch1, | |
1581 Register scratch2) { | |
1582 if (CpuFeatures::IsSupported(VFP3)) { | |
1583 CpuFeatures::Scope scope(VFP3); | |
1584 __ vmov(s0, ival); | |
1585 __ add(scratch1, dst, Operand(wordoffset, LSL, 2)); | |
1586 __ vcvt_f32_s32(s0, s0); | |
1587 __ vstr(s0, scratch1, 0); | |
1588 } else { | |
1589 Label not_special, done; | |
1590 // Move sign bit from source to destination. This works because the sign | |
1591 // bit in the exponent word of the double has the same position and polarity | |
1592 // as the 2's complement sign bit in a Smi. | |
1593 ASSERT(kBinary32SignMask == 0x80000000u); | |
1594 | |
1595 __ and_(fval, ival, Operand(kBinary32SignMask), SetCC); | |
1596 // Negate value if it is negative. | |
1597 __ rsb(ival, ival, Operand(0, RelocInfo::NONE), LeaveCC, ne); | |
1598 | |
1599 // We have -1, 0 or 1, which we treat specially. Register ival contains | |
1600 // absolute value: it is either equal to 1 (special case of -1 and 1), | |
1601 // greater than 1 (not a special case) or less than 1 (special case of 0). | |
1602 __ cmp(ival, Operand(1)); | |
1603 __ b(gt, ¬_special); | |
1604 | |
1605 // For 1 or -1 we need to or in the 0 exponent (biased). | |
1606 static const uint32_t exponent_word_for_1 = | |
1607 kBinary32ExponentBias << kBinary32ExponentShift; | |
1608 | |
1609 __ orr(fval, fval, Operand(exponent_word_for_1), LeaveCC, eq); | |
1610 __ b(&done); | |
1611 | |
1612 __ bind(¬_special); | |
1613 // Count leading zeros. | |
1614 // Gets the wrong answer for 0, but we already checked for that case above. | |
1615 Register zeros = scratch2; | |
1616 __ CountLeadingZeros(zeros, ival, scratch1); | |
1617 | |
1618 // Compute exponent and or it into the exponent register. | |
1619 __ rsb(scratch1, | |
1620 zeros, | |
1621 Operand((kBitsPerInt - 1) + kBinary32ExponentBias)); | |
1622 | |
1623 __ orr(fval, | |
1624 fval, | |
1625 Operand(scratch1, LSL, kBinary32ExponentShift)); | |
1626 | |
1627 // Shift up the source chopping the top bit off. | |
1628 __ add(zeros, zeros, Operand(1)); | |
1629 // This wouldn't work for 1 and -1 as the shift would be 32 which means 0. | |
1630 __ mov(ival, Operand(ival, LSL, zeros)); | |
1631 // And the top (top 20 bits). | |
1632 __ orr(fval, | |
1633 fval, | |
1634 Operand(ival, LSR, kBitsPerInt - kBinary32MantissaBits)); | |
1635 | |
1636 __ bind(&done); | |
1637 __ str(fval, MemOperand(dst, wordoffset, LSL, 2)); | |
1638 } | |
1639 } | |
1640 | |
1641 | |
1642 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { | 1536 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { |
1643 // ----------- S t a t e ------------- | 1537 // ----------- S t a t e ------------- |
1644 // -- r0 : value | 1538 // -- r0 : value |
1645 // -- r1 : receiver | 1539 // -- r1 : receiver |
1646 // -- r2 : name | 1540 // -- r2 : name |
1647 // -- lr : return address | 1541 // -- lr : return address |
1648 // ----------------------------------- | 1542 // ----------------------------------- |
1649 | 1543 |
1650 // Get the receiver from the stack and probe the stub cache. | 1544 // Get the receiver from the stack and probe the stub cache. |
1651 Code::Flags flags = Code::ComputeFlags(Code::STORE_IC, | 1545 Code::Flags flags = Code::ComputeFlags(Code::STORE_IC, |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1810 | 1704 |
1811 | 1705 |
1812 void PatchInlinedSmiCode(Address address) { | 1706 void PatchInlinedSmiCode(Address address) { |
1813 UNIMPLEMENTED(); | 1707 UNIMPLEMENTED(); |
1814 } | 1708 } |
1815 | 1709 |
1816 | 1710 |
1817 } } // namespace v8::internal | 1711 } } // namespace v8::internal |
1818 | 1712 |
1819 #endif // V8_TARGET_ARCH_ARM | 1713 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |