| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/ic/call-optimization.h" | 7 #include "src/ic/call-optimization.h" |
| 8 | 8 |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 AnalyzePossibleApiFunction(function); | 85 AnalyzePossibleApiFunction(function); |
| 86 } | 86 } |
| 87 | 87 |
| 88 | 88 |
| 89 void CallOptimization::AnalyzePossibleApiFunction(Handle<JSFunction> function) { | 89 void CallOptimization::AnalyzePossibleApiFunction(Handle<JSFunction> function) { |
| 90 if (!function->shared()->IsApiFunction()) return; | 90 if (!function->shared()->IsApiFunction()) return; |
| 91 Handle<FunctionTemplateInfo> info(function->shared()->get_api_func_data()); | 91 Handle<FunctionTemplateInfo> info(function->shared()->get_api_func_data()); |
| 92 | 92 |
| 93 // Require a C++ callback. | 93 // Require a C++ callback. |
| 94 if (info->call_code()->IsUndefined()) return; | 94 if (info->call_code()->IsUndefined()) return; |
| 95 api_call_info_ = | 95 api_call_info_ = handle(CallHandlerInfo::cast(info->call_code())); |
| 96 Handle<CallHandlerInfo>(CallHandlerInfo::cast(info->call_code())); | |
| 97 | 96 |
| 98 // Accept signatures that either have no restrictions at all or | |
| 99 // only have restrictions on the receiver. | |
| 100 if (!info->signature()->IsUndefined()) { | 97 if (!info->signature()->IsUndefined()) { |
| 101 Handle<SignatureInfo> signature = | 98 expected_receiver_type_ = |
| 102 Handle<SignatureInfo>(SignatureInfo::cast(info->signature())); | 99 handle(FunctionTemplateInfo::cast(info->signature())); |
| 103 if (!signature->args()->IsUndefined()) return; | |
| 104 if (!signature->receiver()->IsUndefined()) { | |
| 105 expected_receiver_type_ = Handle<FunctionTemplateInfo>( | |
| 106 FunctionTemplateInfo::cast(signature->receiver())); | |
| 107 } | |
| 108 } | 100 } |
| 109 | 101 |
| 110 is_simple_api_call_ = true; | 102 is_simple_api_call_ = true; |
| 111 } | 103 } |
| 112 } | 104 } |
| 113 } // namespace v8::internal | 105 } // namespace v8::internal |
| OLD | NEW |