Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: src/ia32/stub-cache-ia32.cc

Issue 3462001: Bring r5483 "Fix direct loading of global function prototypes" to 2.3. (Closed) Base URL: http://v8.googlecode.com/svn/branches/2.3/
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/stub-cache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 __ mov(prototype, Operand(prototype, Context::SlotOffset(index))); 266 __ mov(prototype, Operand(prototype, Context::SlotOffset(index)));
267 // Load the initial map. The global functions all have initial maps. 267 // Load the initial map. The global functions all have initial maps.
268 __ mov(prototype, 268 __ mov(prototype,
269 FieldOperand(prototype, JSFunction::kPrototypeOrInitialMapOffset)); 269 FieldOperand(prototype, JSFunction::kPrototypeOrInitialMapOffset));
270 // Load the prototype from the initial map. 270 // Load the prototype from the initial map.
271 __ mov(prototype, FieldOperand(prototype, Map::kPrototypeOffset)); 271 __ mov(prototype, FieldOperand(prototype, Map::kPrototypeOffset));
272 } 272 }
273 273
274 274
275 void StubCompiler::GenerateDirectLoadGlobalFunctionPrototype( 275 void StubCompiler::GenerateDirectLoadGlobalFunctionPrototype(
276 MacroAssembler* masm, int index, Register prototype) { 276 MacroAssembler* masm, int index, Register prototype, Label* miss) {
277 // Check we're still in the same context.
278 __ cmp(Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)),
279 Top::global());
280 __ j(not_equal, miss);
277 // Get the global function with the given index. 281 // Get the global function with the given index.
278 JSFunction* function = JSFunction::cast(Top::global_context()->get(index)); 282 JSFunction* function = JSFunction::cast(Top::global_context()->get(index));
279 // Load its initial map. The global functions all have initial maps. 283 // Load its initial map. The global functions all have initial maps.
280 __ Set(prototype, Immediate(Handle<Map>(function->initial_map()))); 284 __ Set(prototype, Immediate(Handle<Map>(function->initial_map())));
281 // Load the prototype from the initial map. 285 // Load the prototype from the initial map.
282 __ mov(prototype, FieldOperand(prototype, Map::kPrototypeOffset)); 286 __ mov(prototype, FieldOperand(prototype, Map::kPrototypeOffset));
283 } 287 }
284 288
285 289
286 void StubCompiler::GenerateLoadArrayLength(MacroAssembler* masm, 290 void StubCompiler::GenerateLoadArrayLength(MacroAssembler* masm,
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 1581
1578 const int argc = arguments().immediate(); 1582 const int argc = arguments().immediate();
1579 1583
1580 Label miss; 1584 Label miss;
1581 Label index_out_of_range; 1585 Label index_out_of_range;
1582 GenerateNameCheck(name, &miss); 1586 GenerateNameCheck(name, &miss);
1583 1587
1584 // Check that the maps starting from the prototype haven't changed. 1588 // Check that the maps starting from the prototype haven't changed.
1585 GenerateDirectLoadGlobalFunctionPrototype(masm(), 1589 GenerateDirectLoadGlobalFunctionPrototype(masm(),
1586 Context::STRING_FUNCTION_INDEX, 1590 Context::STRING_FUNCTION_INDEX,
1587 eax); 1591 eax,
1592 &miss);
1588 ASSERT(object != holder); 1593 ASSERT(object != holder);
1589 CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder, 1594 CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder,
1590 ebx, edx, edi, name, &miss); 1595 ebx, edx, edi, name, &miss);
1591 1596
1592 Register receiver = ebx; 1597 Register receiver = ebx;
1593 Register index = edi; 1598 Register index = edi;
1594 Register scratch = edx; 1599 Register scratch = edx;
1595 Register result = eax; 1600 Register result = eax;
1596 __ mov(receiver, Operand(esp, (argc + 1) * kPointerSize)); 1601 __ mov(receiver, Operand(esp, (argc + 1) * kPointerSize));
1597 if (argc > 0) { 1602 if (argc > 0) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 const int argc = arguments().immediate(); 1651 const int argc = arguments().immediate();
1647 1652
1648 Label miss; 1653 Label miss;
1649 Label index_out_of_range; 1654 Label index_out_of_range;
1650 1655
1651 GenerateNameCheck(name, &miss); 1656 GenerateNameCheck(name, &miss);
1652 1657
1653 // Check that the maps starting from the prototype haven't changed. 1658 // Check that the maps starting from the prototype haven't changed.
1654 GenerateDirectLoadGlobalFunctionPrototype(masm(), 1659 GenerateDirectLoadGlobalFunctionPrototype(masm(),
1655 Context::STRING_FUNCTION_INDEX, 1660 Context::STRING_FUNCTION_INDEX,
1656 eax); 1661 eax,
1662 &miss);
1657 ASSERT(object != holder); 1663 ASSERT(object != holder);
1658 CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder, 1664 CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder,
1659 ebx, edx, edi, name, &miss); 1665 ebx, edx, edi, name, &miss);
1660 1666
1661 Register receiver = eax; 1667 Register receiver = eax;
1662 Register index = edi; 1668 Register index = edi;
1663 Register scratch1 = ebx; 1669 Register scratch1 = ebx;
1664 Register scratch2 = edx; 1670 Register scratch2 = edx;
1665 Register result = eax; 1671 Register result = eax;
1666 __ mov(receiver, Operand(esp, (argc + 1) * kPointerSize)); 1672 __ mov(receiver, Operand(esp, (argc + 1) * kPointerSize));
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 case STRING_CHECK: 1780 case STRING_CHECK:
1775 if (!function->IsBuiltin()) { 1781 if (!function->IsBuiltin()) {
1776 // Calling non-builtins with a value as receiver requires boxing. 1782 // Calling non-builtins with a value as receiver requires boxing.
1777 __ jmp(&miss); 1783 __ jmp(&miss);
1778 } else { 1784 } else {
1779 // Check that the object is a string or a symbol. 1785 // Check that the object is a string or a symbol.
1780 __ CmpObjectType(edx, FIRST_NONSTRING_TYPE, eax); 1786 __ CmpObjectType(edx, FIRST_NONSTRING_TYPE, eax);
1781 __ j(above_equal, &miss, not_taken); 1787 __ j(above_equal, &miss, not_taken);
1782 // Check that the maps starting from the prototype haven't changed. 1788 // Check that the maps starting from the prototype haven't changed.
1783 GenerateDirectLoadGlobalFunctionPrototype( 1789 GenerateDirectLoadGlobalFunctionPrototype(
1784 masm(), Context::STRING_FUNCTION_INDEX, eax); 1790 masm(), Context::STRING_FUNCTION_INDEX, eax, &miss);
1785 CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder, 1791 CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder,
1786 ebx, edx, edi, name, &miss); 1792 ebx, edx, edi, name, &miss);
1787 } 1793 }
1788 break; 1794 break;
1789 1795
1790 case NUMBER_CHECK: { 1796 case NUMBER_CHECK: {
1791 if (!function->IsBuiltin()) { 1797 if (!function->IsBuiltin()) {
1792 // Calling non-builtins with a value as receiver requires boxing. 1798 // Calling non-builtins with a value as receiver requires boxing.
1793 __ jmp(&miss); 1799 __ jmp(&miss);
1794 } else { 1800 } else {
1795 Label fast; 1801 Label fast;
1796 // Check that the object is a smi or a heap number. 1802 // Check that the object is a smi or a heap number.
1797 __ test(edx, Immediate(kSmiTagMask)); 1803 __ test(edx, Immediate(kSmiTagMask));
1798 __ j(zero, &fast, taken); 1804 __ j(zero, &fast, taken);
1799 __ CmpObjectType(edx, HEAP_NUMBER_TYPE, eax); 1805 __ CmpObjectType(edx, HEAP_NUMBER_TYPE, eax);
1800 __ j(not_equal, &miss, not_taken); 1806 __ j(not_equal, &miss, not_taken);
1801 __ bind(&fast); 1807 __ bind(&fast);
1802 // Check that the maps starting from the prototype haven't changed. 1808 // Check that the maps starting from the prototype haven't changed.
1803 GenerateDirectLoadGlobalFunctionPrototype( 1809 GenerateDirectLoadGlobalFunctionPrototype(
1804 masm(), Context::NUMBER_FUNCTION_INDEX, eax); 1810 masm(), Context::NUMBER_FUNCTION_INDEX, eax, &miss);
1805 CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder, 1811 CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder,
1806 ebx, edx, edi, name, &miss); 1812 ebx, edx, edi, name, &miss);
1807 } 1813 }
1808 break; 1814 break;
1809 } 1815 }
1810 1816
1811 case BOOLEAN_CHECK: { 1817 case BOOLEAN_CHECK: {
1812 if (!function->IsBuiltin()) { 1818 if (!function->IsBuiltin()) {
1813 // Calling non-builtins with a value as receiver requires boxing. 1819 // Calling non-builtins with a value as receiver requires boxing.
1814 __ jmp(&miss); 1820 __ jmp(&miss);
1815 } else { 1821 } else {
1816 Label fast; 1822 Label fast;
1817 // Check that the object is a boolean. 1823 // Check that the object is a boolean.
1818 __ cmp(edx, Factory::true_value()); 1824 __ cmp(edx, Factory::true_value());
1819 __ j(equal, &fast, taken); 1825 __ j(equal, &fast, taken);
1820 __ cmp(edx, Factory::false_value()); 1826 __ cmp(edx, Factory::false_value());
1821 __ j(not_equal, &miss, not_taken); 1827 __ j(not_equal, &miss, not_taken);
1822 __ bind(&fast); 1828 __ bind(&fast);
1823 // Check that the maps starting from the prototype haven't changed. 1829 // Check that the maps starting from the prototype haven't changed.
1824 GenerateDirectLoadGlobalFunctionPrototype( 1830 GenerateDirectLoadGlobalFunctionPrototype(
1825 masm(), Context::BOOLEAN_FUNCTION_INDEX, eax); 1831 masm(), Context::BOOLEAN_FUNCTION_INDEX, eax, &miss);
1826 CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder, 1832 CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder,
1827 ebx, edx, edi, name, &miss); 1833 ebx, edx, edi, name, &miss);
1828 } 1834 }
1829 break; 1835 break;
1830 } 1836 }
1831 1837
1832 default: 1838 default:
1833 UNREACHABLE(); 1839 UNREACHABLE();
1834 } 1840 }
1835 1841
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
2732 // Return the generated code. 2738 // Return the generated code.
2733 return GetCode(); 2739 return GetCode();
2734 } 2740 }
2735 2741
2736 2742
2737 #undef __ 2743 #undef __
2738 2744
2739 } } // namespace v8::internal 2745 } } // namespace v8::internal
2740 2746
2741 #endif // V8_TARGET_ARCH_IA32 2747 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698