OLD | NEW |
---|---|
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 3760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3771 __ Integer32ToSmi(temp.reg(), temp.reg()); | 3771 __ Integer32ToSmi(temp.reg(), temp.reg()); |
3772 __ jmp(&end); | 3772 __ jmp(&end); |
3773 | 3773 |
3774 // Handle non-flat strings. | 3774 // Handle non-flat strings. |
3775 __ bind(¬_a_flat_string); | 3775 __ bind(¬_a_flat_string); |
3776 __ and_(temp.reg(), Immediate(kStringRepresentationMask)); | 3776 __ and_(temp.reg(), Immediate(kStringRepresentationMask)); |
3777 __ cmpb(temp.reg(), Immediate(kConsStringTag)); | 3777 __ cmpb(temp.reg(), Immediate(kConsStringTag)); |
3778 __ j(not_equal, &slow_case); | 3778 __ j(not_equal, &slow_case); |
3779 | 3779 |
3780 // ConsString. | 3780 // ConsString. |
3781 // Check that the right hand side is the empty string (ie if this is really a | |
3782 // flat string in a cons string). If that is not the case we would rather go | |
3783 // to the runtime system now, to flatten the string. | |
3784 __ movq(temp.reg(), FieldOperand(object.reg(), ConsString::kSecondOffset)); | |
3785 __ CompareRoot(temp.reg(), Heap::kEmptyStringRootIndex); | |
Lasse Reichstein
2009/11/17 10:08:20
Is a memory read really more efficient than an ext
| |
3786 __ j(not_equal, &slow_case); | |
3781 // Get the first of the two strings. | 3787 // Get the first of the two strings. |
3782 __ movq(object.reg(), FieldOperand(object.reg(), ConsString::kFirstOffset)); | 3788 __ movq(object.reg(), FieldOperand(object.reg(), ConsString::kFirstOffset)); |
3783 __ jmp(&try_again_with_new_string); | 3789 __ jmp(&try_again_with_new_string); |
3784 | 3790 |
3785 __ bind(&slow_case); | 3791 __ bind(&slow_case); |
3786 // Move the undefined value into the result register, which will | 3792 // Move the undefined value into the result register, which will |
3787 // trigger the slow case. | 3793 // trigger the slow case. |
3788 __ LoadRoot(temp.reg(), Heap::kUndefinedValueRootIndex); | 3794 __ LoadRoot(temp.reg(), Heap::kUndefinedValueRootIndex); |
3789 | 3795 |
3790 __ bind(&end); | 3796 __ bind(&end); |
(...skipping 4046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7837 masm.GetCode(&desc); | 7843 masm.GetCode(&desc); |
7838 // Call the function from C++. | 7844 // Call the function from C++. |
7839 return FUNCTION_CAST<ModuloFunction>(buffer); | 7845 return FUNCTION_CAST<ModuloFunction>(buffer); |
7840 } | 7846 } |
7841 | 7847 |
7842 #endif | 7848 #endif |
7843 | 7849 |
7844 #undef __ | 7850 #undef __ |
7845 | 7851 |
7846 } } // namespace v8::internal | 7852 } } // namespace v8::internal |
OLD | NEW |