OLD | NEW |
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 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
10 #include "code-stubs.h" | 10 #include "code-stubs.h" |
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); | 1232 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); |
1233 __ mov(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); | 1233 __ mov(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); |
1234 | 1234 |
1235 // (5a) Is subject sequential two byte? If yes, go to (9). | 1235 // (5a) Is subject sequential two byte? If yes, go to (9). |
1236 __ test_b(ebx, kStringRepresentationMask | kStringEncodingMask); | 1236 __ test_b(ebx, kStringRepresentationMask | kStringEncodingMask); |
1237 STATIC_ASSERT((kSeqStringTag | kTwoByteStringTag) == 0); | 1237 STATIC_ASSERT((kSeqStringTag | kTwoByteStringTag) == 0); |
1238 __ j(zero, &seq_two_byte_string); // Go to (9). | 1238 __ j(zero, &seq_two_byte_string); // Go to (9). |
1239 // (5b) Is subject external? If yes, go to (8). | 1239 // (5b) Is subject external? If yes, go to (8). |
1240 __ test_b(ebx, kStringRepresentationMask); | 1240 __ test_b(ebx, kStringRepresentationMask); |
1241 // The underlying external string is never a short external string. | 1241 // The underlying external string is never a short external string. |
1242 STATIC_CHECK(ExternalString::kMaxShortLength < ConsString::kMinLength); | 1242 STATIC_ASSERT(ExternalString::kMaxShortLength < ConsString::kMinLength); |
1243 STATIC_CHECK(ExternalString::kMaxShortLength < SlicedString::kMinLength); | 1243 STATIC_ASSERT(ExternalString::kMaxShortLength < SlicedString::kMinLength); |
1244 __ j(not_zero, &external_string); // Go to (8). | 1244 __ j(not_zero, &external_string); // Go to (8). |
1245 | 1245 |
1246 // eax: sequential subject string (or look-alike, external string) | 1246 // eax: sequential subject string (or look-alike, external string) |
1247 // edx: original subject string | 1247 // edx: original subject string |
1248 // ecx: RegExp data (FixedArray) | 1248 // ecx: RegExp data (FixedArray) |
1249 // (6) One byte sequential. Load regexp code for one byte. | 1249 // (6) One byte sequential. Load regexp code for one byte. |
1250 __ bind(&seq_one_byte_string); | 1250 __ bind(&seq_one_byte_string); |
1251 // Load previous index and check range before edx is overwritten. We have | 1251 // Load previous index and check range before edx is overwritten. We have |
1252 // to use edx instead of eax here because it might have been only made to | 1252 // to use edx instead of eax here because it might have been only made to |
1253 // look like a sequential string when it actually is an external string. | 1253 // look like a sequential string when it actually is an external string. |
(...skipping 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3133 // The subject string can only be external or sequential string of either | 3133 // The subject string can only be external or sequential string of either |
3134 // encoding at this point. | 3134 // encoding at this point. |
3135 Label two_byte_sequential, runtime_drop_two, sequential_string; | 3135 Label two_byte_sequential, runtime_drop_two, sequential_string; |
3136 STATIC_ASSERT(kExternalStringTag != 0); | 3136 STATIC_ASSERT(kExternalStringTag != 0); |
3137 STATIC_ASSERT(kSeqStringTag == 0); | 3137 STATIC_ASSERT(kSeqStringTag == 0); |
3138 __ test_b(ebx, kExternalStringTag); | 3138 __ test_b(ebx, kExternalStringTag); |
3139 __ j(zero, &sequential_string); | 3139 __ j(zero, &sequential_string); |
3140 | 3140 |
3141 // Handle external string. | 3141 // Handle external string. |
3142 // Rule out short external strings. | 3142 // Rule out short external strings. |
3143 STATIC_CHECK(kShortExternalStringTag != 0); | 3143 STATIC_ASSERT(kShortExternalStringTag != 0); |
3144 __ test_b(ebx, kShortExternalStringMask); | 3144 __ test_b(ebx, kShortExternalStringMask); |
3145 __ j(not_zero, &runtime); | 3145 __ j(not_zero, &runtime); |
3146 __ mov(edi, FieldOperand(edi, ExternalString::kResourceDataOffset)); | 3146 __ mov(edi, FieldOperand(edi, ExternalString::kResourceDataOffset)); |
3147 // Move the pointer so that offset-wise, it looks like a sequential string. | 3147 // Move the pointer so that offset-wise, it looks like a sequential string. |
3148 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqOneByteString::kHeaderSize); | 3148 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqOneByteString::kHeaderSize); |
3149 __ sub(edi, Immediate(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); | 3149 __ sub(edi, Immediate(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); |
3150 | 3150 |
3151 __ bind(&sequential_string); | 3151 __ bind(&sequential_string); |
3152 // Stash away (adjusted) index and (underlying) string. | 3152 // Stash away (adjusted) index and (underlying) string. |
3153 __ push(edx); | 3153 __ push(edx); |
(...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4771 Operand(ebp, 7 * kPointerSize), | 4771 Operand(ebp, 7 * kPointerSize), |
4772 NULL); | 4772 NULL); |
4773 } | 4773 } |
4774 | 4774 |
4775 | 4775 |
4776 #undef __ | 4776 #undef __ |
4777 | 4777 |
4778 } } // namespace v8::internal | 4778 } } // namespace v8::internal |
4779 | 4779 |
4780 #endif // V8_TARGET_ARCH_X87 | 4780 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |