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

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

Issue 931623002: [turbofan] Optimize certain chains of Branch into a Switch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addrssed comments. 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/operator.h ('k') | src/compiler/operator-properties.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/operator.h" 5 #include "src/compiler/operator.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
11 namespace compiler { 11 namespace compiler {
12 12
13 namespace { 13 namespace {
14 14
15 template <typename N> 15 template <typename N>
16 V8_INLINE N CheckRange(size_t val) { 16 V8_INLINE N CheckRange(size_t val) {
17 CHECK_LE(val, std::numeric_limits<N>::max()); 17 CHECK_LE(val, std::numeric_limits<N>::max());
18 return static_cast<N>(val); 18 return static_cast<N>(val);
19 } 19 }
20 20
21 } // namespace 21 } // namespace
22 22
23 23
24 // static
25 STATIC_CONST_MEMBER_DEFINITION const size_t Operator::kMaxControlOutputCount;
26
27
24 Operator::Operator(Opcode opcode, Properties properties, const char* mnemonic, 28 Operator::Operator(Opcode opcode, Properties properties, const char* mnemonic,
25 size_t value_in, size_t effect_in, size_t control_in, 29 size_t value_in, size_t effect_in, size_t control_in,
26 size_t value_out, size_t effect_out, size_t control_out) 30 size_t value_out, size_t effect_out, size_t control_out)
27 : opcode_(opcode), 31 : opcode_(opcode),
28 properties_(properties), 32 properties_(properties),
29 mnemonic_(mnemonic), 33 mnemonic_(mnemonic),
30 value_in_(CheckRange<uint32_t>(value_in)), 34 value_in_(CheckRange<uint32_t>(value_in)),
31 effect_in_(CheckRange<uint16_t>(effect_in)), 35 effect_in_(CheckRange<uint16_t>(effect_in)),
32 control_in_(CheckRange<uint16_t>(control_in)), 36 control_in_(CheckRange<uint16_t>(control_in)),
33 value_out_(CheckRange<uint16_t>(value_out)), 37 value_out_(CheckRange<uint16_t>(value_out)),
34 effect_out_(CheckRange<uint8_t>(effect_out)), 38 effect_out_(CheckRange<uint8_t>(effect_out)),
35 control_out_(CheckRange<uint8_t>(control_out)) {} 39 control_out_(CheckRange<uint16_t>(control_out)) {}
36 40
37 41
38 std::ostream& operator<<(std::ostream& os, const Operator& op) { 42 std::ostream& operator<<(std::ostream& os, const Operator& op) {
39 op.PrintTo(os); 43 op.PrintTo(os);
40 return os; 44 return os;
41 } 45 }
42 46
43 47
44 void Operator::PrintTo(std::ostream& os) const { os << mnemonic(); } 48 void Operator::PrintTo(std::ostream& os) const { os << mnemonic(); }
45 49
46 } // namespace compiler 50 } // namespace compiler
47 } // namespace internal 51 } // namespace internal
48 } // namespace v8 52 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/operator.h ('k') | src/compiler/operator-properties.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698