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 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 RelaxControls(node); | 808 RelaxControls(node); |
809 a.FinishAndChange(node); | 809 a.FinishAndChange(node); |
810 return Changed(node); | 810 return Changed(node); |
811 } | 811 } |
812 | 812 |
813 return NoChange(); | 813 return NoChange(); |
814 } | 814 } |
815 | 815 |
816 Reduction JSCreateLowering::ReduceJSCreateWithContext(Node* node) { | 816 Reduction JSCreateLowering::ReduceJSCreateWithContext(Node* node) { |
817 DCHECK_EQ(IrOpcode::kJSCreateWithContext, node->opcode()); | 817 DCHECK_EQ(IrOpcode::kJSCreateWithContext, node->opcode()); |
| 818 Handle<ScopeInfo> scope_info = OpParameter<Handle<ScopeInfo>>(node); |
818 Node* object = NodeProperties::GetValueInput(node, 0); | 819 Node* object = NodeProperties::GetValueInput(node, 0); |
819 Node* closure = NodeProperties::GetValueInput(node, 1); | 820 Node* closure = NodeProperties::GetValueInput(node, 1); |
820 Node* effect = NodeProperties::GetEffectInput(node); | 821 Node* effect = NodeProperties::GetEffectInput(node); |
821 Node* control = NodeProperties::GetControlInput(node); | 822 Node* control = NodeProperties::GetControlInput(node); |
822 Node* context = NodeProperties::GetContextInput(node); | 823 Node* context = NodeProperties::GetContextInput(node); |
823 Node* native_context = effect = graph()->NewNode( | 824 Node* native_context = effect = graph()->NewNode( |
824 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true), | 825 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true), |
825 context, context, effect); | 826 context, context, effect); |
826 AllocationBuilder a(jsgraph(), effect, control); | 827 |
| 828 AllocationBuilder aa(jsgraph(), effect, control); |
| 829 aa.Allocate(ContextExtension::kSize); |
| 830 aa.Store(AccessBuilder::ForMap(), factory()->context_extension_map()); |
| 831 aa.Store(AccessBuilder::ForContextExtensionScopeInfo(), scope_info); |
| 832 aa.Store(AccessBuilder::ForContextExtensionExtension(), object); |
| 833 Node* extension = aa.Finish(); |
| 834 |
| 835 AllocationBuilder a(jsgraph(), extension, control); |
827 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered. | 836 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered. |
828 a.AllocateArray(Context::MIN_CONTEXT_SLOTS, factory()->with_context_map()); | 837 a.AllocateArray(Context::MIN_CONTEXT_SLOTS, factory()->with_context_map()); |
829 a.Store(AccessBuilder::ForContextSlot(Context::CLOSURE_INDEX), closure); | 838 a.Store(AccessBuilder::ForContextSlot(Context::CLOSURE_INDEX), closure); |
830 a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context); | 839 a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context); |
831 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), object); | 840 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), extension); |
832 a.Store(AccessBuilder::ForContextSlot(Context::NATIVE_CONTEXT_INDEX), | 841 a.Store(AccessBuilder::ForContextSlot(Context::NATIVE_CONTEXT_INDEX), |
833 native_context); | 842 native_context); |
834 RelaxControls(node); | 843 RelaxControls(node); |
835 a.FinishAndChange(node); | 844 a.FinishAndChange(node); |
836 return Changed(node); | 845 return Changed(node); |
837 } | 846 } |
838 | 847 |
839 Reduction JSCreateLowering::ReduceJSCreateCatchContext(Node* node) { | 848 Reduction JSCreateLowering::ReduceJSCreateCatchContext(Node* node) { |
840 DCHECK_EQ(IrOpcode::kJSCreateCatchContext, node->opcode()); | 849 DCHECK_EQ(IrOpcode::kJSCreateCatchContext, node->opcode()); |
841 const CreateCatchContextParameters& parameters = | 850 const CreateCatchContextParameters& parameters = |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 return jsgraph()->simplified(); | 1289 return jsgraph()->simplified(); |
1281 } | 1290 } |
1282 | 1291 |
1283 MachineOperatorBuilder* JSCreateLowering::machine() const { | 1292 MachineOperatorBuilder* JSCreateLowering::machine() const { |
1284 return jsgraph()->machine(); | 1293 return jsgraph()->machine(); |
1285 } | 1294 } |
1286 | 1295 |
1287 } // namespace compiler | 1296 } // namespace compiler |
1288 } // namespace internal | 1297 } // namespace internal |
1289 } // namespace v8 | 1298 } // namespace v8 |
OLD | NEW |