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/compilation-dependencies.h" | 6 #include "src/compilation-dependencies.h" |
7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/js-typed-lowering.h" | 9 #include "src/compiler/js-typed-lowering.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1878 NodeProperties::ChangeOp(node, new_op); | 1878 NodeProperties::ChangeOp(node, new_op); |
1879 return Changed(node); | 1879 return Changed(node); |
1880 } | 1880 } |
1881 | 1881 |
1882 return NoChange(); | 1882 return NoChange(); |
1883 } | 1883 } |
1884 | 1884 |
1885 | 1885 |
1886 Reduction JSTypedLowering::ReduceJSCreateWithContext(Node* node) { | 1886 Reduction JSTypedLowering::ReduceJSCreateWithContext(Node* node) { |
1887 DCHECK_EQ(IrOpcode::kJSCreateWithContext, node->opcode()); | 1887 DCHECK_EQ(IrOpcode::kJSCreateWithContext, node->opcode()); |
1888 Node* const input = NodeProperties::GetValueInput(node, 0); | 1888 Node* object = NodeProperties::GetValueInput(node, 0); |
1889 Node* const closure = NodeProperties::GetValueInput(node, 1); | 1889 Node* closure = NodeProperties::GetValueInput(node, 1); |
1890 Type* const input_type = NodeProperties::GetType(input); | 1890 Node* effect = NodeProperties::GetEffectInput(node); |
1891 | 1891 Node* control = NodeProperties::GetControlInput(node); |
1892 // Use inline allocation for with contexts for regular objects. | 1892 Node* context = NodeProperties::GetContextInput(node); |
1893 if (input_type->Is(Type::Receiver())) { | 1893 Node* global = effect = graph()->NewNode( |
1894 // JSCreateWithContext(o:receiver, fun) | 1894 simplified()->LoadField( |
1895 Node* const effect = NodeProperties::GetEffectInput(node); | 1895 AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)), |
1896 Node* const control = NodeProperties::GetControlInput(node); | 1896 context, effect, control); |
1897 Node* const context = NodeProperties::GetContextInput(node); | 1897 AllocationBuilder a(jsgraph(), effect, control); |
1898 Node* const load = graph()->NewNode( | 1898 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered. |
1899 simplified()->LoadField( | 1899 a.AllocateArray(Context::MIN_CONTEXT_SLOTS, factory()->with_context_map()); |
1900 AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)), | 1900 a.Store(AccessBuilder::ForContextSlot(Context::CLOSURE_INDEX), closure); |
1901 context, effect, control); | 1901 a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context); |
1902 AllocationBuilder a(jsgraph(), effect, control); | 1902 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), object); |
1903 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered. | 1903 a.Store(AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX), global); |
1904 a.AllocateArray(Context::MIN_CONTEXT_SLOTS, factory()->with_context_map()); | 1904 RelaxControls(node); |
1905 a.Store(AccessBuilder::ForContextSlot(Context::CLOSURE_INDEX), closure); | 1905 a.FinishAndChange(node); |
1906 a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context); | 1906 return Changed(node); |
1907 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), input); | |
1908 a.Store(AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX), load); | |
1909 RelaxControls(node); | |
1910 a.FinishAndChange(node); | |
1911 return Changed(node); | |
1912 } | |
1913 | |
1914 return NoChange(); | |
1915 } | 1907 } |
1916 | 1908 |
1917 | 1909 |
1918 Reduction JSTypedLowering::ReduceJSCreateBlockContext(Node* node) { | 1910 Reduction JSTypedLowering::ReduceJSCreateBlockContext(Node* node) { |
1919 DCHECK_EQ(IrOpcode::kJSCreateBlockContext, node->opcode()); | 1911 DCHECK_EQ(IrOpcode::kJSCreateBlockContext, node->opcode()); |
1920 Handle<ScopeInfo> scope_info = OpParameter<Handle<ScopeInfo>>(node); | 1912 Handle<ScopeInfo> scope_info = OpParameter<Handle<ScopeInfo>>(node); |
1921 int context_length = scope_info->ContextLength(); | 1913 int context_length = scope_info->ContextLength(); |
1922 Node* const closure = NodeProperties::GetValueInput(node, 0); | 1914 Node* const closure = NodeProperties::GetValueInput(node, 0); |
1923 | 1915 |
1924 // Use inline allocation for block contexts up to a size limit. | 1916 // Use inline allocation for block contexts up to a size limit. |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2606 } | 2598 } |
2607 | 2599 |
2608 | 2600 |
2609 CompilationDependencies* JSTypedLowering::dependencies() const { | 2601 CompilationDependencies* JSTypedLowering::dependencies() const { |
2610 return dependencies_; | 2602 return dependencies_; |
2611 } | 2603 } |
2612 | 2604 |
2613 } // namespace compiler | 2605 } // namespace compiler |
2614 } // namespace internal | 2606 } // namespace internal |
2615 } // namespace v8 | 2607 } // namespace v8 |
OLD | NEW |