OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2107 // Check that both objects are not smis. | 2107 // Check that both objects are not smis. |
2108 Condition either_smi = CheckEitherSmi(first_object, second_object); | 2108 Condition either_smi = CheckEitherSmi(first_object, second_object); |
2109 j(either_smi, on_fail, near_jump); | 2109 j(either_smi, on_fail, near_jump); |
2110 | 2110 |
2111 // Load instance type for both strings. | 2111 // Load instance type for both strings. |
2112 movq(scratch1, FieldOperand(first_object, HeapObject::kMapOffset)); | 2112 movq(scratch1, FieldOperand(first_object, HeapObject::kMapOffset)); |
2113 movq(scratch2, FieldOperand(second_object, HeapObject::kMapOffset)); | 2113 movq(scratch2, FieldOperand(second_object, HeapObject::kMapOffset)); |
2114 movzxbl(scratch1, FieldOperand(scratch1, Map::kInstanceTypeOffset)); | 2114 movzxbl(scratch1, FieldOperand(scratch1, Map::kInstanceTypeOffset)); |
2115 movzxbl(scratch2, FieldOperand(scratch2, Map::kInstanceTypeOffset)); | 2115 movzxbl(scratch2, FieldOperand(scratch2, Map::kInstanceTypeOffset)); |
2116 | 2116 |
2117 // Check that both are flat ascii strings. | 2117 // Check that both are flat ASCII strings. |
2118 ASSERT(kNotStringTag != 0); | 2118 ASSERT(kNotStringTag != 0); |
2119 const int kFlatAsciiStringMask = | 2119 const int kFlatAsciiStringMask = |
2120 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; | 2120 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; |
2121 const int kFlatAsciiStringTag = ASCII_STRING_TYPE; | 2121 const int kFlatAsciiStringTag = ASCII_STRING_TYPE; |
2122 | 2122 |
2123 andl(scratch1, Immediate(kFlatAsciiStringMask)); | 2123 andl(scratch1, Immediate(kFlatAsciiStringMask)); |
2124 andl(scratch2, Immediate(kFlatAsciiStringMask)); | 2124 andl(scratch2, Immediate(kFlatAsciiStringMask)); |
2125 // Interleave the bits to check both scratch1 and scratch2 in one test. | 2125 // Interleave the bits to check both scratch1 and scratch2 in one test. |
2126 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3)); | 2126 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3)); |
2127 lea(scratch1, Operand(scratch1, scratch2, times_8, 0)); | 2127 lea(scratch1, Operand(scratch1, scratch2, times_8, 0)); |
(...skipping 25 matching lines...) Expand all Loading... |
2153 Register first_object_instance_type, | 2153 Register first_object_instance_type, |
2154 Register second_object_instance_type, | 2154 Register second_object_instance_type, |
2155 Register scratch1, | 2155 Register scratch1, |
2156 Register scratch2, | 2156 Register scratch2, |
2157 Label* on_fail, | 2157 Label* on_fail, |
2158 Label::Distance near_jump) { | 2158 Label::Distance near_jump) { |
2159 // Load instance type for both strings. | 2159 // Load instance type for both strings. |
2160 movq(scratch1, first_object_instance_type); | 2160 movq(scratch1, first_object_instance_type); |
2161 movq(scratch2, second_object_instance_type); | 2161 movq(scratch2, second_object_instance_type); |
2162 | 2162 |
2163 // Check that both are flat ascii strings. | 2163 // Check that both are flat ASCII strings. |
2164 ASSERT(kNotStringTag != 0); | 2164 ASSERT(kNotStringTag != 0); |
2165 const int kFlatAsciiStringMask = | 2165 const int kFlatAsciiStringMask = |
2166 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; | 2166 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; |
2167 const int kFlatAsciiStringTag = ASCII_STRING_TYPE; | 2167 const int kFlatAsciiStringTag = ASCII_STRING_TYPE; |
2168 | 2168 |
2169 andl(scratch1, Immediate(kFlatAsciiStringMask)); | 2169 andl(scratch1, Immediate(kFlatAsciiStringMask)); |
2170 andl(scratch2, Immediate(kFlatAsciiStringMask)); | 2170 andl(scratch2, Immediate(kFlatAsciiStringMask)); |
2171 // Interleave the bits to check both scratch1 and scratch2 in one test. | 2171 // Interleave the bits to check both scratch1 and scratch2 in one test. |
2172 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3)); | 2172 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3)); |
2173 lea(scratch1, Operand(scratch1, scratch2, times_8, 0)); | 2173 lea(scratch1, Operand(scratch1, scratch2, times_8, 0)); |
(...skipping 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3818 const int kHeaderAlignment = SeqAsciiString::kHeaderSize & | 3818 const int kHeaderAlignment = SeqAsciiString::kHeaderSize & |
3819 kObjectAlignmentMask; | 3819 kObjectAlignmentMask; |
3820 movl(scratch1, length); | 3820 movl(scratch1, length); |
3821 ASSERT(kCharSize == 1); | 3821 ASSERT(kCharSize == 1); |
3822 addq(scratch1, Immediate(kObjectAlignmentMask + kHeaderAlignment)); | 3822 addq(scratch1, Immediate(kObjectAlignmentMask + kHeaderAlignment)); |
3823 and_(scratch1, Immediate(~kObjectAlignmentMask)); | 3823 and_(scratch1, Immediate(~kObjectAlignmentMask)); |
3824 if (kHeaderAlignment > 0) { | 3824 if (kHeaderAlignment > 0) { |
3825 subq(scratch1, Immediate(kHeaderAlignment)); | 3825 subq(scratch1, Immediate(kHeaderAlignment)); |
3826 } | 3826 } |
3827 | 3827 |
3828 // Allocate ascii string in new space. | 3828 // Allocate ASCII string in new space. |
3829 AllocateInNewSpace(SeqAsciiString::kHeaderSize, | 3829 AllocateInNewSpace(SeqAsciiString::kHeaderSize, |
3830 times_1, | 3830 times_1, |
3831 scratch1, | 3831 scratch1, |
3832 result, | 3832 result, |
3833 scratch2, | 3833 scratch2, |
3834 scratch3, | 3834 scratch3, |
3835 gc_required, | 3835 gc_required, |
3836 TAG_OBJECT); | 3836 TAG_OBJECT); |
3837 | 3837 |
3838 // Set the map, length and hash field. | 3838 // Set the map, length and hash field. |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4325 | 4325 |
4326 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); | 4326 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); |
4327 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); | 4327 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); |
4328 | 4328 |
4329 bind(&done); | 4329 bind(&done); |
4330 } | 4330 } |
4331 | 4331 |
4332 } } // namespace v8::internal | 4332 } } // namespace v8::internal |
4333 | 4333 |
4334 #endif // V8_TARGET_ARCH_X64 | 4334 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |