| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 2901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2912 ASSERT(args->length() == 2); | 2912 ASSERT(args->length() == 2); |
| 2913 | 2913 |
| 2914 Label slow_case; | 2914 Label slow_case; |
| 2915 Label end; | 2915 Label end; |
| 2916 Label not_a_flat_string; | 2916 Label not_a_flat_string; |
| 2917 Label not_a_cons_string_either; | 2917 Label not_a_cons_string_either; |
| 2918 Label try_again_with_new_string; | 2918 Label try_again_with_new_string; |
| 2919 Label ascii_string; | 2919 Label ascii_string; |
| 2920 Label got_char_code; | 2920 Label got_char_code; |
| 2921 | 2921 |
| 2922 // Load the string into eax. | 2922 // Load the string into eax and the index into ebx. |
| 2923 Load(args->at(0)); | 2923 Load(args->at(0)); |
| 2924 Load(args->at(1)); |
| 2925 frame_->Pop(ebx); |
| 2924 frame_->Pop(eax); | 2926 frame_->Pop(eax); |
| 2925 // If the receiver is a smi return undefined. | 2927 // If the receiver is a smi return undefined. |
| 2926 ASSERT(kSmiTag == 0); | 2928 ASSERT(kSmiTag == 0); |
| 2927 __ test(eax, Immediate(kSmiTagMask)); | 2929 __ test(eax, Immediate(kSmiTagMask)); |
| 2928 __ j(zero, &slow_case, not_taken); | 2930 __ j(zero, &slow_case, not_taken); |
| 2929 | 2931 |
| 2930 // Load the index into ebx. | |
| 2931 Load(args->at(1)); | |
| 2932 frame_->Pop(ebx); | |
| 2933 | |
| 2934 // Check for negative or non-smi index. | 2932 // Check for negative or non-smi index. |
| 2935 ASSERT(kSmiTag == 0); | 2933 ASSERT(kSmiTag == 0); |
| 2936 __ test(ebx, Immediate(kSmiTagMask | 0x80000000)); | 2934 __ test(ebx, Immediate(kSmiTagMask | 0x80000000)); |
| 2937 __ j(not_zero, &slow_case, not_taken); | 2935 __ j(not_zero, &slow_case, not_taken); |
| 2938 // Get rid of the smi tag on the index. | 2936 // Get rid of the smi tag on the index. |
| 2939 __ sar(ebx, kSmiTagSize); | 2937 __ sar(ebx, kSmiTagSize); |
| 2940 | 2938 |
| 2941 __ bind(&try_again_with_new_string); | 2939 __ bind(&try_again_with_new_string); |
| 2942 // Get the type of the heap object into edi. | 2940 // Get the type of the heap object into edi. |
| 2943 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); | 2941 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); |
| (...skipping 2257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5201 | 5199 |
| 5202 // Slow-case: Go through the JavaScript implementation. | 5200 // Slow-case: Go through the JavaScript implementation. |
| 5203 __ bind(&slow); | 5201 __ bind(&slow); |
| 5204 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 5202 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
| 5205 } | 5203 } |
| 5206 | 5204 |
| 5207 | 5205 |
| 5208 #undef __ | 5206 #undef __ |
| 5209 | 5207 |
| 5210 } } // namespace v8::internal | 5208 } } // namespace v8::internal |
| OLD | NEW |