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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/stub-cache.cc
diff --git a/src/stub-cache.cc b/src/stub-cache.cc
index 91d4c707594ad22ec0514f250584a8d0e9d605ca..789dafd89ae1eacded7da8a79e7e8d18ffb2bdda 100644
--- a/src/stub-cache.cc
+++ b/src/stub-cache.cc
@@ -1726,32 +1726,51 @@ CallStubCompiler::CallStubCompiler(int argc,
}
-bool CallStubCompiler::HasCustomCallGenerator(BuiltinFunctionId id) {
+bool CallStubCompiler::HasCustomCallGenerator(JSFunction* function) {
+ SharedFunctionInfo* info = function->shared();
+ if (info->HasBuiltinFunctionId()) {
+ BuiltinFunctionId id = info->builtin_function_id();
#define CALL_GENERATOR_CASE(name) if (id == k##name) return true;
- CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE)
+ CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE)
#undef CALL_GENERATOR_CASE
+ }
+ CallOptimization optimization(function);
+ if (optimization.is_simple_api_call()) {
+ return true;
+ }
return false;
}
-MaybeObject* CallStubCompiler::CompileCustomCall(BuiltinFunctionId id,
- Object* object,
+MaybeObject* CallStubCompiler::CompileCustomCall(Object* object,
JSObject* holder,
JSGlobalPropertyCell* cell,
JSFunction* function,
String* fname) {
-#define CALL_GENERATOR_CASE(name) \
- if (id == k##name) { \
- return CallStubCompiler::Compile##name##Call(object, \
- holder, \
- cell, \
- function, \
- fname); \
- }
- CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE)
+ ASSERT(HasCustomCallGenerator(function));
+
+ SharedFunctionInfo* info = function->shared();
+ if (info->HasBuiltinFunctionId()) {
+ BuiltinFunctionId id = info->builtin_function_id();
+#define CALL_GENERATOR_CASE(name) \
+ if (id == k##name) { \
+ return CallStubCompiler::Compile##name##Call(object, \
+ holder, \
+ cell, \
+ function, \
+ fname); \
+ }
+ CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE)
#undef CALL_GENERATOR_CASE
- ASSERT(!HasCustomCallGenerator(id));
- return Heap::undefined_value();
+ }
+ CallOptimization optimization(function);
+ ASSERT(optimization.is_simple_api_call());
+ return CompileFastApiCall(optimization,
+ object,
+ holder,
+ cell,
+ function,
+ fname);
}
« 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