| 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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 8 | 8 |
| 9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
| 10 #include "code-stubs.h" | 10 #include "code-stubs.h" |
| (...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); | 1559 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); |
| 1560 __ mov(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); | 1560 __ mov(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); |
| 1561 | 1561 |
| 1562 // (5a) Is subject sequential two byte? If yes, go to (9). | 1562 // (5a) Is subject sequential two byte? If yes, go to (9). |
| 1563 __ test_b(ebx, kStringRepresentationMask | kStringEncodingMask); | 1563 __ test_b(ebx, kStringRepresentationMask | kStringEncodingMask); |
| 1564 STATIC_ASSERT((kSeqStringTag | kTwoByteStringTag) == 0); | 1564 STATIC_ASSERT((kSeqStringTag | kTwoByteStringTag) == 0); |
| 1565 __ j(zero, &seq_two_byte_string); // Go to (9). | 1565 __ j(zero, &seq_two_byte_string); // Go to (9). |
| 1566 // (5b) Is subject external? If yes, go to (8). | 1566 // (5b) Is subject external? If yes, go to (8). |
| 1567 __ test_b(ebx, kStringRepresentationMask); | 1567 __ test_b(ebx, kStringRepresentationMask); |
| 1568 // The underlying external string is never a short external string. | 1568 // The underlying external string is never a short external string. |
| 1569 STATIC_CHECK(ExternalString::kMaxShortLength < ConsString::kMinLength); | 1569 STATIC_ASSERT(ExternalString::kMaxShortLength < ConsString::kMinLength); |
| 1570 STATIC_CHECK(ExternalString::kMaxShortLength < SlicedString::kMinLength); | 1570 STATIC_ASSERT(ExternalString::kMaxShortLength < SlicedString::kMinLength); |
| 1571 __ j(not_zero, &external_string); // Go to (8). | 1571 __ j(not_zero, &external_string); // Go to (8). |
| 1572 | 1572 |
| 1573 // eax: sequential subject string (or look-alike, external string) | 1573 // eax: sequential subject string (or look-alike, external string) |
| 1574 // edx: original subject string | 1574 // edx: original subject string |
| 1575 // ecx: RegExp data (FixedArray) | 1575 // ecx: RegExp data (FixedArray) |
| 1576 // (6) One byte sequential. Load regexp code for one byte. | 1576 // (6) One byte sequential. Load regexp code for one byte. |
| 1577 __ bind(&seq_one_byte_string); | 1577 __ bind(&seq_one_byte_string); |
| 1578 // Load previous index and check range before edx is overwritten. We have | 1578 // Load previous index and check range before edx is overwritten. We have |
| 1579 // to use edx instead of eax here because it might have been only made to | 1579 // to use edx instead of eax here because it might have been only made to |
| 1580 // look like a sequential string when it actually is an external string. | 1580 // look like a sequential string when it actually is an external string. |
| (...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3458 // The subject string can only be external or sequential string of either | 3458 // The subject string can only be external or sequential string of either |
| 3459 // encoding at this point. | 3459 // encoding at this point. |
| 3460 Label two_byte_sequential, runtime_drop_two, sequential_string; | 3460 Label two_byte_sequential, runtime_drop_two, sequential_string; |
| 3461 STATIC_ASSERT(kExternalStringTag != 0); | 3461 STATIC_ASSERT(kExternalStringTag != 0); |
| 3462 STATIC_ASSERT(kSeqStringTag == 0); | 3462 STATIC_ASSERT(kSeqStringTag == 0); |
| 3463 __ test_b(ebx, kExternalStringTag); | 3463 __ test_b(ebx, kExternalStringTag); |
| 3464 __ j(zero, &sequential_string); | 3464 __ j(zero, &sequential_string); |
| 3465 | 3465 |
| 3466 // Handle external string. | 3466 // Handle external string. |
| 3467 // Rule out short external strings. | 3467 // Rule out short external strings. |
| 3468 STATIC_CHECK(kShortExternalStringTag != 0); | 3468 STATIC_ASSERT(kShortExternalStringTag != 0); |
| 3469 __ test_b(ebx, kShortExternalStringMask); | 3469 __ test_b(ebx, kShortExternalStringMask); |
| 3470 __ j(not_zero, &runtime); | 3470 __ j(not_zero, &runtime); |
| 3471 __ mov(edi, FieldOperand(edi, ExternalString::kResourceDataOffset)); | 3471 __ mov(edi, FieldOperand(edi, ExternalString::kResourceDataOffset)); |
| 3472 // Move the pointer so that offset-wise, it looks like a sequential string. | 3472 // Move the pointer so that offset-wise, it looks like a sequential string. |
| 3473 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqOneByteString::kHeaderSize); | 3473 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqOneByteString::kHeaderSize); |
| 3474 __ sub(edi, Immediate(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); | 3474 __ sub(edi, Immediate(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); |
| 3475 | 3475 |
| 3476 __ bind(&sequential_string); | 3476 __ bind(&sequential_string); |
| 3477 // Stash away (adjusted) index and (underlying) string. | 3477 // Stash away (adjusted) index and (underlying) string. |
| 3478 __ push(edx); | 3478 __ push(edx); |
| (...skipping 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5131 Operand(ebp, 7 * kPointerSize), | 5131 Operand(ebp, 7 * kPointerSize), |
| 5132 NULL); | 5132 NULL); |
| 5133 } | 5133 } |
| 5134 | 5134 |
| 5135 | 5135 |
| 5136 #undef __ | 5136 #undef __ |
| 5137 | 5137 |
| 5138 } } // namespace v8::internal | 5138 } } // namespace v8::internal |
| 5139 | 5139 |
| 5140 #endif // V8_TARGET_ARCH_IA32 | 5140 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |