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

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

Issue 892513003: [turbofan] Initial support for Switch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Wuschelstudio build. Created 5 years, 10 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/ia32/code-generator-ia32.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 18 matching lines...) Expand all
29 return os; 29 return os;
30 } 30 }
31 31
32 32
33 BranchHint BranchHintOf(const Operator* const op) { 33 BranchHint BranchHintOf(const Operator* const op) {
34 DCHECK_EQ(IrOpcode::kBranch, op->opcode()); 34 DCHECK_EQ(IrOpcode::kBranch, op->opcode());
35 return OpParameter<BranchHint>(op); 35 return OpParameter<BranchHint>(op);
36 } 36 }
37 37
38 38
39 size_t CaseIndexOf(const Operator* const op) {
40 DCHECK_EQ(IrOpcode::kCase, op->opcode());
41 return OpParameter<size_t>(op);
42 }
43
44
39 bool operator==(SelectParameters const& lhs, SelectParameters const& rhs) { 45 bool operator==(SelectParameters const& lhs, SelectParameters const& rhs) {
40 return lhs.type() == rhs.type() && lhs.hint() == rhs.hint(); 46 return lhs.type() == rhs.type() && lhs.hint() == rhs.hint();
41 } 47 }
42 48
43 49
44 bool operator!=(SelectParameters const& lhs, SelectParameters const& rhs) { 50 bool operator!=(SelectParameters const& lhs, SelectParameters const& rhs) {
45 return !(lhs == rhs); 51 return !(lhs == rhs);
46 } 52 }
47 53
48 54
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 case BranchHint::kTrue: 249 case BranchHint::kTrue:
244 return &cache_.kBranchTrueOperator; 250 return &cache_.kBranchTrueOperator;
245 case BranchHint::kFalse: 251 case BranchHint::kFalse:
246 return &cache_.kBranchFalseOperator; 252 return &cache_.kBranchFalseOperator;
247 } 253 }
248 UNREACHABLE(); 254 UNREACHABLE();
249 return nullptr; 255 return nullptr;
250 } 256 }
251 257
252 258
259 const Operator* CommonOperatorBuilder::Switch(size_t control_output_count) {
260 DCHECK_GE(control_output_count, 2u); // Disallow trivial switches.
261 return new (zone()) Operator( // --
262 IrOpcode::kSwitch, Operator::kFoldable, // opcode
263 "Switch", // name
264 1, 0, 1, 0, 0, control_output_count); // counts
265 }
266
267
268 const Operator* CommonOperatorBuilder::Case(size_t index) {
269 return new (zone()) Operator1<size_t>( // --
270 IrOpcode::kCase, Operator::kFoldable, // opcode
271 "Case", // name
272 0, 0, 1, 0, 0, 1, // counts
273 index); // parameter
274 }
275
276
253 const Operator* CommonOperatorBuilder::Start(int num_formal_parameters) { 277 const Operator* CommonOperatorBuilder::Start(int num_formal_parameters) {
254 // Outputs are formal parameters, plus context, receiver, and JSFunction. 278 // Outputs are formal parameters, plus context, receiver, and JSFunction.
255 const int value_output_count = num_formal_parameters + 3; 279 const int value_output_count = num_formal_parameters + 3;
256 return new (zone()) Operator( // -- 280 return new (zone()) Operator( // --
257 IrOpcode::kStart, Operator::kFoldable, // opcode 281 IrOpcode::kStart, Operator::kFoldable, // opcode
258 "Start", // name 282 "Start", // name
259 0, 0, 0, value_output_count, 1, 1); // counts 283 0, 0, 0, value_output_count, 1, 1); // counts
260 } 284 }
261 285
262 286
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 } else { 535 } else {
512 UNREACHABLE(); 536 UNREACHABLE();
513 return nullptr; 537 return nullptr;
514 } 538 }
515 } 539 }
516 540
517 541
518 } // namespace compiler 542 } // namespace compiler
519 } // namespace internal 543 } // namespace internal
520 } // namespace v8 544 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/common-operator.h ('k') | src/compiler/ia32/code-generator-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698