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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 Reduction JSNativeContextSpecialization::ReduceNamedAccess( | 73 Reduction JSNativeContextSpecialization::ReduceNamedAccess( |
74 Node* node, Node* value, MapHandleList const& receiver_maps, | 74 Node* node, Node* value, MapHandleList const& receiver_maps, |
75 Handle<Name> name, AccessMode access_mode, LanguageMode language_mode, | 75 Handle<Name> name, AccessMode access_mode, LanguageMode language_mode, |
76 Node* index) { | 76 Node* index) { |
77 DCHECK(node->opcode() == IrOpcode::kJSLoadNamed || | 77 DCHECK(node->opcode() == IrOpcode::kJSLoadNamed || |
78 node->opcode() == IrOpcode::kJSStoreNamed || | 78 node->opcode() == IrOpcode::kJSStoreNamed || |
79 node->opcode() == IrOpcode::kJSLoadProperty || | 79 node->opcode() == IrOpcode::kJSLoadProperty || |
80 node->opcode() == IrOpcode::kJSStoreProperty); | 80 node->opcode() == IrOpcode::kJSStoreProperty); |
81 Node* receiver = NodeProperties::GetValueInput(node, 0); | 81 Node* receiver = NodeProperties::GetValueInput(node, 0); |
82 Node* frame_state = NodeProperties::GetFrameStateInput(node, 1); | |
83 Node* effect = NodeProperties::GetEffectInput(node); | 82 Node* effect = NodeProperties::GetEffectInput(node); |
84 Node* control = NodeProperties::GetControlInput(node); | 83 Node* control = NodeProperties::GetControlInput(node); |
| 84 Node* frame_state = NodeProperties::FindFrameStateBefore(node); |
85 | 85 |
86 // Not much we can do if deoptimization support is disabled. | 86 // Not much we can do if deoptimization support is disabled. |
87 if (!(flags() & kDeoptimizationEnabled)) return NoChange(); | 87 if (!(flags() & kDeoptimizationEnabled)) return NoChange(); |
88 | 88 |
89 // Retrieve the native context from the given {node}. | 89 // Retrieve the native context from the given {node}. |
90 Handle<Context> native_context; | 90 Handle<Context> native_context; |
91 if (!GetNativeContext(node).ToHandle(&native_context)) return NoChange(); | 91 if (!GetNativeContext(node).ToHandle(&native_context)) return NoChange(); |
92 | 92 |
93 // Compute property access infos for the receiver maps. | 93 // Compute property access infos for the receiver maps. |
94 AccessInfoFactory access_info_factory(dependencies(), native_context, | 94 AccessInfoFactory access_info_factory(dependencies(), native_context, |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 | 517 |
518 | 518 |
519 Reduction JSNativeContextSpecialization::ReduceElementAccess( | 519 Reduction JSNativeContextSpecialization::ReduceElementAccess( |
520 Node* node, Node* index, Node* value, MapHandleList const& receiver_maps, | 520 Node* node, Node* index, Node* value, MapHandleList const& receiver_maps, |
521 AccessMode access_mode, LanguageMode language_mode, | 521 AccessMode access_mode, LanguageMode language_mode, |
522 KeyedAccessStoreMode store_mode) { | 522 KeyedAccessStoreMode store_mode) { |
523 DCHECK(node->opcode() == IrOpcode::kJSLoadProperty || | 523 DCHECK(node->opcode() == IrOpcode::kJSLoadProperty || |
524 node->opcode() == IrOpcode::kJSStoreProperty); | 524 node->opcode() == IrOpcode::kJSStoreProperty); |
525 Node* receiver = NodeProperties::GetValueInput(node, 0); | 525 Node* receiver = NodeProperties::GetValueInput(node, 0); |
526 Node* context = NodeProperties::GetContextInput(node); | 526 Node* context = NodeProperties::GetContextInput(node); |
527 Node* frame_state = NodeProperties::GetFrameStateInput(node, 1); | |
528 Node* effect = NodeProperties::GetEffectInput(node); | 527 Node* effect = NodeProperties::GetEffectInput(node); |
529 Node* control = NodeProperties::GetControlInput(node); | 528 Node* control = NodeProperties::GetControlInput(node); |
| 529 Node* frame_state = NodeProperties::FindFrameStateBefore(node); |
530 | 530 |
531 // Not much we can do if deoptimization support is disabled. | 531 // Not much we can do if deoptimization support is disabled. |
532 if (!(flags() & kDeoptimizationEnabled)) return NoChange(); | 532 if (!(flags() & kDeoptimizationEnabled)) return NoChange(); |
533 | 533 |
534 // TODO(bmeurer): Add support for non-standard stores. | 534 // TODO(bmeurer): Add support for non-standard stores. |
535 if (store_mode != STANDARD_STORE) return NoChange(); | 535 if (store_mode != STANDARD_STORE) return NoChange(); |
536 | 536 |
537 // Retrieve the native context from the given {node}. | 537 // Retrieve the native context from the given {node}. |
538 Handle<Context> native_context; | 538 Handle<Context> native_context; |
539 if (!GetNativeContext(node).ToHandle(&native_context)) return NoChange(); | 539 if (!GetNativeContext(node).ToHandle(&native_context)) return NoChange(); |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 language_mode, index); | 963 language_mode, index); |
964 } | 964 } |
965 | 965 |
966 // Try to lower the element access based on the {receiver_maps}. | 966 // Try to lower the element access based on the {receiver_maps}. |
967 return ReduceElementAccess(node, index, value, receiver_maps, access_mode, | 967 return ReduceElementAccess(node, index, value, receiver_maps, access_mode, |
968 language_mode, store_mode); | 968 language_mode, store_mode); |
969 } | 969 } |
970 | 970 |
971 | 971 |
972 Reduction JSNativeContextSpecialization::ReduceSoftDeoptimize(Node* node) { | 972 Reduction JSNativeContextSpecialization::ReduceSoftDeoptimize(Node* node) { |
973 Node* frame_state = NodeProperties::GetFrameStateInput(node, 1); | |
974 Node* effect = NodeProperties::GetEffectInput(node); | 973 Node* effect = NodeProperties::GetEffectInput(node); |
975 Node* control = NodeProperties::GetControlInput(node); | 974 Node* control = NodeProperties::GetControlInput(node); |
| 975 Node* frame_state = NodeProperties::FindFrameStateBefore(node); |
976 Node* deoptimize = | 976 Node* deoptimize = |
977 graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kSoft), frame_state, | 977 graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kSoft), frame_state, |
978 effect, control); | 978 effect, control); |
979 // TODO(bmeurer): This should be on the AdvancedReducer somehow. | 979 // TODO(bmeurer): This should be on the AdvancedReducer somehow. |
980 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); | 980 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); |
981 Revisit(graph()->end()); | 981 Revisit(graph()->end()); |
982 node->TrimInputCount(0); | 982 node->TrimInputCount(0); |
983 NodeProperties::ChangeOp(node, common()->Dead()); | 983 NodeProperties::ChangeOp(node, common()->Dead()); |
984 return Changed(node); | 984 return Changed(node); |
985 } | 985 } |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 } | 1154 } |
1155 | 1155 |
1156 | 1156 |
1157 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 1157 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { |
1158 return jsgraph()->simplified(); | 1158 return jsgraph()->simplified(); |
1159 } | 1159 } |
1160 | 1160 |
1161 } // namespace compiler | 1161 } // namespace compiler |
1162 } // namespace internal | 1162 } // namespace internal |
1163 } // namespace v8 | 1163 } // namespace v8 |
OLD | NEW |