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/x87/codegen-x87.h" | 5 #include "src/x87/codegen-x87.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/heap/heap.h" | 10 #include "src/heap/heap.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 // Fetch the instance type of the receiver into result register. | 221 // Fetch the instance type of the receiver into result register. |
222 __ mov(result, FieldOperand(string, HeapObject::kMapOffset)); | 222 __ mov(result, FieldOperand(string, HeapObject::kMapOffset)); |
223 __ movzx_b(result, FieldOperand(result, Map::kInstanceTypeOffset)); | 223 __ movzx_b(result, FieldOperand(result, Map::kInstanceTypeOffset)); |
224 | 224 |
225 // We need special handling for indirect strings. | 225 // We need special handling for indirect strings. |
226 Label check_sequential; | 226 Label check_sequential; |
227 __ test(result, Immediate(kIsIndirectStringMask)); | 227 __ test(result, Immediate(kIsIndirectStringMask)); |
228 __ j(zero, &check_sequential, Label::kNear); | 228 __ j(zero, &check_sequential, Label::kNear); |
229 | 229 |
230 // Dispatch on the indirect string shape: slice or cons. | 230 // Dispatch on the indirect string shape: slice or cons. |
231 Label cons_string, thin_string; | 231 Label cons_string; |
232 __ and_(result, Immediate(kStringRepresentationMask)); | 232 __ test(result, Immediate(kSlicedNotConsMask)); |
233 __ cmp(result, Immediate(kConsStringTag)); | 233 __ j(zero, &cons_string, Label::kNear); |
234 __ j(equal, &cons_string, Label::kNear); | |
235 __ cmp(result, Immediate(kThinStringTag)); | |
236 __ j(equal, &thin_string, Label::kNear); | |
237 | 234 |
238 // Handle slices. | 235 // Handle slices. |
239 Label indirect_string_loaded; | 236 Label indirect_string_loaded; |
240 __ mov(result, FieldOperand(string, SlicedString::kOffsetOffset)); | 237 __ mov(result, FieldOperand(string, SlicedString::kOffsetOffset)); |
241 __ SmiUntag(result); | 238 __ SmiUntag(result); |
242 __ add(index, result); | 239 __ add(index, result); |
243 __ mov(string, FieldOperand(string, SlicedString::kParentOffset)); | 240 __ mov(string, FieldOperand(string, SlicedString::kParentOffset)); |
244 __ jmp(&indirect_string_loaded, Label::kNear); | 241 __ jmp(&indirect_string_loaded, Label::kNear); |
245 | 242 |
246 // Handle thin strings. | |
247 __ bind(&thin_string); | |
248 __ mov(string, FieldOperand(string, ThinString::kActualOffset)); | |
249 __ jmp(&indirect_string_loaded, Label::kNear); | |
250 | |
251 // Handle cons strings. | 243 // Handle cons strings. |
252 // Check whether the right hand side is the empty string (i.e. if | 244 // Check whether the right hand side is the empty string (i.e. if |
253 // this is really a flat string in a cons string). If that is not | 245 // this is really a flat string in a cons string). If that is not |
254 // the case we would rather go to the runtime system now to flatten | 246 // the case we would rather go to the runtime system now to flatten |
255 // the string. | 247 // the string. |
256 __ bind(&cons_string); | 248 __ bind(&cons_string); |
257 __ cmp(FieldOperand(string, ConsString::kSecondOffset), | 249 __ cmp(FieldOperand(string, ConsString::kSecondOffset), |
258 Immediate(factory->empty_string())); | 250 Immediate(factory->empty_string())); |
259 __ j(not_equal, call_runtime); | 251 __ j(not_equal, call_runtime); |
260 __ mov(string, FieldOperand(string, ConsString::kFirstOffset)); | 252 __ mov(string, FieldOperand(string, ConsString::kFirstOffset)); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 CodePatcher patcher(isolate, sequence, young_length); | 365 CodePatcher patcher(isolate, sequence, young_length); |
374 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 366 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
375 } | 367 } |
376 } | 368 } |
377 | 369 |
378 | 370 |
379 } // namespace internal | 371 } // namespace internal |
380 } // namespace v8 | 372 } // namespace v8 |
381 | 373 |
382 #endif // V8_TARGET_ARCH_X87 | 374 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |