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

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

Issue 1090303004: [turbofan] Add a debug_name to Parameter operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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/common-operator.h ('k') | src/compiler/instruction-selector.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/common-operator.h" 5 #include "src/compiler/common-operator.h"
6 6
7 #include "src/assembler.h" 7 #include "src/assembler.h"
8 #include "src/base/lazy-instance.h" 8 #include "src/base/lazy-instance.h"
9 #include "src/compiler/linkage.h" 9 #include "src/compiler/linkage.h"
10 #include "src/compiler/opcodes.h" 10 #include "src/compiler/opcodes.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 << info.state_combine(); 102 << info.state_combine();
103 } 103 }
104 104
105 105
106 size_t ProjectionIndexOf(const Operator* const op) { 106 size_t ProjectionIndexOf(const Operator* const op) {
107 DCHECK_EQ(IrOpcode::kProjection, op->opcode()); 107 DCHECK_EQ(IrOpcode::kProjection, op->opcode());
108 return OpParameter<size_t>(op); 108 return OpParameter<size_t>(op);
109 } 109 }
110 110
111 111
112 int ParameterIndexOf(const Operator* const op) {
113 DCHECK_EQ(IrOpcode::kParameter, op->opcode());
114 return OpParameter<ParameterInfo>(op).index();
115 }
116
117
118 const ParameterInfo& ParameterInfoOf(const Operator* const op) {
119 DCHECK_EQ(IrOpcode::kParameter, op->opcode());
120 return OpParameter<ParameterInfo>(op);
121 }
122
123
124 bool operator==(ParameterInfo const& lhs, ParameterInfo const& rhs) {
125 return lhs.index() == rhs.index();
126 }
127
128
129 bool operator!=(ParameterInfo const& lhs, ParameterInfo const& rhs) {
130 return !(lhs == rhs);
131 }
132
133
134 size_t hash_value(ParameterInfo const& p) { return p.index(); }
135
136
137 std::ostream& operator<<(std::ostream& os, ParameterInfo const& i) {
138 if (i.debug_name()) os << i.debug_name() << '#';
139 os << i.index();
140 return os;
141 }
142
143
112 #define CACHED_OP_LIST(V) \ 144 #define CACHED_OP_LIST(V) \
113 V(Always, Operator::kPure, 0, 0, 0, 1, 0, 0) \ 145 V(Always, Operator::kPure, 0, 0, 0, 1, 0, 0) \
114 V(Dead, Operator::kFoldable, 0, 0, 0, 0, 0, 1) \ 146 V(Dead, Operator::kFoldable, 0, 0, 0, 0, 0, 1) \
115 V(End, Operator::kKontrol, 0, 0, 1, 0, 0, 0) \ 147 V(End, Operator::kKontrol, 0, 0, 1, 0, 0, 0) \
116 V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ 148 V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
117 V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ 149 V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
118 V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ 150 V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
119 V(IfException, Operator::kKontrol, 0, 0, 1, 1, 0, 1) \ 151 V(IfException, Operator::kKontrol, 0, 0, 1, 1, 0, 1) \
120 V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ 152 V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
121 V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \ 153 V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 "Phi", // name 301 "Phi", // name
270 kInputCount, 0, 1, 1, 0, 0, // counts 302 kInputCount, 0, 1, 1, 0, 0, // counts
271 kType) {} // parameter 303 kType) {} // parameter
272 }; 304 };
273 #define CACHED_PHI(type, input_count) \ 305 #define CACHED_PHI(type, input_count) \
274 PhiOperator<type, input_count> kPhi##type##input_count##Operator; 306 PhiOperator<type, input_count> kPhi##type##input_count##Operator;
275 CACHED_PHI_LIST(CACHED_PHI) 307 CACHED_PHI_LIST(CACHED_PHI)
276 #undef CACHED_PHI 308 #undef CACHED_PHI
277 309
278 template <int kIndex> 310 template <int kIndex>
279 struct ParameterOperator final : public Operator1<int> { 311 struct ParameterOperator final : public Operator1<ParameterInfo> {
280 ParameterOperator() 312 ParameterOperator()
281 : Operator1<int>( // -- 313 : Operator1<ParameterInfo>( // --
282 IrOpcode::kParameter, Operator::kPure, // opcode 314 IrOpcode::kParameter, Operator::kPure, // opcode
283 "Parameter", // name 315 "Parameter", // name
284 1, 0, 0, 1, 0, 0, // counts, 316 1, 0, 0, 1, 0, 0, // counts,
285 kIndex) {} // parameter 317 ParameterInfo(kIndex, nullptr)) {} // parameter and name
286 }; 318 };
287 #define CACHED_PARAMETER(index) \ 319 #define CACHED_PARAMETER(index) \
288 ParameterOperator<index> kParameter##index##Operator; 320 ParameterOperator<index> kParameter##index##Operator;
289 CACHED_PARAMETER_LIST(CACHED_PARAMETER) 321 CACHED_PARAMETER_LIST(CACHED_PARAMETER)
290 #undef CACHED_PARAMETER 322 #undef CACHED_PARAMETER
291 323
292 template <size_t kIndex> 324 template <size_t kIndex>
293 struct ProjectionOperator final : public Operator1<size_t> { 325 struct ProjectionOperator final : public Operator1<size_t> {
294 ProjectionOperator() 326 ProjectionOperator()
295 : Operator1<size_t>( // -- 327 : Operator1<size_t>( // --
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 break; 441 break;
410 } 442 }
411 // Uncached. 443 // Uncached.
412 return new (zone()) Operator( // -- 444 return new (zone()) Operator( // --
413 IrOpcode::kMerge, Operator::kKontrol, // opcode 445 IrOpcode::kMerge, Operator::kKontrol, // opcode
414 "Merge", // name 446 "Merge", // name
415 0, 0, control_input_count, 0, 0, 1); // counts 447 0, 0, control_input_count, 0, 0, 1); // counts
416 } 448 }
417 449
418 450
419 const Operator* CommonOperatorBuilder::Parameter(int index) { 451 const Operator* CommonOperatorBuilder::Parameter(int index,
420 switch (index) { 452 const char* debug_name) {
453 if (!debug_name) {
454 switch (index) {
421 #define CACHED_PARAMETER(index) \ 455 #define CACHED_PARAMETER(index) \
422 case index: \ 456 case index: \
423 return &cache_.kParameter##index##Operator; 457 return &cache_.kParameter##index##Operator;
424 CACHED_PARAMETER_LIST(CACHED_PARAMETER) 458 CACHED_PARAMETER_LIST(CACHED_PARAMETER)
425 #undef CACHED_PARAMETER 459 #undef CACHED_PARAMETER
426 default: 460 default:
427 break; 461 break;
462 }
428 } 463 }
429 // Uncached. 464 // Uncached.
430 return new (zone()) Operator1<int>( // -- 465 return new (zone()) Operator1<ParameterInfo>( // --
431 IrOpcode::kParameter, Operator::kPure, // opcode 466 IrOpcode::kParameter, Operator::kPure, // opcode
432 "Parameter", // name 467 "Parameter", // name
433 1, 0, 0, 1, 0, 0, // counts 468 1, 0, 0, 1, 0, 0, // counts
434 index); // parameter 469 ParameterInfo(index, debug_name)); // parameter info
435 } 470 }
436 471
437 472
438 const Operator* CommonOperatorBuilder::OsrValue(int index) { 473 const Operator* CommonOperatorBuilder::OsrValue(int index) {
439 return new (zone()) Operator1<int>( // -- 474 return new (zone()) Operator1<int>( // --
440 IrOpcode::kOsrValue, Operator::kNoProperties, // opcode 475 IrOpcode::kOsrValue, Operator::kNoProperties, // opcode
441 "OsrValue", // name 476 "OsrValue", // name
442 0, 0, 1, 1, 0, 0, // counts 477 0, 0, 1, 1, 0, 0, // counts
443 index); // parameter 478 index); // parameter
444 } 479 }
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 } else { 713 } else {
679 UNREACHABLE(); 714 UNREACHABLE();
680 return nullptr; 715 return nullptr;
681 } 716 }
682 } 717 }
683 718
684 719
685 } // namespace compiler 720 } // namespace compiler
686 } // namespace internal 721 } // namespace internal
687 } // namespace v8 722 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/common-operator.h ('k') | src/compiler/instruction-selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698