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/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/compilation-dependencies.h" | 6 #include "src/compilation-dependencies.h" |
7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/js-typed-lowering.h" | 9 #include "src/compiler/js-typed-lowering.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 Node* bool_result_runtime_has_in_proto_chain_case = graph()->NewNode( | 1260 Node* bool_result_runtime_has_in_proto_chain_case = graph()->NewNode( |
1261 javascript()->CallRuntime(Runtime::kHasInPrototypeChain), r.left(), | 1261 javascript()->CallRuntime(Runtime::kHasInPrototypeChain), r.left(), |
1262 prototype, context, frame_state, effect, control); | 1262 prototype, context, frame_state, effect, control); |
1263 | 1263 |
1264 control = graph()->NewNode(common()->IfFalse(), branch_is_proxy); | 1264 control = graph()->NewNode(common()->IfFalse(), branch_is_proxy); |
1265 | 1265 |
1266 Node* object_prototype = effect = graph()->NewNode( | 1266 Node* object_prototype = effect = graph()->NewNode( |
1267 simplified()->LoadField(AccessBuilder::ForMapPrototype()), | 1267 simplified()->LoadField(AccessBuilder::ForMapPrototype()), |
1268 loop_object_map, loop_effect, control); | 1268 loop_object_map, loop_effect, control); |
1269 | 1269 |
| 1270 // If not, check if object prototype is the null prototype. |
| 1271 Node* null_proto = |
| 1272 graph()->NewNode(simplified()->ReferenceEqual(r.right_type()), |
| 1273 object_prototype, jsgraph()->NullConstant()); |
| 1274 Node* branch_null_proto = graph()->NewNode( |
| 1275 common()->Branch(BranchHint::kFalse), null_proto, control); |
| 1276 Node* if_null_proto = graph()->NewNode(common()->IfTrue(), branch_null_proto); |
| 1277 Node* e_null_proto = effect; |
| 1278 |
| 1279 control = graph()->NewNode(common()->IfFalse(), branch_null_proto); |
| 1280 |
1270 // Check if object prototype is equal to function prototype. | 1281 // Check if object prototype is equal to function prototype. |
1271 Node* eq_proto = | 1282 Node* eq_proto = |
1272 graph()->NewNode(simplified()->ReferenceEqual(r.right_type()), | 1283 graph()->NewNode(simplified()->ReferenceEqual(r.right_type()), |
1273 object_prototype, prototype); | 1284 object_prototype, prototype); |
1274 Node* branch_eq_proto = | 1285 Node* branch_eq_proto = |
1275 graph()->NewNode(common()->Branch(BranchHint::kFalse), eq_proto, control); | 1286 graph()->NewNode(common()->Branch(BranchHint::kFalse), eq_proto, control); |
1276 Node* if_eq_proto = graph()->NewNode(common()->IfTrue(), branch_eq_proto); | 1287 Node* if_eq_proto = graph()->NewNode(common()->IfTrue(), branch_eq_proto); |
1277 Node* e_eq_proto = effect; | 1288 Node* e_eq_proto = effect; |
1278 | 1289 |
1279 control = graph()->NewNode(common()->IfFalse(), branch_eq_proto); | 1290 control = graph()->NewNode(common()->IfFalse(), branch_eq_proto); |
1280 | 1291 |
1281 // If not, check if object prototype is the null prototype. | |
1282 Node* null_proto = | |
1283 graph()->NewNode(simplified()->ReferenceEqual(r.right_type()), | |
1284 object_prototype, jsgraph()->NullConstant()); | |
1285 Node* branch_null_proto = graph()->NewNode( | |
1286 common()->Branch(BranchHint::kFalse), null_proto, control); | |
1287 Node* if_null_proto = graph()->NewNode(common()->IfTrue(), branch_null_proto); | |
1288 Node* e_null_proto = effect; | |
1289 | |
1290 control = graph()->NewNode(common()->IfFalse(), branch_null_proto); | |
1291 Node* load_object_map = effect = | 1292 Node* load_object_map = effect = |
1292 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), | 1293 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), |
1293 object_prototype, effect, control); | 1294 object_prototype, effect, control); |
1294 // Close the loop. | 1295 // Close the loop. |
1295 loop_effect->ReplaceInput(1, effect); | 1296 loop_effect->ReplaceInput(1, effect); |
1296 loop_object_map->ReplaceInput(1, load_object_map); | 1297 loop_object_map->ReplaceInput(1, load_object_map); |
1297 loop->ReplaceInput(1, control); | 1298 loop->ReplaceInput(1, control); |
1298 | 1299 |
1299 control = graph()->NewNode(common()->Merge(3), runtime_has_in_proto_chain, | 1300 control = graph()->NewNode(common()->Merge(3), runtime_has_in_proto_chain, |
1300 if_eq_proto, if_null_proto); | 1301 if_eq_proto, if_null_proto); |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1974 } | 1975 } |
1975 | 1976 |
1976 | 1977 |
1977 CompilationDependencies* JSTypedLowering::dependencies() const { | 1978 CompilationDependencies* JSTypedLowering::dependencies() const { |
1978 return dependencies_; | 1979 return dependencies_; |
1979 } | 1980 } |
1980 | 1981 |
1981 } // namespace compiler | 1982 } // namespace compiler |
1982 } // namespace internal | 1983 } // namespace internal |
1983 } // namespace v8 | 1984 } // namespace v8 |
OLD | NEW |