| 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 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1773 Code::ExtraICState extra_ic_state, | 1773 Code::ExtraICState extra_ic_state, |
| 1774 InlineCacheHolderFlag cache_holder) | 1774 InlineCacheHolderFlag cache_holder) |
| 1775 : arguments_(argc), | 1775 : arguments_(argc), |
| 1776 in_loop_(in_loop), | 1776 in_loop_(in_loop), |
| 1777 kind_(kind), | 1777 kind_(kind), |
| 1778 extra_ic_state_(extra_ic_state), | 1778 extra_ic_state_(extra_ic_state), |
| 1779 cache_holder_(cache_holder) { | 1779 cache_holder_(cache_holder) { |
| 1780 } | 1780 } |
| 1781 | 1781 |
| 1782 | 1782 |
| 1783 bool CallStubCompiler::HasCustomCallGenerator(BuiltinFunctionId id) { | 1783 bool CallStubCompiler::HasCustomCallGenerator(JSFunction* function) { |
| 1784 SharedFunctionInfo* info = function->shared(); |
| 1785 if (info->HasBuiltinFunctionId()) { |
| 1786 BuiltinFunctionId id = info->builtin_function_id(); |
| 1784 #define CALL_GENERATOR_CASE(name) if (id == k##name) return true; | 1787 #define CALL_GENERATOR_CASE(name) if (id == k##name) return true; |
| 1785 CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE) | 1788 CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE) |
| 1786 #undef CALL_GENERATOR_CASE | 1789 #undef CALL_GENERATOR_CASE |
| 1790 } |
| 1791 CallOptimization optimization(function); |
| 1792 if (optimization.is_simple_api_call()) { |
| 1793 return true; |
| 1794 } |
| 1787 return false; | 1795 return false; |
| 1788 } | 1796 } |
| 1789 | 1797 |
| 1790 | 1798 |
| 1791 MaybeObject* CallStubCompiler::CompileCustomCall(BuiltinFunctionId id, | 1799 MaybeObject* CallStubCompiler::CompileCustomCall(Object* object, |
| 1792 Object* object, | |
| 1793 JSObject* holder, | 1800 JSObject* holder, |
| 1794 JSGlobalPropertyCell* cell, | 1801 JSGlobalPropertyCell* cell, |
| 1795 JSFunction* function, | 1802 JSFunction* function, |
| 1796 String* fname) { | 1803 String* fname) { |
| 1797 #define CALL_GENERATOR_CASE(name) \ | 1804 ASSERT(HasCustomCallGenerator(function)); |
| 1798 if (id == k##name) { \ | 1805 |
| 1799 return CallStubCompiler::Compile##name##Call(object, \ | 1806 SharedFunctionInfo* info = function->shared(); |
| 1800 holder, \ | 1807 if (info->HasBuiltinFunctionId()) { |
| 1801 cell, \ | 1808 BuiltinFunctionId id = info->builtin_function_id(); |
| 1802 function, \ | 1809 #define CALL_GENERATOR_CASE(name) \ |
| 1803 fname); \ | 1810 if (id == k##name) { \ |
| 1811 return CallStubCompiler::Compile##name##Call(object, \ |
| 1812 holder, \ |
| 1813 cell, \ |
| 1814 function, \ |
| 1815 fname); \ |
| 1816 } |
| 1817 CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE) |
| 1818 #undef CALL_GENERATOR_CASE |
| 1804 } | 1819 } |
| 1805 CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE) | 1820 CallOptimization optimization(function); |
| 1806 #undef CALL_GENERATOR_CASE | 1821 ASSERT(optimization.is_simple_api_call()); |
| 1807 ASSERT(!HasCustomCallGenerator(id)); | 1822 return CompileFastApiCall(optimization, |
| 1808 return HEAP->undefined_value(); | 1823 object, |
| 1824 holder, |
| 1825 cell, |
| 1826 function, |
| 1827 fname); |
| 1809 } | 1828 } |
| 1810 | 1829 |
| 1811 | 1830 |
| 1812 MaybeObject* CallStubCompiler::GetCode(PropertyType type, String* name) { | 1831 MaybeObject* CallStubCompiler::GetCode(PropertyType type, String* name) { |
| 1813 int argc = arguments_.immediate(); | 1832 int argc = arguments_.immediate(); |
| 1814 Code::Flags flags = Code::ComputeMonomorphicFlags(kind_, | 1833 Code::Flags flags = Code::ComputeMonomorphicFlags(kind_, |
| 1815 type, | 1834 type, |
| 1816 extra_ic_state_, | 1835 extra_ic_state_, |
| 1817 cache_holder_, | 1836 cache_holder_, |
| 1818 in_loop_, | 1837 in_loop_, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1918 } | 1937 } |
| 1919 Code* code = Code::cast(result); | 1938 Code* code = Code::cast(result); |
| 1920 USE(code); | 1939 USE(code); |
| 1921 PROFILE(isolate(), | 1940 PROFILE(isolate(), |
| 1922 CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub")); | 1941 CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub")); |
| 1923 return result; | 1942 return result; |
| 1924 } | 1943 } |
| 1925 | 1944 |
| 1926 | 1945 |
| 1927 } } // namespace v8::internal | 1946 } } // namespace v8::internal |
| OLD | NEW |