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

Side by Side Diff: src/compiler/js-operator.cc

Issue 2330883002: [turbofan] Call frequencies for JSCallFunction and JSCallConstruct. (Closed)
Patch Set: Rebase onto the correct CL. Created 4 years, 3 months 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
« no previous file with comments | « src/compiler/js-operator.h ('k') | src/compiler/js-typed-lowering.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/compiler/js-operator.h" 5 #include "src/compiler/js-operator.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/lazy-instance.h" 9 #include "src/base/lazy-instance.h"
10 #include "src/compiler/opcodes.h" 10 #include "src/compiler/opcodes.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 48
49 ToBooleanHints ToBooleanHintsOf(Operator const* op) { 49 ToBooleanHints ToBooleanHintsOf(Operator const* op) {
50 DCHECK_EQ(IrOpcode::kJSToBoolean, op->opcode()); 50 DCHECK_EQ(IrOpcode::kJSToBoolean, op->opcode());
51 return OpParameter<ToBooleanHints>(op); 51 return OpParameter<ToBooleanHints>(op);
52 } 52 }
53 53
54 54
55 bool operator==(CallConstructParameters const& lhs, 55 bool operator==(CallConstructParameters const& lhs,
56 CallConstructParameters const& rhs) { 56 CallConstructParameters const& rhs) {
57 return lhs.arity() == rhs.arity() && lhs.feedback() == rhs.feedback(); 57 return lhs.arity() == rhs.arity() && lhs.frequency() == rhs.frequency() &&
58 lhs.feedback() == rhs.feedback();
58 } 59 }
59 60
60 61
61 bool operator!=(CallConstructParameters const& lhs, 62 bool operator!=(CallConstructParameters const& lhs,
62 CallConstructParameters const& rhs) { 63 CallConstructParameters const& rhs) {
63 return !(lhs == rhs); 64 return !(lhs == rhs);
64 } 65 }
65 66
66 67
67 size_t hash_value(CallConstructParameters const& p) { 68 size_t hash_value(CallConstructParameters const& p) {
68 return base::hash_combine(p.arity(), p.feedback()); 69 return base::hash_combine(p.arity(), p.frequency(), p.feedback());
69 } 70 }
70 71
71 72
72 std::ostream& operator<<(std::ostream& os, CallConstructParameters const& p) { 73 std::ostream& operator<<(std::ostream& os, CallConstructParameters const& p) {
73 return os << p.arity(); 74 return os << p.arity() << ", " << p.frequency();
74 } 75 }
75 76
76 77
77 CallConstructParameters const& CallConstructParametersOf(Operator const* op) { 78 CallConstructParameters const& CallConstructParametersOf(Operator const* op) {
78 DCHECK_EQ(IrOpcode::kJSCallConstruct, op->opcode()); 79 DCHECK_EQ(IrOpcode::kJSCallConstruct, op->opcode());
79 return OpParameter<CallConstructParameters>(op); 80 return OpParameter<CallConstructParameters>(op);
80 } 81 }
81 82
82 83
83 std::ostream& operator<<(std::ostream& os, CallFunctionParameters const& p) { 84 std::ostream& operator<<(std::ostream& os, CallFunctionParameters const& p) {
84 os << p.arity() << ", " << p.convert_mode() << ", " << p.tail_call_mode(); 85 os << p.arity() << ", " << p.frequency() << ", " << p.convert_mode() << ", "
86 << p.tail_call_mode();
85 return os; 87 return os;
86 } 88 }
87 89
88 90
89 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op) { 91 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op) {
90 DCHECK_EQ(IrOpcode::kJSCallFunction, op->opcode()); 92 DCHECK_EQ(IrOpcode::kJSCallFunction, op->opcode());
91 return OpParameter<CallFunctionParameters>(op); 93 return OpParameter<CallFunctionParameters>(op);
92 } 94 }
93 95
94 96
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) { 585 const Operator* JSOperatorBuilder::ToBoolean(ToBooleanHints hints) {
584 // TODO(turbofan): Cache most important versions of this operator. 586 // TODO(turbofan): Cache most important versions of this operator.
585 return new (zone()) Operator1<ToBooleanHints>( //-- 587 return new (zone()) Operator1<ToBooleanHints>( //--
586 IrOpcode::kJSToBoolean, Operator::kPure, // opcode 588 IrOpcode::kJSToBoolean, Operator::kPure, // opcode
587 "JSToBoolean", // name 589 "JSToBoolean", // name
588 1, 0, 0, 1, 0, 0, // inputs/outputs 590 1, 0, 0, 1, 0, 0, // inputs/outputs
589 hints); // parameter 591 hints); // parameter
590 } 592 }
591 593
592 const Operator* JSOperatorBuilder::CallFunction( 594 const Operator* JSOperatorBuilder::CallFunction(
593 size_t arity, VectorSlotPair const& feedback, 595 size_t arity, float frequency, VectorSlotPair const& feedback,
594 ConvertReceiverMode convert_mode, TailCallMode tail_call_mode) { 596 ConvertReceiverMode convert_mode, TailCallMode tail_call_mode) {
595 CallFunctionParameters parameters(arity, feedback, tail_call_mode, 597 CallFunctionParameters parameters(arity, frequency, feedback, tail_call_mode,
596 convert_mode); 598 convert_mode);
597 return new (zone()) Operator1<CallFunctionParameters>( // -- 599 return new (zone()) Operator1<CallFunctionParameters>( // --
598 IrOpcode::kJSCallFunction, Operator::kNoProperties, // opcode 600 IrOpcode::kJSCallFunction, Operator::kNoProperties, // opcode
599 "JSCallFunction", // name 601 "JSCallFunction", // name
600 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs 602 parameters.arity(), 1, 1, 1, 1, 2, // inputs/outputs
601 parameters); // parameter 603 parameters); // parameter
602 } 604 }
603 605
604 606
605 const Operator* JSOperatorBuilder::CallRuntime(Runtime::FunctionId id) { 607 const Operator* JSOperatorBuilder::CallRuntime(Runtime::FunctionId id) {
(...skipping 13 matching lines...) Expand all
619 size_t arity) { 621 size_t arity) {
620 CallRuntimeParameters parameters(f->function_id, arity); 622 CallRuntimeParameters parameters(f->function_id, arity);
621 DCHECK(f->nargs == -1 || f->nargs == static_cast<int>(parameters.arity())); 623 DCHECK(f->nargs == -1 || f->nargs == static_cast<int>(parameters.arity()));
622 return new (zone()) Operator1<CallRuntimeParameters>( // -- 624 return new (zone()) Operator1<CallRuntimeParameters>( // --
623 IrOpcode::kJSCallRuntime, Operator::kNoProperties, // opcode 625 IrOpcode::kJSCallRuntime, Operator::kNoProperties, // opcode
624 "JSCallRuntime", // name 626 "JSCallRuntime", // name
625 parameters.arity(), 1, 1, f->result_size, 1, 2, // inputs/outputs 627 parameters.arity(), 1, 1, f->result_size, 1, 2, // inputs/outputs
626 parameters); // parameter 628 parameters); // parameter
627 } 629 }
628 630
629
630 const Operator* JSOperatorBuilder::CallConstruct( 631 const Operator* JSOperatorBuilder::CallConstruct(
631 size_t arity, VectorSlotPair const& feedback) { 632 uint32_t arity, float frequency, VectorSlotPair const& feedback) {
632 CallConstructParameters parameters(arity, feedback); 633 CallConstructParameters parameters(arity, frequency, feedback);
633 return new (zone()) Operator1<CallConstructParameters>( // -- 634 return new (zone()) Operator1<CallConstructParameters>( // --
634 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode 635 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode
635 "JSCallConstruct", // name 636 "JSCallConstruct", // name
636 parameters.arity(), 1, 1, 1, 1, 2, // counts 637 parameters.arity(), 1, 1, 1, 1, 2, // counts
637 parameters); // parameter 638 parameters); // parameter
638 } 639 }
639 640
640 641
641 const Operator* JSOperatorBuilder::ConvertReceiver( 642 const Operator* JSOperatorBuilder::ConvertReceiver(
642 ConvertReceiverMode convert_mode) { 643 ConvertReceiverMode convert_mode) {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- 874 return new (zone()) Operator1<Handle<ScopeInfo>>( // --
874 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode 875 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode
875 "JSCreateScriptContext", // name 876 "JSCreateScriptContext", // name
876 1, 1, 1, 1, 1, 2, // counts 877 1, 1, 1, 1, 1, 2, // counts
877 scpope_info); // parameter 878 scpope_info); // parameter
878 } 879 }
879 880
880 } // namespace compiler 881 } // namespace compiler
881 } // namespace internal 882 } // namespace internal
882 } // namespace v8 883 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-operator.h ('k') | src/compiler/js-typed-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698