| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "src/ppc/codegen-ppc.h" | 5 #include "src/ppc/codegen-ppc.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_PPC | 7 #if V8_TARGET_ARCH_PPC |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 Label* call_runtime) { | 79 Label* call_runtime) { |
| 80 // Fetch the instance type of the receiver into result register. | 80 // Fetch the instance type of the receiver into result register. |
| 81 __ LoadP(result, FieldMemOperand(string, HeapObject::kMapOffset)); | 81 __ LoadP(result, FieldMemOperand(string, HeapObject::kMapOffset)); |
| 82 __ lbz(result, FieldMemOperand(result, Map::kInstanceTypeOffset)); | 82 __ lbz(result, FieldMemOperand(result, Map::kInstanceTypeOffset)); |
| 83 | 83 |
| 84 // We need special handling for indirect strings. | 84 // We need special handling for indirect strings. |
| 85 Label check_sequential; | 85 Label check_sequential; |
| 86 __ andi(r0, result, Operand(kIsIndirectStringMask)); | 86 __ andi(r0, result, Operand(kIsIndirectStringMask)); |
| 87 __ beq(&check_sequential, cr0); | 87 __ beq(&check_sequential, cr0); |
| 88 | 88 |
| 89 // Dispatch on the indirect string shape: slice or cons or thin. | 89 // Dispatch on the indirect string shape: slice or cons. |
| 90 Label cons_string, thin_string; | 90 Label cons_string; |
| 91 __ andi(ip, result, Operand(kStringRepresentationMask)); | 91 __ mov(ip, Operand(kSlicedNotConsMask)); |
| 92 __ cmpi(ip, Operand(kConsStringTag)); | 92 __ and_(r0, result, ip, SetRC); |
| 93 __ beq(&cons_string); | 93 __ beq(&cons_string, cr0); |
| 94 __ cmpi(ip, Operand(kThinStringTag)); | |
| 95 __ beq(&thin_string); | |
| 96 | 94 |
| 97 // Handle slices. | 95 // Handle slices. |
| 98 Label indirect_string_loaded; | 96 Label indirect_string_loaded; |
| 99 __ LoadP(result, FieldMemOperand(string, SlicedString::kOffsetOffset)); | 97 __ LoadP(result, FieldMemOperand(string, SlicedString::kOffsetOffset)); |
| 100 __ LoadP(string, FieldMemOperand(string, SlicedString::kParentOffset)); | 98 __ LoadP(string, FieldMemOperand(string, SlicedString::kParentOffset)); |
| 101 __ SmiUntag(ip, result); | 99 __ SmiUntag(ip, result); |
| 102 __ add(index, index, ip); | 100 __ add(index, index, ip); |
| 103 __ b(&indirect_string_loaded); | 101 __ b(&indirect_string_loaded); |
| 104 | 102 |
| 105 // Handle thin strings. | |
| 106 __ bind(&thin_string); | |
| 107 __ LoadP(string, FieldMemOperand(string, ThinString::kActualOffset)); | |
| 108 __ b(&indirect_string_loaded); | |
| 109 | |
| 110 // Handle cons strings. | 103 // Handle cons strings. |
| 111 // Check whether the right hand side is the empty string (i.e. if | 104 // Check whether the right hand side is the empty string (i.e. if |
| 112 // this is really a flat string in a cons string). If that is not | 105 // this is really a flat string in a cons string). If that is not |
| 113 // the case we would rather go to the runtime system now to flatten | 106 // the case we would rather go to the runtime system now to flatten |
| 114 // the string. | 107 // the string. |
| 115 __ bind(&cons_string); | 108 __ bind(&cons_string); |
| 116 __ LoadP(result, FieldMemOperand(string, ConsString::kSecondOffset)); | 109 __ LoadP(result, FieldMemOperand(string, ConsString::kSecondOffset)); |
| 117 __ CompareRoot(result, Heap::kempty_stringRootIndex); | 110 __ CompareRoot(result, Heap::kempty_stringRootIndex); |
| 118 __ bne(call_runtime); | 111 __ bne(call_runtime); |
| 119 // Get the first of the two strings and load its instance type. | 112 // Get the first of the two strings and load its instance type. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 patcher.masm()->Jump(r3); | 225 patcher.masm()->Jump(r3); |
| 233 for (int i = 0; i < kCodeAgingSequenceNops; i++) { | 226 for (int i = 0; i < kCodeAgingSequenceNops; i++) { |
| 234 patcher.masm()->nop(); | 227 patcher.masm()->nop(); |
| 235 } | 228 } |
| 236 } | 229 } |
| 237 } | 230 } |
| 238 } // namespace internal | 231 } // namespace internal |
| 239 } // namespace v8 | 232 } // namespace v8 |
| 240 | 233 |
| 241 #endif // V8_TARGET_ARCH_PPC | 234 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |