Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: src/compiler/js-create-lowering.cc

Issue 2504153002: [TypeFeedbackVector] Root literal arrays in function literals slots (Closed)
Patch Set: REBASE. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 } 744 }
745 } 745 }
746 746
747 return ReduceNewArrayToStubCall(node, site); 747 return ReduceNewArrayToStubCall(node, site);
748 } 748 }
749 749
750 Reduction JSCreateLowering::ReduceJSCreateClosure(Node* node) { 750 Reduction JSCreateLowering::ReduceJSCreateClosure(Node* node) {
751 DCHECK_EQ(IrOpcode::kJSCreateClosure, node->opcode()); 751 DCHECK_EQ(IrOpcode::kJSCreateClosure, node->opcode());
752 CreateClosureParameters const& p = CreateClosureParametersOf(node->op()); 752 CreateClosureParameters const& p = CreateClosureParametersOf(node->op());
753 Handle<SharedFunctionInfo> shared = p.shared_info(); 753 Handle<SharedFunctionInfo> shared = p.shared_info();
754
755 Node* effect = NodeProperties::GetEffectInput(node); 754 Node* effect = NodeProperties::GetEffectInput(node);
756 Node* control = NodeProperties::GetControlInput(node); 755 Node* control = NodeProperties::GetControlInput(node);
757 Node* context = NodeProperties::GetContextInput(node); 756 Node* context = NodeProperties::GetContextInput(node);
757
758 int const function_map_index = 758 int const function_map_index =
759 Context::FunctionMapIndex(shared->language_mode(), shared->kind()); 759 Context::FunctionMapIndex(shared->language_mode(), shared->kind());
760 Node* function_map = jsgraph()->HeapConstant( 760 Node* function_map = jsgraph()->HeapConstant(
761 handle(Map::cast(native_context()->get(function_map_index)), isolate())); 761 handle(Map::cast(native_context()->get(function_map_index)), isolate()));
762
763 FeedbackVectorSlot slot = p.feedback().slot();
764 Node* literals = jsgraph()->HeapConstant(
765 handle(LiteralsArray::cast(p.feedback().vector()->Get(slot)), isolate()));
766
762 // Note that it is only safe to embed the raw entry point of the compile 767 // Note that it is only safe to embed the raw entry point of the compile
763 // lazy stub into the code, because that stub is immortal and immovable. 768 // lazy stub into the code, because that stub is immortal and immovable.
764 Node* compile_entry = jsgraph()->PointerConstant( 769 Node* compile_entry = jsgraph()->PointerConstant(
765 jsgraph()->isolate()->builtins()->CompileLazy()->entry()); 770 jsgraph()->isolate()->builtins()->CompileLazy()->entry());
766 Node* empty_fixed_array = jsgraph()->EmptyFixedArrayConstant(); 771 Node* empty_fixed_array = jsgraph()->EmptyFixedArrayConstant();
767 Node* empty_literals_array = jsgraph()->EmptyLiteralsArrayConstant(); 772 // TODO(mvstanton): With literals retrieved from the vector, we can
Benedikt Meurer 2016/12/10 17:20:36 Do it :-)
mvstanton 2016/12/21 13:09:13 The CL is bursting at the seams, so I'll wait (but
773 // remove EmptyLiteralsArrayConstant() from jsgraph().
768 Node* the_hole = jsgraph()->TheHoleConstant(); 774 Node* the_hole = jsgraph()->TheHoleConstant();
769 Node* undefined = jsgraph()->UndefinedConstant(); 775 Node* undefined = jsgraph()->UndefinedConstant();
770 AllocationBuilder a(jsgraph(), effect, control); 776 AllocationBuilder a(jsgraph(), effect, control);
771 STATIC_ASSERT(JSFunction::kSize == 9 * kPointerSize); 777 STATIC_ASSERT(JSFunction::kSize == 9 * kPointerSize);
772 a.Allocate(JSFunction::kSize, p.pretenure()); 778 a.Allocate(JSFunction::kSize, p.pretenure());
773 a.Store(AccessBuilder::ForMap(), function_map); 779 a.Store(AccessBuilder::ForMap(), function_map);
774 a.Store(AccessBuilder::ForJSObjectProperties(), empty_fixed_array); 780 a.Store(AccessBuilder::ForJSObjectProperties(), empty_fixed_array);
775 a.Store(AccessBuilder::ForJSObjectElements(), empty_fixed_array); 781 a.Store(AccessBuilder::ForJSObjectElements(), empty_fixed_array);
776 a.Store(AccessBuilder::ForJSFunctionLiterals(), empty_literals_array); 782 a.Store(AccessBuilder::ForJSFunctionLiterals(), literals);
777 a.Store(AccessBuilder::ForJSFunctionPrototypeOrInitialMap(), the_hole); 783 a.Store(AccessBuilder::ForJSFunctionPrototypeOrInitialMap(), the_hole);
778 a.Store(AccessBuilder::ForJSFunctionSharedFunctionInfo(), shared); 784 a.Store(AccessBuilder::ForJSFunctionSharedFunctionInfo(), shared);
779 a.Store(AccessBuilder::ForJSFunctionContext(), context); 785 a.Store(AccessBuilder::ForJSFunctionContext(), context);
780 a.Store(AccessBuilder::ForJSFunctionCodeEntry(), compile_entry); 786 a.Store(AccessBuilder::ForJSFunctionCodeEntry(), compile_entry);
781 a.Store(AccessBuilder::ForJSFunctionNextFunctionLink(), undefined); 787 a.Store(AccessBuilder::ForJSFunctionNextFunctionLink(), undefined);
782 RelaxControls(node); 788 RelaxControls(node);
783 a.FinishAndChange(node); 789 a.FinishAndChange(node);
784 return Changed(node); 790 return Changed(node);
785 } 791 }
786 792
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 return jsgraph()->simplified(); 1367 return jsgraph()->simplified();
1362 } 1368 }
1363 1369
1364 MachineOperatorBuilder* JSCreateLowering::machine() const { 1370 MachineOperatorBuilder* JSCreateLowering::machine() const {
1365 return jsgraph()->machine(); 1371 return jsgraph()->machine();
1366 } 1372 }
1367 1373
1368 } // namespace compiler 1374 } // namespace compiler
1369 } // namespace internal 1375 } // namespace internal
1370 } // namespace v8 1376 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698