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

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

Issue 6344005: Introduce extra IC state to record additional feedback from IC-s. (Closed)
Patch Set: Moved the logic to runtime Created 9 years, 11 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
« no previous file with comments | « src/ia32/ic-ia32.cc ('k') | src/ic.h » ('j') | src/ic.cc » ('J')
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 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 Immediate(Handle<SharedFunctionInfo>(function->shared()))); 1355 Immediate(Handle<SharedFunctionInfo>(function->shared())));
1356 __ j(not_equal, miss, not_taken); 1356 __ j(not_equal, miss, not_taken);
1357 } else { 1357 } else {
1358 __ cmp(Operand(edi), Immediate(Handle<JSFunction>(function))); 1358 __ cmp(Operand(edi), Immediate(Handle<JSFunction>(function)));
1359 __ j(not_equal, miss, not_taken); 1359 __ j(not_equal, miss, not_taken);
1360 } 1360 }
1361 } 1361 }
1362 1362
1363 1363
1364 MaybeObject* CallStubCompiler::GenerateMissBranch() { 1364 MaybeObject* CallStubCompiler::GenerateMissBranch() {
1365 MaybeObject* maybe_obj = StubCache::ComputeCallMiss(arguments().immediate(),
1366 kind_,
1367 extra_ic_state_);
Mads Ager (chromium) 2011/01/18 11:28:57 Why do you need the extra_ic_state_ here? One miss
1365 Object* obj; 1368 Object* obj;
1366 { MaybeObject* maybe_obj = 1369 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1367 StubCache::ComputeCallMiss(arguments().immediate(), kind_);
1368 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1369 }
1370 __ jmp(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); 1370 __ jmp(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET);
1371 return obj; 1371 return obj;
1372 } 1372 }
1373 1373
1374 1374
1375 MUST_USE_RESULT MaybeObject* CallStubCompiler::CompileCallField( 1375 MUST_USE_RESULT MaybeObject* CallStubCompiler::CompileCallField(
1376 JSObject* object, 1376 JSObject* object,
1377 JSObject* holder, 1377 JSObject* holder,
1378 int index, 1378 int index,
1379 String* name) { 1379 String* name) {
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1679 // -- esp[(argc + 1) * 4] : receiver 1679 // -- esp[(argc + 1) * 4] : receiver
1680 // ----------------------------------- 1680 // -----------------------------------
1681 1681
1682 // If object is not a string, bail out to regular call. 1682 // If object is not a string, bail out to regular call.
1683 if (!object->IsString() || cell != NULL) return Heap::undefined_value(); 1683 if (!object->IsString() || cell != NULL) return Heap::undefined_value();
1684 1684
1685 const int argc = arguments().immediate(); 1685 const int argc = arguments().immediate();
1686 1686
1687 Label miss; 1687 Label miss;
1688 Label index_out_of_range; 1688 Label index_out_of_range;
1689 Label* index_out_of_range_label = &index_out_of_range;
1690
1691 if (kind_ == Code::CALL_IC && extra_ic_state_ == DEFAULT_STRING_STUB) {
1692 index_out_of_range_label = &miss;
1693 }
1689 1694
1690 GenerateNameCheck(name, &miss); 1695 GenerateNameCheck(name, &miss);
1691 1696
1692 // Check that the maps starting from the prototype haven't changed. 1697 // Check that the maps starting from the prototype haven't changed.
1693 GenerateDirectLoadGlobalFunctionPrototype(masm(), 1698 GenerateDirectLoadGlobalFunctionPrototype(masm(),
1694 Context::STRING_FUNCTION_INDEX, 1699 Context::STRING_FUNCTION_INDEX,
1695 eax, 1700 eax,
1696 &miss); 1701 &miss);
1697 ASSERT(object != holder); 1702 ASSERT(object != holder);
1698 CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder, 1703 CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder,
1699 ebx, edx, edi, name, &miss); 1704 ebx, edx, edi, name, &miss);
1700 1705
1701 Register receiver = ebx; 1706 Register receiver = ebx;
1702 Register index = edi; 1707 Register index = edi;
1703 Register scratch = edx; 1708 Register scratch = edx;
1704 Register result = eax; 1709 Register result = eax;
1705 __ mov(receiver, Operand(esp, (argc + 1) * kPointerSize)); 1710 __ mov(receiver, Operand(esp, (argc + 1) * kPointerSize));
1706 if (argc > 0) { 1711 if (argc > 0) {
1707 __ mov(index, Operand(esp, (argc - 0) * kPointerSize)); 1712 __ mov(index, Operand(esp, (argc - 0) * kPointerSize));
1708 } else { 1713 } else {
1709 __ Set(index, Immediate(Factory::undefined_value())); 1714 __ Set(index, Immediate(Factory::undefined_value()));
1710 } 1715 }
1711 1716
1712 StringCharCodeAtGenerator char_code_at_generator(receiver, 1717 StringCharCodeAtGenerator char_code_at_generator(receiver,
1713 index, 1718 index,
1714 scratch, 1719 scratch,
1715 result, 1720 result,
1716 &miss, // When not a string. 1721 &miss, // When not a string.
1717 &miss, // When not a number. 1722 &miss, // When not a number.
1718 &index_out_of_range, 1723 index_out_of_range_label,
1719 STRING_INDEX_IS_NUMBER); 1724 STRING_INDEX_IS_NUMBER);
1720 char_code_at_generator.GenerateFast(masm()); 1725 char_code_at_generator.GenerateFast(masm());
1721 __ ret((argc + 1) * kPointerSize); 1726 __ ret((argc + 1) * kPointerSize);
1722 1727
1723 StubRuntimeCallHelper call_helper; 1728 StubRuntimeCallHelper call_helper;
1724 char_code_at_generator.GenerateSlow(masm(), call_helper); 1729 char_code_at_generator.GenerateSlow(masm(), call_helper);
1725 1730
1726 __ bind(&index_out_of_range); 1731 if (index_out_of_range.is_linked()) {
1727 __ Set(eax, Immediate(Factory::nan_value())); 1732 __ bind(&index_out_of_range);
1728 __ ret((argc + 1) * kPointerSize); 1733 __ Set(eax, Immediate(Factory::nan_value()));
1734 __ ret((argc + 1) * kPointerSize);
1735 }
1729 1736
1730 __ bind(&miss); 1737 __ bind(&miss);
1738 if (kind_ == Code::CALL_IC) {
1739 // Restore function name in ecx.
1740 __ Set(ecx, Immediate(Handle<String>(name)));
1741 }
1731 Object* obj; 1742 Object* obj;
1732 { MaybeObject* maybe_obj = GenerateMissBranch(); 1743 { MaybeObject* maybe_obj = GenerateMissBranch();
1733 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 1744 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1734 } 1745 }
1735 1746
1736 // Return the generated code. 1747 // Return the generated code.
1737 return GetCode(function); 1748 return GetCode(function);
1738 } 1749 }
1739 1750
1740 1751
(...skipping 11 matching lines...) Expand all
1752 // -- esp[(argc + 1) * 4] : receiver 1763 // -- esp[(argc + 1) * 4] : receiver
1753 // ----------------------------------- 1764 // -----------------------------------
1754 1765
1755 // If object is not a string, bail out to regular call. 1766 // If object is not a string, bail out to regular call.
1756 if (!object->IsString() || cell != NULL) return Heap::undefined_value(); 1767 if (!object->IsString() || cell != NULL) return Heap::undefined_value();
1757 1768
1758 const int argc = arguments().immediate(); 1769 const int argc = arguments().immediate();
1759 1770
1760 Label miss; 1771 Label miss;
1761 Label index_out_of_range; 1772 Label index_out_of_range;
1773 Label* index_out_of_range_label = &index_out_of_range;
1774
1775 if (kind_ == Code::CALL_IC && extra_ic_state_ == DEFAULT_STRING_STUB) {
1776 index_out_of_range_label = &miss;
1777 }
1762 1778
1763 GenerateNameCheck(name, &miss); 1779 GenerateNameCheck(name, &miss);
1764 1780
1765 // Check that the maps starting from the prototype haven't changed. 1781 // Check that the maps starting from the prototype haven't changed.
1766 GenerateDirectLoadGlobalFunctionPrototype(masm(), 1782 GenerateDirectLoadGlobalFunctionPrototype(masm(),
1767 Context::STRING_FUNCTION_INDEX, 1783 Context::STRING_FUNCTION_INDEX,
1768 eax, 1784 eax,
1769 &miss); 1785 &miss);
1770 ASSERT(object != holder); 1786 ASSERT(object != holder);
1771 CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder, 1787 CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder,
(...skipping 11 matching lines...) Expand all
1783 __ Set(index, Immediate(Factory::undefined_value())); 1799 __ Set(index, Immediate(Factory::undefined_value()));
1784 } 1800 }
1785 1801
1786 StringCharAtGenerator char_at_generator(receiver, 1802 StringCharAtGenerator char_at_generator(receiver,
1787 index, 1803 index,
1788 scratch1, 1804 scratch1,
1789 scratch2, 1805 scratch2,
1790 result, 1806 result,
1791 &miss, // When not a string. 1807 &miss, // When not a string.
1792 &miss, // When not a number. 1808 &miss, // When not a number.
1793 &index_out_of_range, 1809 index_out_of_range_label,
1794 STRING_INDEX_IS_NUMBER); 1810 STRING_INDEX_IS_NUMBER);
1795 char_at_generator.GenerateFast(masm()); 1811 char_at_generator.GenerateFast(masm());
1796 __ ret((argc + 1) * kPointerSize); 1812 __ ret((argc + 1) * kPointerSize);
1797 1813
1798 StubRuntimeCallHelper call_helper; 1814 StubRuntimeCallHelper call_helper;
1799 char_at_generator.GenerateSlow(masm(), call_helper); 1815 char_at_generator.GenerateSlow(masm(), call_helper);
1800 1816
1801 __ bind(&index_out_of_range); 1817 if (index_out_of_range.is_linked()) {
1802 __ Set(eax, Immediate(Factory::empty_string())); 1818 __ bind(&index_out_of_range);
1803 __ ret((argc + 1) * kPointerSize); 1819 __ Set(eax, Immediate(Factory::empty_string()));
1820 __ ret((argc + 1) * kPointerSize);
1821 }
1804 1822
1805 __ bind(&miss); 1823 __ bind(&miss);
1824 if (kind_ == Code::CALL_IC) {
1825 // Restore function name in ecx.
1826 __ Set(ecx, Immediate(Handle<String>(name)));
1827 }
1806 Object* obj; 1828 Object* obj;
1807 { MaybeObject* maybe_obj = GenerateMissBranch(); 1829 { MaybeObject* maybe_obj = GenerateMissBranch();
1808 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 1830 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1809 } 1831 }
1810 1832
1811 // Return the generated code. 1833 // Return the generated code.
1812 return GetCode(function); 1834 return GetCode(function);
1813 } 1835 }
1814 1836
1815 1837
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after
3283 // Return the generated code. 3305 // Return the generated code.
3284 return GetCode(); 3306 return GetCode();
3285 } 3307 }
3286 3308
3287 3309
3288 #undef __ 3310 #undef __
3289 3311
3290 } } // namespace v8::internal 3312 } } // namespace v8::internal
3291 3313
3292 #endif // V8_TARGET_ARCH_IA32 3314 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/ic-ia32.cc ('k') | src/ic.h » ('j') | src/ic.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698