OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1564 String* name, | 1564 String* name, |
1565 CheckType check) { | 1565 CheckType check) { |
1566 // ----------- S t a t e ------------- | 1566 // ----------- S t a t e ------------- |
1567 // -- ecx : function name | 1567 // -- ecx : function name |
1568 // -- esp[0] : return address | 1568 // -- esp[0] : return address |
1569 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 1569 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
1570 // -- ... | 1570 // -- ... |
1571 // -- esp[(argc + 1) * 4] : receiver | 1571 // -- esp[(argc + 1) * 4] : receiver |
1572 // ----------------------------------- | 1572 // ----------------------------------- |
1573 | 1573 |
| 1574 // If object is not a string, bail out to regular call. |
| 1575 if (!object->IsString()) return Heap::undefined_value(); |
| 1576 |
1574 const int argc = arguments().immediate(); | 1577 const int argc = arguments().immediate(); |
1575 | 1578 |
1576 Label miss; | 1579 Label miss; |
1577 Label index_out_of_range; | 1580 Label index_out_of_range; |
1578 GenerateNameCheck(name, &miss); | 1581 GenerateNameCheck(name, &miss); |
1579 | 1582 |
1580 // Check that the maps starting from the prototype haven't changed. | 1583 // Check that the maps starting from the prototype haven't changed. |
1581 GenerateDirectLoadGlobalFunctionPrototype(masm(), | 1584 GenerateDirectLoadGlobalFunctionPrototype(masm(), |
1582 Context::STRING_FUNCTION_INDEX, | 1585 Context::STRING_FUNCTION_INDEX, |
1583 eax); | 1586 eax); |
| 1587 ASSERT(object != holder); |
1584 CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder, | 1588 CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder, |
1585 ebx, edx, edi, name, &miss); | 1589 ebx, edx, edi, name, &miss); |
1586 | 1590 |
1587 Register receiver = ebx; | 1591 Register receiver = ebx; |
1588 Register index = edi; | 1592 Register index = edi; |
1589 Register scratch = edx; | 1593 Register scratch = edx; |
1590 Register result = eax; | 1594 Register result = eax; |
1591 __ mov(receiver, Operand(esp, (argc + 1) * kPointerSize)); | 1595 __ mov(receiver, Operand(esp, (argc + 1) * kPointerSize)); |
1592 if (argc > 0) { | 1596 if (argc > 0) { |
1593 __ mov(index, Operand(esp, (argc - 0) * kPointerSize)); | 1597 __ mov(index, Operand(esp, (argc - 0) * kPointerSize)); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1628 String* name, | 1632 String* name, |
1629 CheckType check) { | 1633 CheckType check) { |
1630 // ----------- S t a t e ------------- | 1634 // ----------- S t a t e ------------- |
1631 // -- ecx : function name | 1635 // -- ecx : function name |
1632 // -- esp[0] : return address | 1636 // -- esp[0] : return address |
1633 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 1637 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
1634 // -- ... | 1638 // -- ... |
1635 // -- esp[(argc + 1) * 4] : receiver | 1639 // -- esp[(argc + 1) * 4] : receiver |
1636 // ----------------------------------- | 1640 // ----------------------------------- |
1637 | 1641 |
| 1642 // If object is not a string, bail out to regular call. |
| 1643 if (!object->IsString()) return Heap::undefined_value(); |
| 1644 |
1638 const int argc = arguments().immediate(); | 1645 const int argc = arguments().immediate(); |
1639 | 1646 |
1640 Label miss; | 1647 Label miss; |
1641 Label index_out_of_range; | 1648 Label index_out_of_range; |
1642 | 1649 |
1643 GenerateNameCheck(name, &miss); | 1650 GenerateNameCheck(name, &miss); |
1644 | 1651 |
1645 // Check that the maps starting from the prototype haven't changed. | 1652 // Check that the maps starting from the prototype haven't changed. |
1646 GenerateDirectLoadGlobalFunctionPrototype(masm(), | 1653 GenerateDirectLoadGlobalFunctionPrototype(masm(), |
1647 Context::STRING_FUNCTION_INDEX, | 1654 Context::STRING_FUNCTION_INDEX, |
1648 eax); | 1655 eax); |
| 1656 ASSERT(object != holder); |
1649 CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder, | 1657 CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder, |
1650 ebx, edx, edi, name, &miss); | 1658 ebx, edx, edi, name, &miss); |
1651 | 1659 |
1652 Register receiver = eax; | 1660 Register receiver = eax; |
1653 Register index = edi; | 1661 Register index = edi; |
1654 Register scratch1 = ebx; | 1662 Register scratch1 = ebx; |
1655 Register scratch2 = edx; | 1663 Register scratch2 = edx; |
1656 Register result = eax; | 1664 Register result = eax; |
1657 __ mov(receiver, Operand(esp, (argc + 1) * kPointerSize)); | 1665 __ mov(receiver, Operand(esp, (argc + 1) * kPointerSize)); |
1658 if (argc > 0) { | 1666 if (argc > 0) { |
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2723 // Return the generated code. | 2731 // Return the generated code. |
2724 return GetCode(); | 2732 return GetCode(); |
2725 } | 2733 } |
2726 | 2734 |
2727 | 2735 |
2728 #undef __ | 2736 #undef __ |
2729 | 2737 |
2730 } } // namespace v8::internal | 2738 } } // namespace v8::internal |
2731 | 2739 |
2732 #endif // V8_TARGET_ARCH_IA32 | 2740 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |