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 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1410 Register second, | 1410 Register second, |
1411 Register scratch1, | 1411 Register scratch1, |
1412 Register scratch2, | 1412 Register scratch2, |
1413 Label* failure) { | 1413 Label* failure) { |
1414 // Test that both first and second are sequential ASCII strings. | 1414 // Test that both first and second are sequential ASCII strings. |
1415 // Assume that they are non-smis. | 1415 // Assume that they are non-smis. |
1416 ldr(scratch1, FieldMemOperand(first, HeapObject::kMapOffset)); | 1416 ldr(scratch1, FieldMemOperand(first, HeapObject::kMapOffset)); |
1417 ldr(scratch2, FieldMemOperand(second, HeapObject::kMapOffset)); | 1417 ldr(scratch2, FieldMemOperand(second, HeapObject::kMapOffset)); |
1418 ldrb(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); | 1418 ldrb(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); |
1419 ldrb(scratch2, FieldMemOperand(scratch2, Map::kInstanceTypeOffset)); | 1419 ldrb(scratch2, FieldMemOperand(scratch2, Map::kInstanceTypeOffset)); |
1420 int kFlatAsciiStringMask = | 1420 |
1421 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; | 1421 JumpIfBothInstanceTypesAreNotSequentialAscii(scratch1, |
1422 int kFlatAsciiStringTag = ASCII_STRING_TYPE; | 1422 scratch2, |
1423 and_(scratch1, scratch1, Operand(kFlatAsciiStringMask)); | 1423 scratch1, |
1424 and_(scratch2, scratch2, Operand(kFlatAsciiStringMask)); | 1424 scratch2, |
1425 cmp(scratch1, Operand(kFlatAsciiStringTag)); | 1425 failure); |
1426 // Ignore second test if first test failed. | |
1427 cmp(scratch2, Operand(kFlatAsciiStringTag), eq); | |
1428 b(ne, failure); | |
1429 } | 1426 } |
1430 | 1427 |
1431 void MacroAssembler::JumpIfNotBothSequentialAsciiStrings(Register first, | 1428 void MacroAssembler::JumpIfNotBothSequentialAsciiStrings(Register first, |
1432 Register second, | 1429 Register second, |
1433 Register scratch1, | 1430 Register scratch1, |
1434 Register scratch2, | 1431 Register scratch2, |
1435 Label* failure) { | 1432 Label* failure) { |
1436 // Check that neither is a smi. | 1433 // Check that neither is a smi. |
1437 ASSERT_EQ(0, kSmiTag); | 1434 ASSERT_EQ(0, kSmiTag); |
1438 and_(scratch1, first, Operand(second)); | 1435 and_(scratch1, first, Operand(second)); |
1439 tst(scratch1, Operand(kSmiTagMask)); | 1436 tst(scratch1, Operand(kSmiTagMask)); |
1440 b(eq, failure); | 1437 b(eq, failure); |
1441 JumpIfNonSmisNotBothSequentialAsciiStrings(first, | 1438 JumpIfNonSmisNotBothSequentialAsciiStrings(first, |
1442 second, | 1439 second, |
1443 scratch1, | 1440 scratch1, |
1444 scratch2, | 1441 scratch2, |
1445 failure); | 1442 failure); |
1446 } | 1443 } |
1447 | 1444 |
1448 | 1445 |
| 1446 void MacroAssembler::JumpIfBothInstanceTypesAreNotSequentialAscii( |
| 1447 Register first, |
| 1448 Register second, |
| 1449 Register scratch1, |
| 1450 Register scratch2, |
| 1451 Label* failure) { |
| 1452 int kFlatAsciiStringMask = |
| 1453 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; |
| 1454 int kFlatAsciiStringTag = ASCII_STRING_TYPE; |
| 1455 and_(scratch1, first, Operand(kFlatAsciiStringMask)); |
| 1456 and_(scratch2, second, Operand(kFlatAsciiStringMask)); |
| 1457 cmp(scratch1, Operand(kFlatAsciiStringTag)); |
| 1458 // Ignore second test if first test failed. |
| 1459 cmp(scratch2, Operand(kFlatAsciiStringTag), eq); |
| 1460 b(ne, failure); |
| 1461 } |
| 1462 |
| 1463 |
| 1464 void MacroAssembler::JumpIfInstanceTypeIsNotSequentialAscii(Register type, |
| 1465 Register scratch, |
| 1466 Label* failure) { |
| 1467 int kFlatAsciiStringMask = |
| 1468 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; |
| 1469 int kFlatAsciiStringTag = ASCII_STRING_TYPE; |
| 1470 and_(scratch, type, Operand(kFlatAsciiStringMask)); |
| 1471 cmp(scratch, Operand(kFlatAsciiStringTag)); |
| 1472 b(ne, failure); |
| 1473 } |
| 1474 |
| 1475 |
1449 #ifdef ENABLE_DEBUGGER_SUPPORT | 1476 #ifdef ENABLE_DEBUGGER_SUPPORT |
1450 CodePatcher::CodePatcher(byte* address, int instructions) | 1477 CodePatcher::CodePatcher(byte* address, int instructions) |
1451 : address_(address), | 1478 : address_(address), |
1452 instructions_(instructions), | 1479 instructions_(instructions), |
1453 size_(instructions * Assembler::kInstrSize), | 1480 size_(instructions * Assembler::kInstrSize), |
1454 masm_(address, size_ + Assembler::kGap) { | 1481 masm_(address, size_ + Assembler::kGap) { |
1455 // Create a new macro assembler pointing to the address of the code to patch. | 1482 // Create a new macro assembler pointing to the address of the code to patch. |
1456 // The size is adjusted with kGap on order for the assembler to generate size | 1483 // The size is adjusted with kGap on order for the assembler to generate size |
1457 // bytes of instructions without failing with buffer size constraints. | 1484 // bytes of instructions without failing with buffer size constraints. |
1458 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1485 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
(...skipping 15 matching lines...) Expand all Loading... |
1474 } | 1501 } |
1475 | 1502 |
1476 | 1503 |
1477 void CodePatcher::Emit(Address addr) { | 1504 void CodePatcher::Emit(Address addr) { |
1478 masm()->emit(reinterpret_cast<Instr>(addr)); | 1505 masm()->emit(reinterpret_cast<Instr>(addr)); |
1479 } | 1506 } |
1480 #endif // ENABLE_DEBUGGER_SUPPORT | 1507 #endif // ENABLE_DEBUGGER_SUPPORT |
1481 | 1508 |
1482 | 1509 |
1483 } } // namespace v8::internal | 1510 } } // namespace v8::internal |
OLD | NEW |