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

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

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-native-context-specialization.cc ('k') | src/compiler/js-operator.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 #ifndef V8_COMPILER_JS_OPERATOR_H_ 5 #ifndef V8_COMPILER_JS_OPERATOR_H_
6 #define V8_COMPILER_JS_OPERATOR_H_ 6 #define V8_COMPILER_JS_OPERATOR_H_
7 7
8 #include "src/compiler/type-hints.h" 8 #include "src/compiler/type-hints.h"
9 #include "src/runtime/runtime.h" 9 #include "src/runtime/runtime.h"
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 49
50 // The ToBooleanHints are used as parameter by JSToBoolean operators. 50 // The ToBooleanHints are used as parameter by JSToBoolean operators.
51 ToBooleanHints ToBooleanHintsOf(Operator const* op); 51 ToBooleanHints ToBooleanHintsOf(Operator const* op);
52 52
53 53
54 // Defines the arity and the feedback for a JavaScript constructor call. This is 54 // Defines the arity and the feedback for a JavaScript constructor call. This is
55 // used as a parameter by JSCallConstruct operators. 55 // used as a parameter by JSCallConstruct operators.
56 class CallConstructParameters final { 56 class CallConstructParameters final {
57 public: 57 public:
58 CallConstructParameters(size_t arity, VectorSlotPair const& feedback) 58 CallConstructParameters(uint32_t arity, float frequency,
59 : arity_(arity), feedback_(feedback) {} 59 VectorSlotPair const& feedback)
60 : arity_(arity), frequency_(frequency), feedback_(feedback) {}
60 61
61 size_t arity() const { return arity_; } 62 uint32_t arity() const { return arity_; }
63 float frequency() const { return frequency_; }
62 VectorSlotPair const& feedback() const { return feedback_; } 64 VectorSlotPair const& feedback() const { return feedback_; }
63 65
64 private: 66 private:
65 size_t const arity_; 67 uint32_t const arity_;
68 float const frequency_;
66 VectorSlotPair const feedback_; 69 VectorSlotPair const feedback_;
67 }; 70 };
68 71
69 bool operator==(CallConstructParameters const&, CallConstructParameters const&); 72 bool operator==(CallConstructParameters const&, CallConstructParameters const&);
70 bool operator!=(CallConstructParameters const&, CallConstructParameters const&); 73 bool operator!=(CallConstructParameters const&, CallConstructParameters const&);
71 74
72 size_t hash_value(CallConstructParameters const&); 75 size_t hash_value(CallConstructParameters const&);
73 76
74 std::ostream& operator<<(std::ostream&, CallConstructParameters const&); 77 std::ostream& operator<<(std::ostream&, CallConstructParameters const&);
75 78
76 CallConstructParameters const& CallConstructParametersOf(Operator const*); 79 CallConstructParameters const& CallConstructParametersOf(Operator const*);
77 80
78 81
79 // Defines the arity and the call flags for a JavaScript function call. This is 82 // Defines the arity and the call flags for a JavaScript function call. This is
80 // used as a parameter by JSCallFunction operators. 83 // used as a parameter by JSCallFunction operators.
81 class CallFunctionParameters final { 84 class CallFunctionParameters final {
82 public: 85 public:
83 CallFunctionParameters(size_t arity, VectorSlotPair const& feedback, 86 CallFunctionParameters(size_t arity, float frequency,
87 VectorSlotPair const& feedback,
84 TailCallMode tail_call_mode, 88 TailCallMode tail_call_mode,
85 ConvertReceiverMode convert_mode) 89 ConvertReceiverMode convert_mode)
86 : bit_field_(ArityField::encode(arity) | 90 : bit_field_(ArityField::encode(arity) |
87 ConvertReceiverModeField::encode(convert_mode) | 91 ConvertReceiverModeField::encode(convert_mode) |
88 TailCallModeField::encode(tail_call_mode)), 92 TailCallModeField::encode(tail_call_mode)),
93 frequency_(frequency),
89 feedback_(feedback) {} 94 feedback_(feedback) {}
90 95
91 size_t arity() const { return ArityField::decode(bit_field_); } 96 size_t arity() const { return ArityField::decode(bit_field_); }
97 float frequency() const { return frequency_; }
92 ConvertReceiverMode convert_mode() const { 98 ConvertReceiverMode convert_mode() const {
93 return ConvertReceiverModeField::decode(bit_field_); 99 return ConvertReceiverModeField::decode(bit_field_);
94 } 100 }
95 TailCallMode tail_call_mode() const { 101 TailCallMode tail_call_mode() const {
96 return TailCallModeField::decode(bit_field_); 102 return TailCallModeField::decode(bit_field_);
97 } 103 }
98 VectorSlotPair const& feedback() const { return feedback_; } 104 VectorSlotPair const& feedback() const { return feedback_; }
99 105
100 bool operator==(CallFunctionParameters const& that) const { 106 bool operator==(CallFunctionParameters const& that) const {
101 return this->bit_field_ == that.bit_field_ && 107 return this->bit_field_ == that.bit_field_ &&
108 this->frequency_ == that.frequency_ &&
102 this->feedback_ == that.feedback_; 109 this->feedback_ == that.feedback_;
103 } 110 }
104 bool operator!=(CallFunctionParameters const& that) const { 111 bool operator!=(CallFunctionParameters const& that) const {
105 return !(*this == that); 112 return !(*this == that);
106 } 113 }
107 114
108 private: 115 private:
109 friend size_t hash_value(CallFunctionParameters const& p) { 116 friend size_t hash_value(CallFunctionParameters const& p) {
110 return base::hash_combine(p.bit_field_, p.feedback_); 117 return base::hash_combine(p.bit_field_, p.frequency_, p.feedback_);
111 } 118 }
112 119
113 typedef BitField<size_t, 0, 29> ArityField; 120 typedef BitField<size_t, 0, 29> ArityField;
114 typedef BitField<ConvertReceiverMode, 29, 2> ConvertReceiverModeField; 121 typedef BitField<ConvertReceiverMode, 29, 2> ConvertReceiverModeField;
115 typedef BitField<TailCallMode, 31, 1> TailCallModeField; 122 typedef BitField<TailCallMode, 31, 1> TailCallModeField;
116 123
117 const uint32_t bit_field_; 124 uint32_t const bit_field_;
118 const VectorSlotPair feedback_; 125 float const frequency_;
126 VectorSlotPair const feedback_;
119 }; 127 };
120 128
121 size_t hash_value(CallFunctionParameters const&); 129 size_t hash_value(CallFunctionParameters const&);
122 130
123 std::ostream& operator<<(std::ostream&, CallFunctionParameters const&); 131 std::ostream& operator<<(std::ostream&, CallFunctionParameters const&);
124 132
125 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op); 133 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op);
126 134
127 135
128 // Defines the arity and the ID for a runtime function call. This is used as a 136 // Defines the arity and the ID for a runtime function call. This is used as a
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 const Operator* CreateLiteralArray(Handle<FixedArray> constant_elements, 458 const Operator* CreateLiteralArray(Handle<FixedArray> constant_elements,
451 int literal_flags, int literal_index, 459 int literal_flags, int literal_index,
452 int number_of_elements); 460 int number_of_elements);
453 const Operator* CreateLiteralObject(Handle<FixedArray> constant_properties, 461 const Operator* CreateLiteralObject(Handle<FixedArray> constant_properties,
454 int literal_flags, int literal_index, 462 int literal_flags, int literal_index,
455 int number_of_properties); 463 int number_of_properties);
456 const Operator* CreateLiteralRegExp(Handle<String> constant_pattern, 464 const Operator* CreateLiteralRegExp(Handle<String> constant_pattern,
457 int literal_flags, int literal_index); 465 int literal_flags, int literal_index);
458 466
459 const Operator* CallFunction( 467 const Operator* CallFunction(
460 size_t arity, VectorSlotPair const& feedback = VectorSlotPair(), 468 size_t arity, float frequency = 0.0f,
469 VectorSlotPair const& feedback = VectorSlotPair(),
461 ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny, 470 ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny,
462 TailCallMode tail_call_mode = TailCallMode::kDisallow); 471 TailCallMode tail_call_mode = TailCallMode::kDisallow);
463 const Operator* CallRuntime(Runtime::FunctionId id); 472 const Operator* CallRuntime(Runtime::FunctionId id);
464 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); 473 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity);
465 const Operator* CallRuntime(const Runtime::Function* function, size_t arity); 474 const Operator* CallRuntime(const Runtime::Function* function, size_t arity);
466 const Operator* CallConstruct(size_t arity, VectorSlotPair const& feedback); 475 const Operator* CallConstruct(uint32_t arity, float frequency,
476 VectorSlotPair const& feedback);
467 477
468 const Operator* ConvertReceiver(ConvertReceiverMode convert_mode); 478 const Operator* ConvertReceiver(ConvertReceiverMode convert_mode);
469 479
470 const Operator* LoadProperty(VectorSlotPair const& feedback); 480 const Operator* LoadProperty(VectorSlotPair const& feedback);
471 const Operator* LoadNamed(Handle<Name> name, VectorSlotPair const& feedback); 481 const Operator* LoadNamed(Handle<Name> name, VectorSlotPair const& feedback);
472 482
473 const Operator* StoreProperty(LanguageMode language_mode, 483 const Operator* StoreProperty(LanguageMode language_mode,
474 VectorSlotPair const& feedback); 484 VectorSlotPair const& feedback);
475 const Operator* StoreNamed(LanguageMode language_mode, Handle<Name> name, 485 const Operator* StoreNamed(LanguageMode language_mode, Handle<Name> name,
476 VectorSlotPair const& feedback); 486 VectorSlotPair const& feedback);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 Zone* const zone_; 532 Zone* const zone_;
523 533
524 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); 534 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder);
525 }; 535 };
526 536
527 } // namespace compiler 537 } // namespace compiler
528 } // namespace internal 538 } // namespace internal
529 } // namespace v8 539 } // namespace v8
530 540
531 #endif // V8_COMPILER_JS_OPERATOR_H_ 541 #endif // V8_COMPILER_JS_OPERATOR_H_
OLDNEW
« no previous file with comments | « src/compiler/js-native-context-specialization.cc ('k') | src/compiler/js-operator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698