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/ic/call-optimization.h" | 5 #include "src/ic/call-optimization.h" |
6 | 6 |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 | 10 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 82 } |
83 } | 83 } |
84 break; | 84 break; |
85 } | 85 } |
86 UNREACHABLE(); | 86 UNREACHABLE(); |
87 return false; | 87 return false; |
88 } | 88 } |
89 | 89 |
90 void CallOptimization::Initialize( | 90 void CallOptimization::Initialize( |
91 Handle<FunctionTemplateInfo> function_template_info) { | 91 Handle<FunctionTemplateInfo> function_template_info) { |
92 if (function_template_info->call_code()->IsUndefined()) return; | 92 Isolate* isolate = function_template_info->GetIsolate(); |
| 93 if (function_template_info->call_code()->IsUndefined(isolate)) return; |
93 api_call_info_ = | 94 api_call_info_ = |
94 handle(CallHandlerInfo::cast(function_template_info->call_code())); | 95 handle(CallHandlerInfo::cast(function_template_info->call_code())); |
95 | 96 |
96 if (!function_template_info->signature()->IsUndefined()) { | 97 if (!function_template_info->signature()->IsUndefined(isolate)) { |
97 expected_receiver_type_ = | 98 expected_receiver_type_ = |
98 handle(FunctionTemplateInfo::cast(function_template_info->signature())); | 99 handle(FunctionTemplateInfo::cast(function_template_info->signature())); |
99 } | 100 } |
100 is_simple_api_call_ = true; | 101 is_simple_api_call_ = true; |
101 } | 102 } |
102 | 103 |
103 void CallOptimization::Initialize(Handle<JSFunction> function) { | 104 void CallOptimization::Initialize(Handle<JSFunction> function) { |
104 if (function.is_null() || !function->is_compiled()) return; | 105 if (function.is_null() || !function->is_compiled()) return; |
105 | 106 |
106 constant_function_ = function; | 107 constant_function_ = function; |
107 AnalyzePossibleApiFunction(function); | 108 AnalyzePossibleApiFunction(function); |
108 } | 109 } |
109 | 110 |
110 | 111 |
111 void CallOptimization::AnalyzePossibleApiFunction(Handle<JSFunction> function) { | 112 void CallOptimization::AnalyzePossibleApiFunction(Handle<JSFunction> function) { |
112 if (!function->shared()->IsApiFunction()) return; | 113 if (!function->shared()->IsApiFunction()) return; |
113 Handle<FunctionTemplateInfo> info(function->shared()->get_api_func_data()); | 114 Isolate* isolate = function->GetIsolate(); |
| 115 Handle<FunctionTemplateInfo> info(function->shared()->get_api_func_data(), |
| 116 isolate); |
114 | 117 |
115 // Require a C++ callback. | 118 // Require a C++ callback. |
116 if (info->call_code()->IsUndefined()) return; | 119 if (info->call_code()->IsUndefined(isolate)) return; |
117 api_call_info_ = handle(CallHandlerInfo::cast(info->call_code())); | 120 api_call_info_ = handle(CallHandlerInfo::cast(info->call_code()), isolate); |
118 | 121 |
119 if (!info->signature()->IsUndefined()) { | 122 if (!info->signature()->IsUndefined(isolate)) { |
120 expected_receiver_type_ = | 123 expected_receiver_type_ = |
121 handle(FunctionTemplateInfo::cast(info->signature())); | 124 handle(FunctionTemplateInfo::cast(info->signature()), isolate); |
122 } | 125 } |
123 | 126 |
124 is_simple_api_call_ = true; | 127 is_simple_api_call_ = true; |
125 } | 128 } |
126 } // namespace internal | 129 } // namespace internal |
127 } // namespace v8 | 130 } // namespace v8 |
OLD | NEW |