| 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/compiler/js-typed-lowering.h" | 5 #include "src/compiler/js-typed-lowering.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/compilation-dependencies.h" | 8 #include "src/compilation-dependencies.h" |
| 9 #include "src/compiler/access-builder.h" | 9 #include "src/compiler/access-builder.h" |
| 10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
| (...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 simplified()->LoadField(AccessBuilder::ForMapInstanceType()), | 1257 simplified()->LoadField(AccessBuilder::ForMapInstanceType()), |
| 1258 loop_object_map, loop_effect, control); | 1258 loop_object_map, loop_effect, control); |
| 1259 Node* is_proxy = | 1259 Node* is_proxy = |
| 1260 graph()->NewNode(simplified()->NumberEqual(), map_instance_type, | 1260 graph()->NewNode(simplified()->NumberEqual(), map_instance_type, |
| 1261 jsgraph()->Constant(JS_PROXY_TYPE)); | 1261 jsgraph()->Constant(JS_PROXY_TYPE)); |
| 1262 Node* branch_is_proxy = | 1262 Node* branch_is_proxy = |
| 1263 graph()->NewNode(common()->Branch(BranchHint::kFalse), is_proxy, control); | 1263 graph()->NewNode(common()->Branch(BranchHint::kFalse), is_proxy, control); |
| 1264 Node* if_is_proxy = graph()->NewNode(common()->IfTrue(), branch_is_proxy); | 1264 Node* if_is_proxy = graph()->NewNode(common()->IfTrue(), branch_is_proxy); |
| 1265 Node* e_is_proxy = effect; | 1265 Node* e_is_proxy = effect; |
| 1266 | 1266 |
| 1267 Node* runtime_has_in_proto_chain = control = graph()->NewNode( | 1267 control = graph()->NewNode(common()->Merge(2), if_is_access_check_needed, |
| 1268 common()->Merge(2), if_is_access_check_needed, if_is_proxy); | 1268 if_is_proxy); |
| 1269 effect = graph()->NewNode(common()->EffectPhi(2), e_is_access_check_needed, | 1269 effect = graph()->NewNode(common()->EffectPhi(2), e_is_access_check_needed, |
| 1270 e_is_proxy, control); | 1270 e_is_proxy, control); |
| 1271 | 1271 |
| 1272 // If we need an access check or the object is a Proxy, make a runtime call | 1272 // If we need an access check or the object is a Proxy, make a runtime call |
| 1273 // to finish the lowering. | 1273 // to finish the lowering. |
| 1274 Node* bool_result_runtime_has_in_proto_chain_case = graph()->NewNode( | 1274 Node* runtimecall = graph()->NewNode( |
| 1275 javascript()->CallRuntime(Runtime::kHasInPrototypeChain), r.left(), | 1275 javascript()->CallRuntime(Runtime::kHasInPrototypeChain), r.left(), |
| 1276 prototype, context, frame_state, effect, control); | 1276 prototype, context, frame_state, effect, control); |
| 1277 | 1277 |
| 1278 Node* runtimecall_control = |
| 1279 graph()->NewNode(common()->IfSuccess(), runtimecall); |
| 1280 |
| 1278 control = graph()->NewNode(common()->IfFalse(), branch_is_proxy); | 1281 control = graph()->NewNode(common()->IfFalse(), branch_is_proxy); |
| 1279 | 1282 |
| 1280 Node* object_prototype = effect = graph()->NewNode( | 1283 Node* object_prototype = effect = graph()->NewNode( |
| 1281 simplified()->LoadField(AccessBuilder::ForMapPrototype()), | 1284 simplified()->LoadField(AccessBuilder::ForMapPrototype()), |
| 1282 loop_object_map, loop_effect, control); | 1285 loop_object_map, loop_effect, control); |
| 1283 | 1286 |
| 1284 // If not, check if object prototype is the null prototype. | 1287 // If not, check if object prototype is the null prototype. |
| 1285 Node* null_proto = | 1288 Node* null_proto = |
| 1286 graph()->NewNode(simplified()->ReferenceEqual(), object_prototype, | 1289 graph()->NewNode(simplified()->ReferenceEqual(), object_prototype, |
| 1287 jsgraph()->NullConstant()); | 1290 jsgraph()->NullConstant()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1303 control = graph()->NewNode(common()->IfFalse(), branch_eq_proto); | 1306 control = graph()->NewNode(common()->IfFalse(), branch_eq_proto); |
| 1304 | 1307 |
| 1305 Node* load_object_map = effect = | 1308 Node* load_object_map = effect = |
| 1306 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), | 1309 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), |
| 1307 object_prototype, effect, control); | 1310 object_prototype, effect, control); |
| 1308 // Close the loop. | 1311 // Close the loop. |
| 1309 loop_effect->ReplaceInput(1, effect); | 1312 loop_effect->ReplaceInput(1, effect); |
| 1310 loop_object_map->ReplaceInput(1, load_object_map); | 1313 loop_object_map->ReplaceInput(1, load_object_map); |
| 1311 loop->ReplaceInput(1, control); | 1314 loop->ReplaceInput(1, control); |
| 1312 | 1315 |
| 1313 control = graph()->NewNode(common()->Merge(3), runtime_has_in_proto_chain, | 1316 control = graph()->NewNode(common()->Merge(3), runtimecall_control, |
| 1314 if_eq_proto, if_null_proto); | 1317 if_eq_proto, if_null_proto); |
| 1315 effect = graph()->NewNode(common()->EffectPhi(3), | 1318 effect = graph()->NewNode(common()->EffectPhi(3), runtimecall, e_eq_proto, |
| 1316 bool_result_runtime_has_in_proto_chain_case, | 1319 e_null_proto, control); |
| 1317 e_eq_proto, e_null_proto, control); | |
| 1318 | 1320 |
| 1319 Node* result = graph()->NewNode( | 1321 Node* result = graph()->NewNode( |
| 1320 common()->Phi(MachineRepresentation::kTagged, 3), | 1322 common()->Phi(MachineRepresentation::kTagged, 3), runtimecall, |
| 1321 bool_result_runtime_has_in_proto_chain_case, jsgraph()->TrueConstant(), | 1323 jsgraph()->TrueConstant(), jsgraph()->FalseConstant(), control); |
| 1322 jsgraph()->FalseConstant(), control); | |
| 1323 | 1324 |
| 1324 if (if_is_smi != nullptr) { | 1325 if (if_is_smi != nullptr) { |
| 1325 DCHECK_NOT_NULL(e_is_smi); | 1326 DCHECK_NOT_NULL(e_is_smi); |
| 1326 control = graph()->NewNode(common()->Merge(2), if_is_smi, control); | 1327 control = graph()->NewNode(common()->Merge(2), if_is_smi, control); |
| 1327 effect = | 1328 effect = |
| 1328 graph()->NewNode(common()->EffectPhi(2), e_is_smi, effect, control); | 1329 graph()->NewNode(common()->EffectPhi(2), e_is_smi, effect, control); |
| 1329 result = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), | 1330 result = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
| 1330 jsgraph()->FalseConstant(), result, control); | 1331 jsgraph()->FalseConstant(), result, control); |
| 1331 } | 1332 } |
| 1332 | 1333 |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2156 } | 2157 } |
| 2157 | 2158 |
| 2158 | 2159 |
| 2159 CompilationDependencies* JSTypedLowering::dependencies() const { | 2160 CompilationDependencies* JSTypedLowering::dependencies() const { |
| 2160 return dependencies_; | 2161 return dependencies_; |
| 2161 } | 2162 } |
| 2162 | 2163 |
| 2163 } // namespace compiler | 2164 } // namespace compiler |
| 2164 } // namespace internal | 2165 } // namespace internal |
| 2165 } // namespace v8 | 2166 } // namespace v8 |
| OLD | NEW |