OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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-create-lowering.h" | 5 #include "src/compiler/js-create-lowering.h" |
6 | 6 |
7 #include "src/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), object); | 831 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), object); |
832 a.Store(AccessBuilder::ForContextSlot(Context::NATIVE_CONTEXT_INDEX), | 832 a.Store(AccessBuilder::ForContextSlot(Context::NATIVE_CONTEXT_INDEX), |
833 native_context); | 833 native_context); |
834 RelaxControls(node); | 834 RelaxControls(node); |
835 a.FinishAndChange(node); | 835 a.FinishAndChange(node); |
836 return Changed(node); | 836 return Changed(node); |
837 } | 837 } |
838 | 838 |
839 Reduction JSCreateLowering::ReduceJSCreateCatchContext(Node* node) { | 839 Reduction JSCreateLowering::ReduceJSCreateCatchContext(Node* node) { |
840 DCHECK_EQ(IrOpcode::kJSCreateCatchContext, node->opcode()); | 840 DCHECK_EQ(IrOpcode::kJSCreateCatchContext, node->opcode()); |
841 Handle<String> name = OpParameter<Handle<String>>(node); | 841 const CreateCatchContextParameters& parameters = |
| 842 CreateCatchContextParametersOf(node->op()); |
842 Node* exception = NodeProperties::GetValueInput(node, 0); | 843 Node* exception = NodeProperties::GetValueInput(node, 0); |
843 Node* closure = NodeProperties::GetValueInput(node, 1); | 844 Node* closure = NodeProperties::GetValueInput(node, 1); |
844 Node* effect = NodeProperties::GetEffectInput(node); | 845 Node* effect = NodeProperties::GetEffectInput(node); |
845 Node* control = NodeProperties::GetControlInput(node); | 846 Node* control = NodeProperties::GetControlInput(node); |
846 Node* context = NodeProperties::GetContextInput(node); | 847 Node* context = NodeProperties::GetContextInput(node); |
847 Node* native_context = effect = graph()->NewNode( | 848 Node* native_context = effect = graph()->NewNode( |
848 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true), | 849 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true), |
849 context, context, effect); | 850 context, context, effect); |
850 AllocationBuilder a(jsgraph(), effect, control); | 851 |
| 852 AllocationBuilder aa(jsgraph(), effect, control); |
| 853 aa.Allocate(ContextExtension::kSize); |
| 854 aa.Store(AccessBuilder::ForMap(), factory()->context_extension_map()); |
| 855 aa.Store(AccessBuilder::ForContextExtensionScopeInfo(), |
| 856 parameters.scope_info()); |
| 857 aa.Store(AccessBuilder::ForContextExtensionExtension(), |
| 858 parameters.catch_name()); |
| 859 Node* extension = aa.Finish(); |
| 860 |
| 861 AllocationBuilder a(jsgraph(), extension, control); |
851 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered. | 862 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered. |
852 a.AllocateArray(Context::MIN_CONTEXT_SLOTS + 1, | 863 a.AllocateArray(Context::MIN_CONTEXT_SLOTS + 1, |
853 factory()->catch_context_map()); | 864 factory()->catch_context_map()); |
854 a.Store(AccessBuilder::ForContextSlot(Context::CLOSURE_INDEX), closure); | 865 a.Store(AccessBuilder::ForContextSlot(Context::CLOSURE_INDEX), closure); |
855 a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context); | 866 a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context); |
856 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), name); | 867 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), extension); |
857 a.Store(AccessBuilder::ForContextSlot(Context::NATIVE_CONTEXT_INDEX), | 868 a.Store(AccessBuilder::ForContextSlot(Context::NATIVE_CONTEXT_INDEX), |
858 native_context); | 869 native_context); |
859 a.Store(AccessBuilder::ForContextSlot(Context::THROWN_OBJECT_INDEX), | 870 a.Store(AccessBuilder::ForContextSlot(Context::THROWN_OBJECT_INDEX), |
860 exception); | 871 exception); |
861 RelaxControls(node); | 872 RelaxControls(node); |
862 a.FinishAndChange(node); | 873 a.FinishAndChange(node); |
863 return Changed(node); | 874 return Changed(node); |
864 } | 875 } |
865 | 876 |
866 Reduction JSCreateLowering::ReduceJSCreateBlockContext(Node* node) { | 877 Reduction JSCreateLowering::ReduceJSCreateBlockContext(Node* node) { |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 return jsgraph()->simplified(); | 1280 return jsgraph()->simplified(); |
1270 } | 1281 } |
1271 | 1282 |
1272 MachineOperatorBuilder* JSCreateLowering::machine() const { | 1283 MachineOperatorBuilder* JSCreateLowering::machine() const { |
1273 return jsgraph()->machine(); | 1284 return jsgraph()->machine(); |
1274 } | 1285 } |
1275 | 1286 |
1276 } // namespace compiler | 1287 } // namespace compiler |
1277 } // namespace internal | 1288 } // namespace internal |
1278 } // namespace v8 | 1289 } // namespace v8 |
OLD | NEW |