| 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/ia32/codegen-ia32.h" | 5 #include "src/ia32/codegen-ia32.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 // Fetch the instance type of the receiver into result register. | 494 // Fetch the instance type of the receiver into result register. |
| 495 __ mov(result, FieldOperand(string, HeapObject::kMapOffset)); | 495 __ mov(result, FieldOperand(string, HeapObject::kMapOffset)); |
| 496 __ movzx_b(result, FieldOperand(result, Map::kInstanceTypeOffset)); | 496 __ movzx_b(result, FieldOperand(result, Map::kInstanceTypeOffset)); |
| 497 | 497 |
| 498 // We need special handling for indirect strings. | 498 // We need special handling for indirect strings. |
| 499 Label check_sequential; | 499 Label check_sequential; |
| 500 __ test(result, Immediate(kIsIndirectStringMask)); | 500 __ test(result, Immediate(kIsIndirectStringMask)); |
| 501 __ j(zero, &check_sequential, Label::kNear); | 501 __ j(zero, &check_sequential, Label::kNear); |
| 502 | 502 |
| 503 // Dispatch on the indirect string shape: slice or cons. | 503 // Dispatch on the indirect string shape: slice or cons. |
| 504 Label cons_string, thin_string; | 504 Label cons_string; |
| 505 __ and_(result, Immediate(kStringRepresentationMask)); | 505 __ test(result, Immediate(kSlicedNotConsMask)); |
| 506 __ cmp(result, Immediate(kConsStringTag)); | 506 __ j(zero, &cons_string, Label::kNear); |
| 507 __ j(equal, &cons_string, Label::kNear); | |
| 508 __ cmp(result, Immediate(kThinStringTag)); | |
| 509 __ j(equal, &thin_string, Label::kNear); | |
| 510 | 507 |
| 511 // Handle slices. | 508 // Handle slices. |
| 512 Label indirect_string_loaded; | 509 Label indirect_string_loaded; |
| 513 __ mov(result, FieldOperand(string, SlicedString::kOffsetOffset)); | 510 __ mov(result, FieldOperand(string, SlicedString::kOffsetOffset)); |
| 514 __ SmiUntag(result); | 511 __ SmiUntag(result); |
| 515 __ add(index, result); | 512 __ add(index, result); |
| 516 __ mov(string, FieldOperand(string, SlicedString::kParentOffset)); | 513 __ mov(string, FieldOperand(string, SlicedString::kParentOffset)); |
| 517 __ jmp(&indirect_string_loaded, Label::kNear); | 514 __ jmp(&indirect_string_loaded, Label::kNear); |
| 518 | 515 |
| 519 // Handle thin strings. | |
| 520 __ bind(&thin_string); | |
| 521 __ mov(string, FieldOperand(string, ThinString::kActualOffset)); | |
| 522 __ jmp(&indirect_string_loaded, Label::kNear); | |
| 523 | |
| 524 // Handle cons strings. | 516 // Handle cons strings. |
| 525 // Check whether the right hand side is the empty string (i.e. if | 517 // Check whether the right hand side is the empty string (i.e. if |
| 526 // this is really a flat string in a cons string). If that is not | 518 // this is really a flat string in a cons string). If that is not |
| 527 // the case we would rather go to the runtime system now to flatten | 519 // the case we would rather go to the runtime system now to flatten |
| 528 // the string. | 520 // the string. |
| 529 __ bind(&cons_string); | 521 __ bind(&cons_string); |
| 530 __ cmp(FieldOperand(string, ConsString::kSecondOffset), | 522 __ cmp(FieldOperand(string, ConsString::kSecondOffset), |
| 531 Immediate(factory->empty_string())); | 523 Immediate(factory->empty_string())); |
| 532 __ j(not_equal, call_runtime); | 524 __ j(not_equal, call_runtime); |
| 533 __ mov(string, FieldOperand(string, ConsString::kFirstOffset)); | 525 __ mov(string, FieldOperand(string, ConsString::kFirstOffset)); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 CodePatcher patcher(isolate, sequence, young_length); | 637 CodePatcher patcher(isolate, sequence, young_length); |
| 646 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 638 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
| 647 } | 639 } |
| 648 } | 640 } |
| 649 | 641 |
| 650 | 642 |
| 651 } // namespace internal | 643 } // namespace internal |
| 652 } // namespace v8 | 644 } // namespace v8 |
| 653 | 645 |
| 654 #endif // V8_TARGET_ARCH_IA32 | 646 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |