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); |
} |