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 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1518 | 1518 |
1519 push(eax); | 1519 push(eax); |
1520 push(Immediate(p0)); | 1520 push(Immediate(p0)); |
1521 push(Immediate(reinterpret_cast<intptr_t>(Smi::FromInt(p1 - p0)))); | 1521 push(Immediate(reinterpret_cast<intptr_t>(Smi::FromInt(p1 - p0)))); |
1522 CallRuntime(Runtime::kAbort, 2); | 1522 CallRuntime(Runtime::kAbort, 2); |
1523 // will not return here | 1523 // will not return here |
1524 int3(); | 1524 int3(); |
1525 } | 1525 } |
1526 | 1526 |
1527 | 1527 |
| 1528 void MacroAssembler::JumpIfNotBothSequentialAsciiStrings(Register object1, |
| 1529 Register object2, |
| 1530 Register scratch1, |
| 1531 Register scratch2, |
| 1532 Label* failure) { |
| 1533 // Check that both objects are not smis. |
| 1534 ASSERT_EQ(0, kSmiTag); |
| 1535 mov(scratch1, Operand(object1)); |
| 1536 and_(scratch1, Operand(object2)); |
| 1537 test(scratch1, Immediate(kSmiTagMask)); |
| 1538 j(zero, failure); |
| 1539 |
| 1540 // Load instance type for both strings. |
| 1541 mov(scratch1, FieldOperand(object1, HeapObject::kMapOffset)); |
| 1542 mov(scratch2, FieldOperand(object2, HeapObject::kMapOffset)); |
| 1543 movzx_b(scratch1, FieldOperand(scratch1, Map::kInstanceTypeOffset)); |
| 1544 movzx_b(scratch2, FieldOperand(scratch2, Map::kInstanceTypeOffset)); |
| 1545 |
| 1546 // Check that both are flat ascii strings. |
| 1547 const int kFlatAsciiStringMask = |
| 1548 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; |
| 1549 const int kFlatAsciiStringTag = ASCII_STRING_TYPE; |
| 1550 // Interleave bits from both instance types and compare them in one check. |
| 1551 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3)); |
| 1552 and_(scratch1, kFlatAsciiStringMask); |
| 1553 and_(scratch2, kFlatAsciiStringMask); |
| 1554 lea(scratch1, Operand(scratch1, scratch2, times_8, 0)); |
| 1555 cmp(scratch1, kFlatAsciiStringTag | (kFlatAsciiStringTag << 3)); |
| 1556 j(not_equal, failure); |
| 1557 } |
| 1558 |
| 1559 |
1528 CodePatcher::CodePatcher(byte* address, int size) | 1560 CodePatcher::CodePatcher(byte* address, int size) |
1529 : address_(address), size_(size), masm_(address, size + Assembler::kGap) { | 1561 : address_(address), size_(size), masm_(address, size + Assembler::kGap) { |
1530 // Create a new macro assembler pointing to the address of the code to patch. | 1562 // Create a new macro assembler pointing to the address of the code to patch. |
1531 // The size is adjusted with kGap on order for the assembler to generate size | 1563 // The size is adjusted with kGap on order for the assembler to generate size |
1532 // bytes of instructions without failing with buffer size constraints. | 1564 // bytes of instructions without failing with buffer size constraints. |
1533 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1565 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
1534 } | 1566 } |
1535 | 1567 |
1536 | 1568 |
1537 CodePatcher::~CodePatcher() { | 1569 CodePatcher::~CodePatcher() { |
1538 // Indicate that code has changed. | 1570 // Indicate that code has changed. |
1539 CPU::FlushICache(address_, size_); | 1571 CPU::FlushICache(address_, size_); |
1540 | 1572 |
1541 // Check that the code was patched as expected. | 1573 // Check that the code was patched as expected. |
1542 ASSERT(masm_.pc_ == address_ + size_); | 1574 ASSERT(masm_.pc_ == address_ + size_); |
1543 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1575 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
1544 } | 1576 } |
1545 | 1577 |
1546 | 1578 |
1547 } } // namespace v8::internal | 1579 } } // namespace v8::internal |
OLD | NEW |