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-call-reducer.h" | 5 #include "src/compiler/js-call-reducer.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/compilation-dependencies.h" | 9 #include "src/compilation-dependencies.h" |
10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 } | 328 } |
329 | 329 |
330 // ES6 section B.2.2.1.1 get Object.prototype.__proto__ | 330 // ES6 section B.2.2.1.1 get Object.prototype.__proto__ |
331 Reduction JSCallReducer::ReduceObjectPrototypeGetProto(Node* node) { | 331 Reduction JSCallReducer::ReduceObjectPrototypeGetProto(Node* node) { |
332 DCHECK_EQ(IrOpcode::kJSCall, node->opcode()); | 332 DCHECK_EQ(IrOpcode::kJSCall, node->opcode()); |
333 Node* receiver = NodeProperties::GetValueInput(node, 1); | 333 Node* receiver = NodeProperties::GetValueInput(node, 1); |
334 Node* effect = NodeProperties::GetEffectInput(node); | 334 Node* effect = NodeProperties::GetEffectInput(node); |
335 | 335 |
336 // Try to determine the {receiver} map. | 336 // Try to determine the {receiver} map. |
337 ZoneHandleSet<Map> receiver_maps; | 337 ZoneHandleSet<Map> receiver_maps; |
338 if (NodeProperties::InferReceiverMaps(receiver, effect, &receiver_maps)) { | 338 NodeProperties::InferReceiverMapsResult result = |
| 339 NodeProperties::InferReceiverMaps(receiver, effect, &receiver_maps); |
| 340 if (result == NodeProperties::kReliableReceiverMaps) { |
339 Handle<Map> candidate_map( | 341 Handle<Map> candidate_map( |
340 receiver_maps[0]->GetPrototypeChainRootMap(isolate())); | 342 receiver_maps[0]->GetPrototypeChainRootMap(isolate())); |
341 Handle<Object> candidate_prototype(candidate_map->prototype(), isolate()); | 343 Handle<Object> candidate_prototype(candidate_map->prototype(), isolate()); |
342 | 344 |
343 // Check if we can constant-fold the {candidate_prototype}. | 345 // Check if we can constant-fold the {candidate_prototype}. |
344 for (size_t i = 0; i < receiver_maps.size(); ++i) { | 346 for (size_t i = 0; i < receiver_maps.size(); ++i) { |
345 Handle<Map> const receiver_map( | 347 Handle<Map> const receiver_map( |
346 receiver_maps[i]->GetPrototypeChainRootMap(isolate())); | 348 receiver_maps[i]->GetPrototypeChainRootMap(isolate())); |
347 if (receiver_map->IsJSProxyMap() || | 349 if (receiver_map->IsJSProxyMap() || |
348 receiver_map->has_hidden_prototype() || | 350 receiver_map->has_hidden_prototype() || |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 return jsgraph()->javascript(); | 867 return jsgraph()->javascript(); |
866 } | 868 } |
867 | 869 |
868 SimplifiedOperatorBuilder* JSCallReducer::simplified() const { | 870 SimplifiedOperatorBuilder* JSCallReducer::simplified() const { |
869 return jsgraph()->simplified(); | 871 return jsgraph()->simplified(); |
870 } | 872 } |
871 | 873 |
872 } // namespace compiler | 874 } // namespace compiler |
873 } // namespace internal | 875 } // namespace internal |
874 } // namespace v8 | 876 } // namespace v8 |
OLD | NEW |