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

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

Issue 6686003: Refactor fast API call. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Next round Created 9 years, 9 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/stub-cache.h ('k') | src/x64/stub-cache-x64.cc » ('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 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 Code::ExtraICState extra_ic_state, 1719 Code::ExtraICState extra_ic_state,
1720 InlineCacheHolderFlag cache_holder) 1720 InlineCacheHolderFlag cache_holder)
1721 : arguments_(argc), 1721 : arguments_(argc),
1722 in_loop_(in_loop), 1722 in_loop_(in_loop),
1723 kind_(kind), 1723 kind_(kind),
1724 extra_ic_state_(extra_ic_state), 1724 extra_ic_state_(extra_ic_state),
1725 cache_holder_(cache_holder) { 1725 cache_holder_(cache_holder) {
1726 } 1726 }
1727 1727
1728 1728
1729 bool CallStubCompiler::HasCustomCallGenerator(BuiltinFunctionId id) { 1729 bool CallStubCompiler::HasCustomCallGenerator(JSFunction* function) {
1730 SharedFunctionInfo* info = function->shared();
1731 if (info->HasBuiltinFunctionId()) {
1732 BuiltinFunctionId id = info->builtin_function_id();
1730 #define CALL_GENERATOR_CASE(name) if (id == k##name) return true; 1733 #define CALL_GENERATOR_CASE(name) if (id == k##name) return true;
1731 CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE) 1734 CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE)
1732 #undef CALL_GENERATOR_CASE 1735 #undef CALL_GENERATOR_CASE
1736 }
1737 CallOptimization optimization(function);
1738 if (optimization.is_simple_api_call()) {
1739 return true;
1740 }
1733 return false; 1741 return false;
1734 } 1742 }
1735 1743
1736 1744
1737 MaybeObject* CallStubCompiler::CompileCustomCall(BuiltinFunctionId id, 1745 MaybeObject* CallStubCompiler::CompileCustomCall(Object* object,
1738 Object* object,
1739 JSObject* holder, 1746 JSObject* holder,
1740 JSGlobalPropertyCell* cell, 1747 JSGlobalPropertyCell* cell,
1741 JSFunction* function, 1748 JSFunction* function,
1742 String* fname) { 1749 String* fname) {
1743 #define CALL_GENERATOR_CASE(name) \ 1750 ASSERT(HasCustomCallGenerator(function));
1744 if (id == k##name) { \ 1751
1745 return CallStubCompiler::Compile##name##Call(object, \ 1752 SharedFunctionInfo* info = function->shared();
1746 holder, \ 1753 if (info->HasBuiltinFunctionId()) {
1747 cell, \ 1754 BuiltinFunctionId id = info->builtin_function_id();
1748 function, \ 1755 #define CALL_GENERATOR_CASE(name) \
1749 fname); \ 1756 if (id == k##name) { \
1757 return CallStubCompiler::Compile##name##Call(object, \
1758 holder, \
1759 cell, \
1760 function, \
1761 fname); \
1762 }
1763 CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE)
1764 #undef CALL_GENERATOR_CASE
1750 } 1765 }
1751 CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE) 1766 CallOptimization optimization(function);
1752 #undef CALL_GENERATOR_CASE 1767 ASSERT(optimization.is_simple_api_call());
1753 ASSERT(!HasCustomCallGenerator(id)); 1768 return CompileFastApiCall(optimization,
1754 return Heap::undefined_value(); 1769 object,
1770 holder,
1771 cell,
1772 function,
1773 fname);
1755 } 1774 }
1756 1775
1757 1776
1758 MaybeObject* CallStubCompiler::GetCode(PropertyType type, String* name) { 1777 MaybeObject* CallStubCompiler::GetCode(PropertyType type, String* name) {
1759 int argc = arguments_.immediate(); 1778 int argc = arguments_.immediate();
1760 Code::Flags flags = Code::ComputeMonomorphicFlags(kind_, 1779 Code::Flags flags = Code::ComputeMonomorphicFlags(kind_,
1761 type, 1780 type,
1762 extra_ic_state_, 1781 extra_ic_state_,
1763 cache_holder_, 1782 cache_holder_,
1764 in_loop_, 1783 in_loop_,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1863 if (!maybe_result->ToObject(&result)) return maybe_result; 1882 if (!maybe_result->ToObject(&result)) return maybe_result;
1864 } 1883 }
1865 Code* code = Code::cast(result); 1884 Code* code = Code::cast(result);
1866 USE(code); 1885 USE(code);
1867 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub")); 1886 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub"));
1868 return result; 1887 return result;
1869 } 1888 }
1870 1889
1871 1890
1872 } } // namespace v8::internal 1891 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698