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

Unified Diff: src/ic/call-optimization.cc

Issue 1609233002: Do not eagerly instantiate accessors' JSFunction. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Make GCMole happy again. Created 4 years, 10 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/ic/call-optimization.h ('k') | src/ic/ia32/handler-compiler-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic/call-optimization.cc
diff --git a/src/ic/call-optimization.cc b/src/ic/call-optimization.cc
index 45717b50a7bf6af607ac25a67023c167514166e3..94bf5eaf21dbb4d900fb98dbf6e4560f54fcdced 100644
--- a/src/ic/call-optimization.cc
+++ b/src/ic/call-optimization.cc
@@ -8,8 +8,16 @@
namespace v8 {
namespace internal {
-CallOptimization::CallOptimization(Handle<JSFunction> function) {
- Initialize(function);
+CallOptimization::CallOptimization(Handle<Object> function) {
+ constant_function_ = Handle<JSFunction>::null();
+ is_simple_api_call_ = false;
+ expected_receiver_type_ = Handle<FunctionTemplateInfo>::null();
+ api_call_info_ = Handle<CallHandlerInfo>::null();
+ if (function->IsJSFunction()) {
+ Initialize(Handle<JSFunction>::cast(function));
+ } else if (function->IsFunctionTemplateInfo()) {
+ Initialize(Handle<FunctionTemplateInfo>::cast(function));
+ }
}
@@ -80,13 +88,20 @@ bool CallOptimization::IsCompatibleReceiverMap(Handle<Map> map,
return false;
}
+void CallOptimization::Initialize(
+ Handle<FunctionTemplateInfo> function_template_info) {
+ if (function_template_info->call_code()->IsUndefined()) return;
+ api_call_info_ =
+ handle(CallHandlerInfo::cast(function_template_info->call_code()));
-void CallOptimization::Initialize(Handle<JSFunction> function) {
- constant_function_ = Handle<JSFunction>::null();
- is_simple_api_call_ = false;
- expected_receiver_type_ = Handle<FunctionTemplateInfo>::null();
- api_call_info_ = Handle<CallHandlerInfo>::null();
+ if (!function_template_info->signature()->IsUndefined()) {
+ expected_receiver_type_ =
+ handle(FunctionTemplateInfo::cast(function_template_info->signature()));
+ }
+ is_simple_api_call_ = true;
+}
+void CallOptimization::Initialize(Handle<JSFunction> function) {
if (function.is_null() || !function->is_compiled()) return;
constant_function_ = function;
« no previous file with comments | « src/ic/call-optimization.h ('k') | src/ic/ia32/handler-compiler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698