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 2979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2990 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); | 2990 __ mov(edx, FieldOperand(eax, HeapObject::kMapOffset)); |
2991 __ movzx_b(edi, FieldOperand(edx, Map::kInstanceTypeOffset)); | 2991 __ movzx_b(edi, FieldOperand(edx, Map::kInstanceTypeOffset)); |
2992 // We don't handle non-strings. | 2992 // We don't handle non-strings. |
2993 __ test(edi, Immediate(kIsNotStringMask)); | 2993 __ test(edi, Immediate(kIsNotStringMask)); |
2994 __ j(not_zero, &slow_case, not_taken); | 2994 __ j(not_zero, &slow_case, not_taken); |
2995 | 2995 |
2996 // Here we make assumptions about the tag values and the shifts needed. | 2996 // Here we make assumptions about the tag values and the shifts needed. |
2997 // See the comment in objects.h. | 2997 // See the comment in objects.h. |
2998 ASSERT(kLongStringTag == 0); | 2998 ASSERT(kLongStringTag == 0); |
2999 ASSERT(kMediumStringTag + String::kLongLengthShift == | 2999 ASSERT(kMediumStringTag + String::kLongLengthShift == |
3000 String::kMediumLengthShift); | 3000 String::kMediumLengthShift); |
3001 ASSERT(kShortStringTag + String::kLongLengthShift == | 3001 ASSERT(kShortStringTag + String::kLongLengthShift == |
3002 String::kShortLengthShift); | 3002 String::kShortLengthShift); |
3003 __ mov(ecx, Operand(edi)); | 3003 __ mov(ecx, Operand(edi)); |
3004 __ and_(ecx, kStringSizeMask); | 3004 __ and_(ecx, kStringSizeMask); |
3005 __ add(Operand(ecx), Immediate(String::kLongLengthShift)); | 3005 __ add(Operand(ecx), Immediate(String::kLongLengthShift)); |
3006 // Get the length field. | 3006 // Get the length field. |
3007 __ mov(edx, FieldOperand(eax, String::kLengthOffset)); | 3007 __ mov(edx, FieldOperand(eax, String::kLengthOffset)); |
3008 __ shr(edx); // ecx is implicit operand. | 3008 __ shr(edx); // ecx is implicit operand. |
3009 // edx is now the length of the string. | 3009 // edx is now the length of the string. |
3010 | 3010 |
3011 // Check for index out of range. | 3011 // Check for index out of range. |
3012 __ cmp(ebx, Operand(edx)); | 3012 __ cmp(ebx, Operand(edx)); |
(...skipping 2318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5331 | 5331 |
5332 // Slow-case: Go through the JavaScript implementation. | 5332 // Slow-case: Go through the JavaScript implementation. |
5333 __ bind(&slow); | 5333 __ bind(&slow); |
5334 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 5334 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
5335 } | 5335 } |
5336 | 5336 |
5337 | 5337 |
5338 #undef __ | 5338 #undef __ |
5339 | 5339 |
5340 } } // namespace v8::internal | 5340 } } // namespace v8::internal |
OLD | NEW |