OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/compiler/js-native-context-specialization.h" | 5 #include "src/compiler/js-native-context-specialization.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/compilation-dependencies.h" | 9 #include "src/compilation-dependencies.h" |
10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 access_info.receiver_maps()); | 203 access_info.receiver_maps()); |
204 | 204 |
205 // Call the @@hasInstance handler. | 205 // Call the @@hasInstance handler. |
206 Node* target = jsgraph()->Constant(access_info.constant()); | 206 Node* target = jsgraph()->Constant(access_info.constant()); |
207 node->InsertInput(graph()->zone(), 0, target); | 207 node->InsertInput(graph()->zone(), 0, target); |
208 node->ReplaceInput(1, constructor); | 208 node->ReplaceInput(1, constructor); |
209 node->ReplaceInput(2, object); | 209 node->ReplaceInput(2, object); |
210 node->ReplaceInput(5, effect); | 210 node->ReplaceInput(5, effect); |
211 NodeProperties::ChangeOp( | 211 NodeProperties::ChangeOp( |
212 node, | 212 node, |
213 javascript()->CallFunction(3, 0.0f, VectorSlotPair(), | 213 javascript()->Call(3, 0.0f, VectorSlotPair(), |
214 ConvertReceiverMode::kNotNullOrUndefined)); | 214 ConvertReceiverMode::kNotNullOrUndefined)); |
215 | 215 |
216 // Rewire the value uses of {node} to ToBoolean conversion of the result. | 216 // Rewire the value uses of {node} to ToBoolean conversion of the result. |
217 Node* value = graph()->NewNode(javascript()->ToBoolean(ToBooleanHint::kAny), | 217 Node* value = graph()->NewNode(javascript()->ToBoolean(ToBooleanHint::kAny), |
218 node, context); | 218 node, context); |
219 for (Edge edge : node->use_edges()) { | 219 for (Edge edge : node->use_edges()) { |
220 if (NodeProperties::IsValueEdge(edge) && edge.from() != value) { | 220 if (NodeProperties::IsValueEdge(edge) && edge.from() != value) { |
221 edge.UpdateTo(value); | 221 edge.UpdateTo(value); |
222 Revisit(edge.from()); | 222 Revisit(edge.from()); |
223 } | 223 } |
224 } | 224 } |
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 OutputFrameStateCombine::Ignore(), | 1316 OutputFrameStateCombine::Ignore(), |
1317 frame_info0), | 1317 frame_info0), |
1318 graph()->NewNode(common()->StateValues(1, SparseInputMask::Dense()), | 1318 graph()->NewNode(common()->StateValues(1, SparseInputMask::Dense()), |
1319 receiver), | 1319 receiver), |
1320 jsgraph()->EmptyStateValues(), jsgraph()->EmptyStateValues(), | 1320 jsgraph()->EmptyStateValues(), jsgraph()->EmptyStateValues(), |
1321 context, target, frame_state); | 1321 context, target, frame_state); |
1322 | 1322 |
1323 // Introduce the call to the getter function. | 1323 // Introduce the call to the getter function. |
1324 if (access_info.constant()->IsJSFunction()) { | 1324 if (access_info.constant()->IsJSFunction()) { |
1325 value = effect = graph()->NewNode( | 1325 value = effect = graph()->NewNode( |
1326 javascript()->CallFunction( | 1326 javascript()->Call(2, 0.0f, VectorSlotPair(), |
1327 2, 0.0f, VectorSlotPair(), | 1327 ConvertReceiverMode::kNotNullOrUndefined), |
1328 ConvertReceiverMode::kNotNullOrUndefined), | |
1329 target, receiver, context, frame_state0, effect, control); | 1328 target, receiver, context, frame_state0, effect, control); |
1330 control = graph()->NewNode(common()->IfSuccess(), value); | 1329 control = graph()->NewNode(common()->IfSuccess(), value); |
1331 } else { | 1330 } else { |
1332 DCHECK(access_info.constant()->IsFunctionTemplateInfo()); | 1331 DCHECK(access_info.constant()->IsFunctionTemplateInfo()); |
1333 Handle<FunctionTemplateInfo> function_template_info( | 1332 Handle<FunctionTemplateInfo> function_template_info( |
1334 Handle<FunctionTemplateInfo>::cast(access_info.constant())); | 1333 Handle<FunctionTemplateInfo>::cast(access_info.constant())); |
1335 DCHECK(!function_template_info->call_code()->IsUndefined(isolate())); | 1334 DCHECK(!function_template_info->call_code()->IsUndefined(isolate())); |
1336 ValueEffectControl value_effect_control = InlineApiCall( | 1335 ValueEffectControl value_effect_control = InlineApiCall( |
1337 receiver, context, target, frame_state0, nullptr, effect, control, | 1336 receiver, context, target, frame_state0, nullptr, effect, control, |
1338 shared_info, function_template_info); | 1337 shared_info, function_template_info); |
(...skipping 15 matching lines...) Expand all Loading... |
1354 OutputFrameStateCombine::Ignore(), | 1353 OutputFrameStateCombine::Ignore(), |
1355 frame_info0), | 1354 frame_info0), |
1356 graph()->NewNode(common()->StateValues(2, SparseInputMask::Dense()), | 1355 graph()->NewNode(common()->StateValues(2, SparseInputMask::Dense()), |
1357 receiver, value), | 1356 receiver, value), |
1358 jsgraph()->EmptyStateValues(), jsgraph()->EmptyStateValues(), | 1357 jsgraph()->EmptyStateValues(), jsgraph()->EmptyStateValues(), |
1359 context, target, frame_state); | 1358 context, target, frame_state); |
1360 | 1359 |
1361 // Introduce the call to the setter function. | 1360 // Introduce the call to the setter function. |
1362 if (access_info.constant()->IsJSFunction()) { | 1361 if (access_info.constant()->IsJSFunction()) { |
1363 effect = graph()->NewNode( | 1362 effect = graph()->NewNode( |
1364 javascript()->CallFunction( | 1363 javascript()->Call(3, 0.0f, VectorSlotPair(), |
1365 3, 0.0f, VectorSlotPair(), | 1364 ConvertReceiverMode::kNotNullOrUndefined), |
1366 ConvertReceiverMode::kNotNullOrUndefined), | |
1367 target, receiver, value, context, frame_state0, effect, control); | 1365 target, receiver, value, context, frame_state0, effect, control); |
1368 control = graph()->NewNode(common()->IfSuccess(), effect); | 1366 control = graph()->NewNode(common()->IfSuccess(), effect); |
1369 } else { | 1367 } else { |
1370 DCHECK(access_info.constant()->IsFunctionTemplateInfo()); | 1368 DCHECK(access_info.constant()->IsFunctionTemplateInfo()); |
1371 Handle<FunctionTemplateInfo> function_template_info( | 1369 Handle<FunctionTemplateInfo> function_template_info( |
1372 Handle<FunctionTemplateInfo>::cast(access_info.constant())); | 1370 Handle<FunctionTemplateInfo>::cast(access_info.constant())); |
1373 DCHECK(!function_template_info->call_code()->IsUndefined(isolate())); | 1371 DCHECK(!function_template_info->call_code()->IsUndefined(isolate())); |
1374 ValueEffectControl value_effect_control = InlineApiCall( | 1372 ValueEffectControl value_effect_control = InlineApiCall( |
1375 receiver, context, target, frame_state0, value, effect, control, | 1373 receiver, context, target, frame_state0, value, effect, control, |
1376 shared_info, function_template_info); | 1374 shared_info, function_template_info); |
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2258 return jsgraph()->javascript(); | 2256 return jsgraph()->javascript(); |
2259 } | 2257 } |
2260 | 2258 |
2261 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 2259 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { |
2262 return jsgraph()->simplified(); | 2260 return jsgraph()->simplified(); |
2263 } | 2261 } |
2264 | 2262 |
2265 } // namespace compiler | 2263 } // namespace compiler |
2266 } // namespace internal | 2264 } // namespace internal |
2267 } // namespace v8 | 2265 } // namespace v8 |
OLD | NEW |