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 5101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5112 // ConsString. | 5112 // ConsString. |
5113 // Check whether the right hand side is the empty string (i.e. if | 5113 // Check whether the right hand side is the empty string (i.e. if |
5114 // this is really a flat string in a cons string). If that is not | 5114 // this is really a flat string in a cons string). If that is not |
5115 // the case we would rather go to the runtime system now to flatten | 5115 // the case we would rather go to the runtime system now to flatten |
5116 // the string. | 5116 // the string. |
5117 Label assure_seq_string; | 5117 Label assure_seq_string; |
5118 __ cmp(FieldOperand(object_, ConsString::kSecondOffset), | 5118 __ cmp(FieldOperand(object_, ConsString::kSecondOffset), |
5119 Immediate(masm->isolate()->factory()->empty_string())); | 5119 Immediate(masm->isolate()->factory()->empty_string())); |
5120 __ j(not_equal, &call_runtime_); | 5120 __ j(not_equal, &call_runtime_); |
5121 // Get the first of the two strings and load its instance type. | 5121 // Get the first of the two strings and load its instance type. |
5122 __ mov(object_, FieldOperand(object_, ConsString::kFirstOffset)); | 5122 __ mov(result_, FieldOperand(object_, ConsString::kFirstOffset)); |
5123 __ jmp(&assure_seq_string, Label::kNear); | 5123 __ jmp(&assure_seq_string, Label::kNear); |
5124 | 5124 |
5125 // SlicedString, unpack and add offset. | 5125 // SlicedString, unpack and add offset. |
5126 __ bind(&sliced_string); | 5126 __ bind(&sliced_string); |
5127 __ add(scratch_, FieldOperand(object_, SlicedString::kOffsetOffset)); | 5127 __ add(scratch_, FieldOperand(object_, SlicedString::kOffsetOffset)); |
5128 __ mov(object_, FieldOperand(object_, SlicedString::kParentOffset)); | 5128 __ mov(result_, FieldOperand(object_, SlicedString::kParentOffset)); |
5129 | 5129 |
5130 // Assure that we are dealing with a sequential string. Go to runtime if not. | 5130 // Assure that we are dealing with a sequential string. Go to runtime if not. |
5131 __ bind(&assure_seq_string); | 5131 __ bind(&assure_seq_string); |
5132 __ mov(result_, FieldOperand(object_, HeapObject::kMapOffset)); | 5132 __ mov(result_, FieldOperand(result_, HeapObject::kMapOffset)); |
5133 __ movzx_b(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); | 5133 __ movzx_b(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); |
5134 STATIC_ASSERT(kSeqStringTag == 0); | 5134 STATIC_ASSERT(kSeqStringTag == 0); |
5135 __ test(result_, Immediate(kStringRepresentationMask)); | 5135 __ test(result_, Immediate(kStringRepresentationMask)); |
5136 __ j(not_zero, &call_runtime_); | 5136 __ j(not_zero, &call_runtime_); |
5137 __ jmp(&flat_string, Label::kNear); | 5137 // Actually fetch the parent string if it is confirmed to be sequential. |
| 5138 STATIC_ASSERT(SlicedString::kParentOffset == ConsString::kFirstOffset); |
| 5139 __ mov(object_, FieldOperand(object_, SlicedString::kParentOffset)); |
5138 | 5140 |
5139 // Check for 1-byte or 2-byte string. | 5141 // Check for 1-byte or 2-byte string. |
5140 __ bind(&flat_string); | 5142 __ bind(&flat_string); |
5141 STATIC_ASSERT((kStringEncodingMask & kAsciiStringTag) != 0); | 5143 STATIC_ASSERT((kStringEncodingMask & kAsciiStringTag) != 0); |
5142 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0); | 5144 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0); |
5143 __ test(result_, Immediate(kStringEncodingMask)); | 5145 __ test(result_, Immediate(kStringEncodingMask)); |
5144 __ j(not_zero, &ascii_string, Label::kNear); | 5146 __ j(not_zero, &ascii_string, Label::kNear); |
5145 | 5147 |
5146 // 2-byte string. | 5148 // 2-byte string. |
5147 // Load the 2-byte character code into the result register. | 5149 // Load the 2-byte character code into the result register. |
(...skipping 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6992 | 6994 |
6993 // Fall through when we need to inform the incremental marker. | 6995 // Fall through when we need to inform the incremental marker. |
6994 } | 6996 } |
6995 | 6997 |
6996 | 6998 |
6997 #undef __ | 6999 #undef __ |
6998 | 7000 |
6999 } } // namespace v8::internal | 7001 } } // namespace v8::internal |
7000 | 7002 |
7001 #endif // V8_TARGET_ARCH_IA32 | 7003 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |