| 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/compiler/access-builder.h" | 6 #include "src/compiler/access-builder.h" |
| 7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
| 8 #include "src/compiler/js-typed-lowering.h" | 8 #include "src/compiler/js-typed-lowering.h" |
| 9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
| 10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 simplified()->StoreField(AccessBuilder::ForContextSlot(access.index()))); | 929 simplified()->StoreField(AccessBuilder::ForContextSlot(access.index()))); |
| 930 node->RemoveInput(2); | 930 node->RemoveInput(2); |
| 931 DCHECK_EQ(4, node->InputCount()); | 931 DCHECK_EQ(4, node->InputCount()); |
| 932 return Changed(node); | 932 return Changed(node); |
| 933 } | 933 } |
| 934 | 934 |
| 935 | 935 |
| 936 Reduction JSTypedLowering::ReduceJSLoadDynamicGlobal(Node* node) { | 936 Reduction JSTypedLowering::ReduceJSLoadDynamicGlobal(Node* node) { |
| 937 DCHECK_EQ(IrOpcode::kJSLoadDynamicGlobal, node->opcode()); | 937 DCHECK_EQ(IrOpcode::kJSLoadDynamicGlobal, node->opcode()); |
| 938 DynamicGlobalAccess const& access = DynamicGlobalAccessOf(node->op()); | 938 DynamicGlobalAccess const& access = DynamicGlobalAccessOf(node->op()); |
| 939 Node* const vector = NodeProperties::GetValueInput(node, 0); |
| 939 Node* const context = NodeProperties::GetContextInput(node); | 940 Node* const context = NodeProperties::GetContextInput(node); |
| 940 Node* const state1 = NodeProperties::GetFrameStateInput(node, 0); | 941 Node* const state1 = NodeProperties::GetFrameStateInput(node, 0); |
| 941 Node* const state2 = NodeProperties::GetFrameStateInput(node, 1); | 942 Node* const state2 = NodeProperties::GetFrameStateInput(node, 1); |
| 942 Node* const effect = NodeProperties::GetEffectInput(node); | 943 Node* const effect = NodeProperties::GetEffectInput(node); |
| 943 Node* const control = NodeProperties::GetControlInput(node); | 944 Node* const control = NodeProperties::GetControlInput(node); |
| 944 if (access.RequiresFullCheck()) return NoChange(); | 945 if (access.RequiresFullCheck()) return NoChange(); |
| 945 | 946 |
| 946 // Perform checks whether the fast mode applies, by looking for any extension | 947 // Perform checks whether the fast mode applies, by looking for any extension |
| 947 // object which might shadow the optimistic declaration. | 948 // object which might shadow the optimistic declaration. |
| 948 uint32_t bitset = access.check_bitset(); | 949 uint32_t bitset = access.check_bitset(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 964 check_true = if_true; | 965 check_true = if_true; |
| 965 } | 966 } |
| 966 | 967 |
| 967 // Fast case, because variable is not shadowed. Perform global object load. | 968 // Fast case, because variable is not shadowed. Perform global object load. |
| 968 Unique<Name> name = Unique<Name>::CreateUninitialized(access.name()); | 969 Unique<Name> name = Unique<Name>::CreateUninitialized(access.name()); |
| 969 Node* global = graph()->NewNode( | 970 Node* global = graph()->NewNode( |
| 970 javascript()->LoadContext(0, Context::GLOBAL_OBJECT_INDEX, true), context, | 971 javascript()->LoadContext(0, Context::GLOBAL_OBJECT_INDEX, true), context, |
| 971 context, effect); | 972 context, effect); |
| 972 Node* fast = graph()->NewNode( | 973 Node* fast = graph()->NewNode( |
| 973 javascript()->LoadNamed(name, access.feedback(), access.mode()), global, | 974 javascript()->LoadNamed(name, access.feedback(), access.mode()), global, |
| 974 context, state1, state2, global, check_true); | 975 vector, context, state1, state2, global, check_true); |
| 975 | 976 |
| 976 // Slow case, because variable potentially shadowed. Perform dynamic lookup. | 977 // Slow case, because variable potentially shadowed. Perform dynamic lookup. |
| 977 uint32_t check_bitset = DynamicGlobalAccess::kFullCheckRequired; | 978 uint32_t check_bitset = DynamicGlobalAccess::kFullCheckRequired; |
| 978 Node* slow = graph()->NewNode( | 979 Node* slow = graph()->NewNode( |
| 979 javascript()->LoadDynamicGlobal(access.name(), check_bitset, | 980 javascript()->LoadDynamicGlobal(access.name(), check_bitset, |
| 980 access.feedback(), access.mode()), | 981 access.feedback(), access.mode()), |
| 981 context, context, state1, state2, effect, check_false); | 982 vector, context, context, state1, state2, effect, check_false); |
| 982 | 983 |
| 983 // Replace value, effect and control uses accordingly. | 984 // Replace value, effect and control uses accordingly. |
| 984 Node* new_control = | 985 Node* new_control = |
| 985 graph()->NewNode(common()->Merge(2), check_true, check_false); | 986 graph()->NewNode(common()->Merge(2), check_true, check_false); |
| 986 Node* new_effect = | 987 Node* new_effect = |
| 987 graph()->NewNode(common()->EffectPhi(2), fast, slow, new_control); | 988 graph()->NewNode(common()->EffectPhi(2), fast, slow, new_control); |
| 988 Node* new_value = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), fast, | 989 Node* new_value = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), fast, |
| 989 slow, new_control); | 990 slow, new_control); |
| 990 ReplaceWithValue(node, new_value, new_effect, new_control); | 991 ReplaceWithValue(node, new_value, new_effect, new_control); |
| 991 return Changed(new_value); | 992 return Changed(new_value); |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1611 } | 1612 } |
| 1612 | 1613 |
| 1613 | 1614 |
| 1614 MachineOperatorBuilder* JSTypedLowering::machine() const { | 1615 MachineOperatorBuilder* JSTypedLowering::machine() const { |
| 1615 return jsgraph()->machine(); | 1616 return jsgraph()->machine(); |
| 1616 } | 1617 } |
| 1617 | 1618 |
| 1618 } // namespace compiler | 1619 } // namespace compiler |
| 1619 } // namespace internal | 1620 } // namespace internal |
| 1620 } // namespace v8 | 1621 } // namespace v8 |
| OLD | NEW |