Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: src/x87/macro-assembler-x87.cc

Issue 2580653002: [cleanup] Drop unused Allocate*String MacroAssembler instructions (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/x87/macro-assembler-x87.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_X87 5 #if V8_TARGET_ARCH_X87
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/division-by-constant.h" 8 #include "src/base/division-by-constant.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1529 NO_ALLOCATION_FLAGS); 1529 NO_ALLOCATION_FLAGS);
1530 1530
1531 Handle<Map> map = mode == MUTABLE 1531 Handle<Map> map = mode == MUTABLE
1532 ? isolate()->factory()->mutable_heap_number_map() 1532 ? isolate()->factory()->mutable_heap_number_map()
1533 : isolate()->factory()->heap_number_map(); 1533 : isolate()->factory()->heap_number_map();
1534 1534
1535 // Set the map. 1535 // Set the map.
1536 mov(FieldOperand(result, HeapObject::kMapOffset), Immediate(map)); 1536 mov(FieldOperand(result, HeapObject::kMapOffset), Immediate(map));
1537 } 1537 }
1538 1538
1539
1540 void MacroAssembler::AllocateTwoByteString(Register result,
1541 Register length,
1542 Register scratch1,
1543 Register scratch2,
1544 Register scratch3,
1545 Label* gc_required) {
1546 // Calculate the number of bytes needed for the characters in the string while
1547 // observing object alignment.
1548 DCHECK((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0);
1549 DCHECK(kShortSize == 2);
1550 // scratch1 = length * 2 + kObjectAlignmentMask.
1551 lea(scratch1, Operand(length, length, times_1, kObjectAlignmentMask));
1552 and_(scratch1, Immediate(~kObjectAlignmentMask));
1553
1554 // Allocate two byte string in new space.
1555 Allocate(SeqTwoByteString::kHeaderSize, times_1, scratch1,
1556 REGISTER_VALUE_IS_INT32, result, scratch2, scratch3, gc_required,
1557 NO_ALLOCATION_FLAGS);
1558
1559 // Set the map, length and hash field.
1560 mov(FieldOperand(result, HeapObject::kMapOffset),
1561 Immediate(isolate()->factory()->string_map()));
1562 mov(scratch1, length);
1563 SmiTag(scratch1);
1564 mov(FieldOperand(result, String::kLengthOffset), scratch1);
1565 mov(FieldOperand(result, String::kHashFieldOffset),
1566 Immediate(String::kEmptyHashField));
1567 }
1568
1569
1570 void MacroAssembler::AllocateOneByteString(Register result, Register length,
1571 Register scratch1, Register scratch2,
1572 Register scratch3,
1573 Label* gc_required) {
1574 // Calculate the number of bytes needed for the characters in the string while
1575 // observing object alignment.
1576 DCHECK((SeqOneByteString::kHeaderSize & kObjectAlignmentMask) == 0);
1577 mov(scratch1, length);
1578 DCHECK(kCharSize == 1);
1579 add(scratch1, Immediate(kObjectAlignmentMask));
1580 and_(scratch1, Immediate(~kObjectAlignmentMask));
1581
1582 // Allocate one-byte string in new space.
1583 Allocate(SeqOneByteString::kHeaderSize, times_1, scratch1,
1584 REGISTER_VALUE_IS_INT32, result, scratch2, scratch3, gc_required,
1585 NO_ALLOCATION_FLAGS);
1586
1587 // Set the map, length and hash field.
1588 mov(FieldOperand(result, HeapObject::kMapOffset),
1589 Immediate(isolate()->factory()->one_byte_string_map()));
1590 mov(scratch1, length);
1591 SmiTag(scratch1);
1592 mov(FieldOperand(result, String::kLengthOffset), scratch1);
1593 mov(FieldOperand(result, String::kHashFieldOffset),
1594 Immediate(String::kEmptyHashField));
1595 }
1596
1597
1598 void MacroAssembler::AllocateOneByteString(Register result, int length,
1599 Register scratch1, Register scratch2,
1600 Label* gc_required) {
1601 DCHECK(length > 0);
1602
1603 // Allocate one-byte string in new space.
1604 Allocate(SeqOneByteString::SizeFor(length), result, scratch1, scratch2,
1605 gc_required, NO_ALLOCATION_FLAGS);
1606
1607 // Set the map, length and hash field.
1608 mov(FieldOperand(result, HeapObject::kMapOffset),
1609 Immediate(isolate()->factory()->one_byte_string_map()));
1610 mov(FieldOperand(result, String::kLengthOffset),
1611 Immediate(Smi::FromInt(length)));
1612 mov(FieldOperand(result, String::kHashFieldOffset),
1613 Immediate(String::kEmptyHashField));
1614 }
1615
1616
1617 void MacroAssembler::AllocateTwoByteConsString(Register result,
1618 Register scratch1,
1619 Register scratch2,
1620 Label* gc_required) {
1621 // Allocate heap number in new space.
1622 Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
1623 NO_ALLOCATION_FLAGS);
1624
1625 // Set the map. The other fields are left uninitialized.
1626 mov(FieldOperand(result, HeapObject::kMapOffset),
1627 Immediate(isolate()->factory()->cons_string_map()));
1628 }
1629
1630
1631 void MacroAssembler::AllocateOneByteConsString(Register result,
1632 Register scratch1,
1633 Register scratch2,
1634 Label* gc_required) {
1635 Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
1636 NO_ALLOCATION_FLAGS);
1637
1638 // Set the map. The other fields are left uninitialized.
1639 mov(FieldOperand(result, HeapObject::kMapOffset),
1640 Immediate(isolate()->factory()->cons_one_byte_string_map()));
1641 }
1642
1643
1644 void MacroAssembler::AllocateTwoByteSlicedString(Register result,
1645 Register scratch1,
1646 Register scratch2,
1647 Label* gc_required) {
1648 // Allocate heap number in new space.
1649 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
1650 NO_ALLOCATION_FLAGS);
1651
1652 // Set the map. The other fields are left uninitialized.
1653 mov(FieldOperand(result, HeapObject::kMapOffset),
1654 Immediate(isolate()->factory()->sliced_string_map()));
1655 }
1656
1657
1658 void MacroAssembler::AllocateOneByteSlicedString(Register result,
1659 Register scratch1,
1660 Register scratch2,
1661 Label* gc_required) {
1662 // Allocate heap number in new space.
1663 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
1664 NO_ALLOCATION_FLAGS);
1665
1666 // Set the map. The other fields are left uninitialized.
1667 mov(FieldOperand(result, HeapObject::kMapOffset),
1668 Immediate(isolate()->factory()->sliced_one_byte_string_map()));
1669 }
1670
1671
1672 void MacroAssembler::AllocateJSValue(Register result, Register constructor, 1539 void MacroAssembler::AllocateJSValue(Register result, Register constructor,
1673 Register value, Register scratch, 1540 Register value, Register scratch,
1674 Label* gc_required) { 1541 Label* gc_required) {
1675 DCHECK(!result.is(constructor)); 1542 DCHECK(!result.is(constructor));
1676 DCHECK(!result.is(scratch)); 1543 DCHECK(!result.is(scratch));
1677 DCHECK(!result.is(value)); 1544 DCHECK(!result.is(value));
1678 1545
1679 // Allocate JSValue in new space. 1546 // Allocate JSValue in new space.
1680 Allocate(JSValue::kSize, result, scratch, no_reg, gc_required, 1547 Allocate(JSValue::kSize, result, scratch, no_reg, gc_required,
1681 NO_ALLOCATION_FLAGS); 1548 NO_ALLOCATION_FLAGS);
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
2518 int accessor_index, 2385 int accessor_index,
2519 AccessorComponent accessor) { 2386 AccessorComponent accessor) {
2520 mov(dst, FieldOperand(holder, HeapObject::kMapOffset)); 2387 mov(dst, FieldOperand(holder, HeapObject::kMapOffset));
2521 LoadInstanceDescriptors(dst, dst); 2388 LoadInstanceDescriptors(dst, dst);
2522 mov(dst, FieldOperand(dst, DescriptorArray::GetValueOffset(accessor_index))); 2389 mov(dst, FieldOperand(dst, DescriptorArray::GetValueOffset(accessor_index)));
2523 int offset = accessor == ACCESSOR_GETTER ? AccessorPair::kGetterOffset 2390 int offset = accessor == ACCESSOR_GETTER ? AccessorPair::kGetterOffset
2524 : AccessorPair::kSetterOffset; 2391 : AccessorPair::kSetterOffset;
2525 mov(dst, FieldOperand(dst, offset)); 2392 mov(dst, FieldOperand(dst, offset));
2526 } 2393 }
2527 2394
2528
2529 void MacroAssembler::JumpIfInstanceTypeIsNotSequentialOneByte(
2530 Register instance_type, Register scratch, Label* failure) {
2531 if (!scratch.is(instance_type)) {
2532 mov(scratch, instance_type);
2533 }
2534 and_(scratch,
2535 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask);
2536 cmp(scratch, kStringTag | kSeqStringTag | kOneByteStringTag);
2537 j(not_equal, failure);
2538 }
2539
2540
2541 void MacroAssembler::JumpIfNotBothSequentialOneByteStrings(Register object1, 2395 void MacroAssembler::JumpIfNotBothSequentialOneByteStrings(Register object1,
2542 Register object2, 2396 Register object2,
2543 Register scratch1, 2397 Register scratch1,
2544 Register scratch2, 2398 Register scratch2,
2545 Label* failure) { 2399 Label* failure) {
2546 // Check that both objects are not smis. 2400 // Check that both objects are not smis.
2547 STATIC_ASSERT(kSmiTag == 0); 2401 STATIC_ASSERT(kSmiTag == 0);
2548 mov(scratch1, object1); 2402 mov(scratch1, object1);
2549 and_(scratch1, object2); 2403 and_(scratch1, object2);
2550 JumpIfSmi(scratch1, failure); 2404 JumpIfSmi(scratch1, failure);
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
2942 mov(eax, dividend); 2796 mov(eax, dividend);
2943 shr(eax, 31); 2797 shr(eax, 31);
2944 add(edx, eax); 2798 add(edx, eax);
2945 } 2799 }
2946 2800
2947 2801
2948 } // namespace internal 2802 } // namespace internal
2949 } // namespace v8 2803 } // namespace v8
2950 2804
2951 #endif // V8_TARGET_ARCH_X87 2805 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/macro-assembler-x87.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698