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 "src/x64/codegen-x64.h" | 5 #include "src/x64/codegen-x64.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // Fetch the instance type of the receiver into result register. | 70 // Fetch the instance type of the receiver into result register. |
71 __ movp(result, FieldOperand(string, HeapObject::kMapOffset)); | 71 __ movp(result, FieldOperand(string, HeapObject::kMapOffset)); |
72 __ movzxbl(result, FieldOperand(result, Map::kInstanceTypeOffset)); | 72 __ movzxbl(result, FieldOperand(result, Map::kInstanceTypeOffset)); |
73 | 73 |
74 // We need special handling for indirect strings. | 74 // We need special handling for indirect strings. |
75 Label check_sequential; | 75 Label check_sequential; |
76 __ testb(result, Immediate(kIsIndirectStringMask)); | 76 __ testb(result, Immediate(kIsIndirectStringMask)); |
77 __ j(zero, &check_sequential, Label::kNear); | 77 __ j(zero, &check_sequential, Label::kNear); |
78 | 78 |
79 // Dispatch on the indirect string shape: slice or cons. | 79 // Dispatch on the indirect string shape: slice or cons. |
80 Label cons_string, thin_string; | 80 Label cons_string; |
81 __ andl(result, Immediate(kStringRepresentationMask)); | 81 __ testb(result, Immediate(kSlicedNotConsMask)); |
82 __ cmpl(result, Immediate(kConsStringTag)); | 82 __ j(zero, &cons_string, Label::kNear); |
83 __ j(equal, &cons_string, Label::kNear); | |
84 __ cmpl(result, Immediate(kThinStringTag)); | |
85 __ j(equal, &thin_string, Label::kNear); | |
86 | 83 |
87 // Handle slices. | 84 // Handle slices. |
88 Label indirect_string_loaded; | 85 Label indirect_string_loaded; |
89 __ SmiToInteger32(result, FieldOperand(string, SlicedString::kOffsetOffset)); | 86 __ SmiToInteger32(result, FieldOperand(string, SlicedString::kOffsetOffset)); |
90 __ addp(index, result); | 87 __ addp(index, result); |
91 __ movp(string, FieldOperand(string, SlicedString::kParentOffset)); | 88 __ movp(string, FieldOperand(string, SlicedString::kParentOffset)); |
92 __ jmp(&indirect_string_loaded, Label::kNear); | 89 __ jmp(&indirect_string_loaded, Label::kNear); |
93 | 90 |
94 // Handle thin strings. | |
95 __ bind(&thin_string); | |
96 __ movp(string, FieldOperand(string, ThinString::kActualOffset)); | |
97 __ jmp(&indirect_string_loaded, Label::kNear); | |
98 | |
99 // Handle cons strings. | 91 // Handle cons strings. |
100 // Check whether the right hand side is the empty string (i.e. if | 92 // Check whether the right hand side is the empty string (i.e. if |
101 // this is really a flat string in a cons string). If that is not | 93 // this is really a flat string in a cons string). If that is not |
102 // the case we would rather go to the runtime system now to flatten | 94 // the case we would rather go to the runtime system now to flatten |
103 // the string. | 95 // the string. |
104 __ bind(&cons_string); | 96 __ bind(&cons_string); |
105 __ CompareRoot(FieldOperand(string, ConsString::kSecondOffset), | 97 __ CompareRoot(FieldOperand(string, ConsString::kSecondOffset), |
106 Heap::kempty_stringRootIndex); | 98 Heap::kempty_stringRootIndex); |
107 __ j(not_equal, call_runtime); | 99 __ j(not_equal, call_runtime); |
108 __ movp(string, FieldOperand(string, ConsString::kFirstOffset)); | 100 __ movp(string, FieldOperand(string, ConsString::kFirstOffset)); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 return Operand(base_reg_, argument_count_reg_, times_pointer_size, | 239 return Operand(base_reg_, argument_count_reg_, times_pointer_size, |
248 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); | 240 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); |
249 } | 241 } |
250 } | 242 } |
251 | 243 |
252 | 244 |
253 } // namespace internal | 245 } // namespace internal |
254 } // namespace v8 | 246 } // namespace v8 |
255 | 247 |
256 #endif // V8_TARGET_ARCH_X64 | 248 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |