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 2452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2463 __ andb(rbx, Immediate(kIsNotStringMask | kStringRepresentationMask)); | 2463 __ andb(rbx, Immediate(kIsNotStringMask | kStringRepresentationMask)); |
2464 __ j(zero, &seq_ascii_string, Label::kNear); | 2464 __ j(zero, &seq_ascii_string, Label::kNear); |
2465 | 2465 |
2466 // Check for flat cons string or sliced string. | 2466 // Check for flat cons string or sliced string. |
2467 // A flat cons string is a cons string where the second part is the empty | 2467 // A flat cons string is a cons string where the second part is the empty |
2468 // string. In that case the subject string is just the first part of the cons | 2468 // string. In that case the subject string is just the first part of the cons |
2469 // string. Also in this case the first part of the cons string is known to be | 2469 // string. Also in this case the first part of the cons string is known to be |
2470 // a sequential string or an external string. | 2470 // a sequential string or an external string. |
2471 // In the case of a sliced string its offset has to be taken into account. | 2471 // In the case of a sliced string its offset has to be taken into account. |
2472 Label cons_string, check_encoding; | 2472 Label cons_string, check_encoding; |
2473 STATIC_ASSERT((kConsStringTag < kExternalStringTag)); | 2473 STATIC_ASSERT(kConsStringTag < kExternalStringTag); |
2474 STATIC_ASSERT((kSlicedStringTag > kExternalStringTag)); | 2474 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); |
2475 __ cmpq(rbx, Immediate(kExternalStringTag)); | 2475 __ cmpq(rbx, Immediate(kExternalStringTag)); |
2476 __ j(less, &cons_string, Label::kNear); | 2476 __ j(less, &cons_string, Label::kNear); |
2477 __ j(equal, &runtime); | 2477 __ j(equal, &runtime); |
2478 | 2478 |
2479 // String is sliced. | 2479 // String is sliced. |
2480 __ SmiToInteger32(r14, FieldOperand(rdi, SlicedString::kOffsetOffset)); | 2480 __ SmiToInteger32(r14, FieldOperand(rdi, SlicedString::kOffsetOffset)); |
2481 __ movq(rdi, FieldOperand(rdi, SlicedString::kParentOffset)); | 2481 __ movq(rdi, FieldOperand(rdi, SlicedString::kParentOffset)); |
2482 // r14: slice offset | 2482 // r14: slice offset |
2483 // r15: original subject string | 2483 // r15: original subject string |
2484 // rdi: parent string | 2484 // rdi: parent string |
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3896 __ SmiCompare(scratch_, FieldOperand(object_, String::kLengthOffset)); | 3896 __ SmiCompare(scratch_, FieldOperand(object_, String::kLengthOffset)); |
3897 __ j(above_equal, index_out_of_range_); | 3897 __ j(above_equal, index_out_of_range_); |
3898 | 3898 |
3899 // We need special handling for non-flat strings. | 3899 // We need special handling for non-flat strings. |
3900 STATIC_ASSERT(kSeqStringTag == 0); | 3900 STATIC_ASSERT(kSeqStringTag == 0); |
3901 __ testb(result_, Immediate(kStringRepresentationMask)); | 3901 __ testb(result_, Immediate(kStringRepresentationMask)); |
3902 __ j(zero, &flat_string); | 3902 __ j(zero, &flat_string); |
3903 | 3903 |
3904 // Handle non-flat strings. | 3904 // Handle non-flat strings. |
3905 __ and_(result_, Immediate(kStringRepresentationMask)); | 3905 __ and_(result_, Immediate(kStringRepresentationMask)); |
3906 STATIC_ASSERT((kConsStringTag < kExternalStringTag)); | 3906 STATIC_ASSERT(kConsStringTag < kExternalStringTag); |
3907 STATIC_ASSERT((kSlicedStringTag > kExternalStringTag)); | 3907 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); |
3908 __ cmpb(result_, Immediate(kExternalStringTag)); | 3908 __ cmpb(result_, Immediate(kExternalStringTag)); |
3909 __ j(greater, &sliced_string); | 3909 __ j(greater, &sliced_string); |
3910 __ j(equal, &call_runtime_); | 3910 __ j(equal, &call_runtime_); |
3911 | 3911 |
3912 // ConsString. | 3912 // ConsString. |
3913 // Check whether the right hand side is the empty string (i.e. if | 3913 // Check whether the right hand side is the empty string (i.e. if |
3914 // this is really a flat string in a cons string). If that is not | 3914 // this is really a flat string in a cons string). If that is not |
3915 // the case we would rather go to the runtime system now to flatten | 3915 // the case we would rather go to the runtime system now to flatten |
3916 // the string. | 3916 // the string. |
3917 Label assure_seq_string; | 3917 Label assure_seq_string; |
(...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5396 __ Drop(1); | 5396 __ Drop(1); |
5397 __ ret(2 * kPointerSize); | 5397 __ ret(2 * kPointerSize); |
5398 } | 5398 } |
5399 | 5399 |
5400 | 5400 |
5401 #undef __ | 5401 #undef __ |
5402 | 5402 |
5403 } } // namespace v8::internal | 5403 } } // namespace v8::internal |
5404 | 5404 |
5405 #endif // V8_TARGET_ARCH_X64 | 5405 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |