| 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 |
| 756 Node* effect = NodeProperties::GetEffectInput(node); | 757 Node* effect = NodeProperties::GetEffectInput(node); |
| 757 Node* control = NodeProperties::GetControlInput(node); | 758 Node* control = NodeProperties::GetControlInput(node); |
| 758 Node* context = NodeProperties::GetContextInput(node); | 759 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 | |
| 769 // Note that it is only safe to embed the raw entry point of the compile | 764 // Note that it is only safe to embed the raw entry point of the compile |
| 770 // lazy stub into the code, because that stub is immortal and immovable. | 765 // lazy stub into the code, because that stub is immortal and immovable. |
| 771 Node* compile_entry = jsgraph()->PointerConstant( | 766 Node* compile_entry = jsgraph()->PointerConstant( |
| 772 jsgraph()->isolate()->builtins()->CompileLazy()->entry()); | 767 jsgraph()->isolate()->builtins()->CompileLazy()->entry()); |
| 773 Node* empty_fixed_array = jsgraph()->EmptyFixedArrayConstant(); | 768 Node* empty_fixed_array = jsgraph()->EmptyFixedArrayConstant(); |
| 774 // TODO(mvstanton): With literals retrieved from the vector, we can | 769 Node* empty_literals_array = jsgraph()->EmptyLiteralsArrayConstant(); |
| 775 // remove EmptyLiteralsArrayConstant() from jsgraph(). | |
| 776 Node* the_hole = jsgraph()->TheHoleConstant(); | 770 Node* the_hole = jsgraph()->TheHoleConstant(); |
| 777 Node* undefined = jsgraph()->UndefinedConstant(); | 771 Node* undefined = jsgraph()->UndefinedConstant(); |
| 778 AllocationBuilder a(jsgraph(), effect, control); | 772 AllocationBuilder a(jsgraph(), effect, control); |
| 779 STATIC_ASSERT(JSFunction::kSize == 9 * kPointerSize); | 773 STATIC_ASSERT(JSFunction::kSize == 9 * kPointerSize); |
| 780 a.Allocate(JSFunction::kSize, p.pretenure()); | 774 a.Allocate(JSFunction::kSize, p.pretenure()); |
| 781 a.Store(AccessBuilder::ForMap(), function_map); | 775 a.Store(AccessBuilder::ForMap(), function_map); |
| 782 a.Store(AccessBuilder::ForJSObjectProperties(), empty_fixed_array); | 776 a.Store(AccessBuilder::ForJSObjectProperties(), empty_fixed_array); |
| 783 a.Store(AccessBuilder::ForJSObjectElements(), empty_fixed_array); | 777 a.Store(AccessBuilder::ForJSObjectElements(), empty_fixed_array); |
| 784 a.Store(AccessBuilder::ForJSFunctionLiterals(), literals); | 778 a.Store(AccessBuilder::ForJSFunctionLiterals(), empty_literals_array); |
| 785 a.Store(AccessBuilder::ForJSFunctionPrototypeOrInitialMap(), the_hole); | 779 a.Store(AccessBuilder::ForJSFunctionPrototypeOrInitialMap(), the_hole); |
| 786 a.Store(AccessBuilder::ForJSFunctionSharedFunctionInfo(), shared); | 780 a.Store(AccessBuilder::ForJSFunctionSharedFunctionInfo(), shared); |
| 787 a.Store(AccessBuilder::ForJSFunctionContext(), context); | 781 a.Store(AccessBuilder::ForJSFunctionContext(), context); |
| 788 a.Store(AccessBuilder::ForJSFunctionCodeEntry(), compile_entry); | 782 a.Store(AccessBuilder::ForJSFunctionCodeEntry(), compile_entry); |
| 789 a.Store(AccessBuilder::ForJSFunctionNextFunctionLink(), undefined); | 783 a.Store(AccessBuilder::ForJSFunctionNextFunctionLink(), undefined); |
| 790 RelaxControls(node); | 784 RelaxControls(node); |
| 791 a.FinishAndChange(node); | 785 a.FinishAndChange(node); |
| 792 return Changed(node); | 786 return Changed(node); |
| 793 } | 787 } |
| 794 | 788 |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 return jsgraph()->simplified(); | 1377 return jsgraph()->simplified(); |
| 1384 } | 1378 } |
| 1385 | 1379 |
| 1386 MachineOperatorBuilder* JSCreateLowering::machine() const { | 1380 MachineOperatorBuilder* JSCreateLowering::machine() const { |
| 1387 return jsgraph()->machine(); | 1381 return jsgraph()->machine(); |
| 1388 } | 1382 } |
| 1389 | 1383 |
| 1390 } // namespace compiler | 1384 } // namespace compiler |
| 1391 } // namespace internal | 1385 } // namespace internal |
| 1392 } // namespace v8 | 1386 } // namespace v8 |
| OLD | NEW |