OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3389 Immediate(kIsNotStringMask | kStringRepresentationMask)); | 3389 Immediate(kIsNotStringMask | kStringRepresentationMask)); |
3390 __ j(zero, &seq_ascii_string, Label::kNear); | 3390 __ j(zero, &seq_ascii_string, Label::kNear); |
3391 | 3391 |
3392 // Check for flat cons string or sliced string. | 3392 // Check for flat cons string or sliced string. |
3393 // A flat cons string is a cons string where the second part is the empty | 3393 // A flat cons string is a cons string where the second part is the empty |
3394 // string. In that case the subject string is just the first part of the cons | 3394 // string. In that case the subject string is just the first part of the cons |
3395 // string. Also in this case the first part of the cons string is known to be | 3395 // string. Also in this case the first part of the cons string is known to be |
3396 // a sequential string or an external string. | 3396 // a sequential string or an external string. |
3397 // In the case of a sliced string its offset has to be taken into account. | 3397 // In the case of a sliced string its offset has to be taken into account. |
3398 Label cons_string, check_encoding; | 3398 Label cons_string, check_encoding; |
3399 STATIC_ASSERT((kConsStringTag < kExternalStringTag)); | 3399 STATIC_ASSERT(kConsStringTag < kExternalStringTag); |
3400 STATIC_ASSERT((kSlicedStringTag > kExternalStringTag)); | 3400 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); |
3401 __ cmp(Operand(ebx), Immediate(kExternalStringTag)); | 3401 __ cmp(Operand(ebx), Immediate(kExternalStringTag)); |
3402 __ j(less, &cons_string); | 3402 __ j(less, &cons_string); |
3403 __ j(equal, &runtime); | 3403 __ j(equal, &runtime); |
3404 | 3404 |
3405 // String is sliced. | 3405 // String is sliced. |
3406 __ mov(edi, FieldOperand(eax, SlicedString::kOffsetOffset)); | 3406 __ mov(edi, FieldOperand(eax, SlicedString::kOffsetOffset)); |
3407 __ mov(eax, FieldOperand(eax, SlicedString::kParentOffset)); | 3407 __ mov(eax, FieldOperand(eax, SlicedString::kParentOffset)); |
3408 // edi: offset of sliced string, smi-tagged. | 3408 // edi: offset of sliced string, smi-tagged. |
3409 // eax: parent string. | 3409 // eax: parent string. |
3410 __ jmp(&check_encoding, Label::kNear); | 3410 __ jmp(&check_encoding, Label::kNear); |
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4865 __ cmp(scratch_, FieldOperand(object_, String::kLengthOffset)); | 4865 __ cmp(scratch_, FieldOperand(object_, String::kLengthOffset)); |
4866 __ j(above_equal, index_out_of_range_); | 4866 __ j(above_equal, index_out_of_range_); |
4867 | 4867 |
4868 // We need special handling for non-flat strings. | 4868 // We need special handling for non-flat strings. |
4869 STATIC_ASSERT(kSeqStringTag == 0); | 4869 STATIC_ASSERT(kSeqStringTag == 0); |
4870 __ test(result_, Immediate(kStringRepresentationMask)); | 4870 __ test(result_, Immediate(kStringRepresentationMask)); |
4871 __ j(zero, &flat_string); | 4871 __ j(zero, &flat_string); |
4872 | 4872 |
4873 // Handle non-flat strings. | 4873 // Handle non-flat strings. |
4874 __ and_(result_, kStringRepresentationMask); | 4874 __ and_(result_, kStringRepresentationMask); |
4875 STATIC_ASSERT((kConsStringTag < kExternalStringTag)); | 4875 STATIC_ASSERT(kConsStringTag < kExternalStringTag); |
4876 STATIC_ASSERT((kSlicedStringTag > kExternalStringTag)); | 4876 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); |
4877 __ cmp(result_, kExternalStringTag); | 4877 __ cmp(result_, kExternalStringTag); |
4878 __ j(greater, &sliced_string, Label::kNear); | 4878 __ j(greater, &sliced_string, Label::kNear); |
4879 __ j(equal, &call_runtime_); | 4879 __ j(equal, &call_runtime_); |
4880 | 4880 |
4881 // ConsString. | 4881 // ConsString. |
4882 // Check whether the right hand side is the empty string (i.e. if | 4882 // Check whether the right hand side is the empty string (i.e. if |
4883 // this is really a flat string in a cons string). If that is not | 4883 // this is really a flat string in a cons string). If that is not |
4884 // the case we would rather go to the runtime system now to flatten | 4884 // the case we would rather go to the runtime system now to flatten |
4885 // the string. | 4885 // the string. |
4886 Label assure_seq_string; | 4886 Label assure_seq_string; |
(...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6414 __ Drop(1); | 6414 __ Drop(1); |
6415 __ ret(2 * kPointerSize); | 6415 __ ret(2 * kPointerSize); |
6416 } | 6416 } |
6417 | 6417 |
6418 | 6418 |
6419 #undef __ | 6419 #undef __ |
6420 | 6420 |
6421 } } // namespace v8::internal | 6421 } } // namespace v8::internal |
6422 | 6422 |
6423 #endif // V8_TARGET_ARCH_IA32 | 6423 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |