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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 } | 746 } |
747 } | 747 } |
748 | 748 |
749 return ReduceNewArrayToStubCall(node, site); | 749 return ReduceNewArrayToStubCall(node, site); |
750 } | 750 } |
751 | 751 |
752 Reduction JSCreateLowering::ReduceJSCreateClosure(Node* node) { | 752 Reduction JSCreateLowering::ReduceJSCreateClosure(Node* node) { |
753 DCHECK_EQ(IrOpcode::kJSCreateClosure, node->opcode()); | 753 DCHECK_EQ(IrOpcode::kJSCreateClosure, node->opcode()); |
754 CreateClosureParameters const& p = CreateClosureParametersOf(node->op()); | 754 CreateClosureParameters const& p = CreateClosureParametersOf(node->op()); |
755 Handle<SharedFunctionInfo> shared = p.shared_info(); | 755 Handle<SharedFunctionInfo> shared = p.shared_info(); |
756 | |
757 Node* effect = NodeProperties::GetEffectInput(node); | 756 Node* effect = NodeProperties::GetEffectInput(node); |
758 Node* control = NodeProperties::GetControlInput(node); | 757 Node* control = NodeProperties::GetControlInput(node); |
759 Node* context = NodeProperties::GetContextInput(node); | 758 Node* context = NodeProperties::GetContextInput(node); |
| 759 |
760 int const function_map_index = | 760 int const function_map_index = |
761 Context::FunctionMapIndex(shared->language_mode(), shared->kind()); | 761 Context::FunctionMapIndex(shared->language_mode(), shared->kind()); |
762 Node* function_map = jsgraph()->HeapConstant( | 762 Node* function_map = jsgraph()->HeapConstant( |
763 handle(Map::cast(native_context()->get(function_map_index)), isolate())); | 763 handle(Map::cast(native_context()->get(function_map_index)), isolate())); |
| 764 |
| 765 FeedbackVectorSlot slot = p.feedback().slot(); |
| 766 Node* literals = jsgraph()->HeapConstant( |
| 767 handle(LiteralsArray::cast(p.feedback().vector()->Get(slot)), isolate())); |
| 768 |
764 // Note that it is only safe to embed the raw entry point of the compile | 769 // Note that it is only safe to embed the raw entry point of the compile |
765 // lazy stub into the code, because that stub is immortal and immovable. | 770 // lazy stub into the code, because that stub is immortal and immovable. |
766 Node* compile_entry = jsgraph()->PointerConstant( | 771 Node* compile_entry = jsgraph()->PointerConstant( |
767 jsgraph()->isolate()->builtins()->CompileLazy()->entry()); | 772 jsgraph()->isolate()->builtins()->CompileLazy()->entry()); |
768 Node* empty_fixed_array = jsgraph()->EmptyFixedArrayConstant(); | 773 Node* empty_fixed_array = jsgraph()->EmptyFixedArrayConstant(); |
769 Node* empty_literals_array = jsgraph()->EmptyLiteralsArrayConstant(); | 774 // TODO(mvstanton): With literals retrieved from the vector, we can |
| 775 // remove EmptyLiteralsArrayConstant() from jsgraph(). |
770 Node* the_hole = jsgraph()->TheHoleConstant(); | 776 Node* the_hole = jsgraph()->TheHoleConstant(); |
771 Node* undefined = jsgraph()->UndefinedConstant(); | 777 Node* undefined = jsgraph()->UndefinedConstant(); |
772 AllocationBuilder a(jsgraph(), effect, control); | 778 AllocationBuilder a(jsgraph(), effect, control); |
773 STATIC_ASSERT(JSFunction::kSize == 9 * kPointerSize); | 779 STATIC_ASSERT(JSFunction::kSize == 9 * kPointerSize); |
774 a.Allocate(JSFunction::kSize, p.pretenure()); | 780 a.Allocate(JSFunction::kSize, p.pretenure()); |
775 a.Store(AccessBuilder::ForMap(), function_map); | 781 a.Store(AccessBuilder::ForMap(), function_map); |
776 a.Store(AccessBuilder::ForJSObjectProperties(), empty_fixed_array); | 782 a.Store(AccessBuilder::ForJSObjectProperties(), empty_fixed_array); |
777 a.Store(AccessBuilder::ForJSObjectElements(), empty_fixed_array); | 783 a.Store(AccessBuilder::ForJSObjectElements(), empty_fixed_array); |
778 a.Store(AccessBuilder::ForJSFunctionLiterals(), empty_literals_array); | 784 a.Store(AccessBuilder::ForJSFunctionLiterals(), literals); |
779 a.Store(AccessBuilder::ForJSFunctionPrototypeOrInitialMap(), the_hole); | 785 a.Store(AccessBuilder::ForJSFunctionPrototypeOrInitialMap(), the_hole); |
780 a.Store(AccessBuilder::ForJSFunctionSharedFunctionInfo(), shared); | 786 a.Store(AccessBuilder::ForJSFunctionSharedFunctionInfo(), shared); |
781 a.Store(AccessBuilder::ForJSFunctionContext(), context); | 787 a.Store(AccessBuilder::ForJSFunctionContext(), context); |
782 a.Store(AccessBuilder::ForJSFunctionCodeEntry(), compile_entry); | 788 a.Store(AccessBuilder::ForJSFunctionCodeEntry(), compile_entry); |
783 a.Store(AccessBuilder::ForJSFunctionNextFunctionLink(), undefined); | 789 a.Store(AccessBuilder::ForJSFunctionNextFunctionLink(), undefined); |
784 RelaxControls(node); | 790 RelaxControls(node); |
785 a.FinishAndChange(node); | 791 a.FinishAndChange(node); |
786 return Changed(node); | 792 return Changed(node); |
787 } | 793 } |
788 | 794 |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1377 return jsgraph()->simplified(); | 1383 return jsgraph()->simplified(); |
1378 } | 1384 } |
1379 | 1385 |
1380 MachineOperatorBuilder* JSCreateLowering::machine() const { | 1386 MachineOperatorBuilder* JSCreateLowering::machine() const { |
1381 return jsgraph()->machine(); | 1387 return jsgraph()->machine(); |
1382 } | 1388 } |
1383 | 1389 |
1384 } // namespace compiler | 1390 } // namespace compiler |
1385 } // namespace internal | 1391 } // namespace internal |
1386 } // namespace v8 | 1392 } // namespace v8 |
OLD | NEW |