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

Side by Side Diff: src/compiler/type-hints.h

Issue 1921563002: [turbofan] Initial version of number type feedback. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 6 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/type-hint-analyzer.cc ('k') | src/compiler/type-hints.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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_TYPE_HINTS_H_ 5 #ifndef V8_COMPILER_TYPE_HINTS_H_
6 #define V8_COMPILER_TYPE_HINTS_H_ 6 #define V8_COMPILER_TYPE_HINTS_H_
7 7
8 #include "src/base/flags.h" 8 #include "src/base/flags.h"
9 #include "src/utils.h" 9 #include "src/utils.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 namespace compiler { 13 namespace compiler {
14 14
15 // Type hints for an binary operation. 15 // Type hints for an binary operation.
16 class BinaryOperationHints final { 16 class BinaryOperationHints final {
17 public: 17 public:
18 enum Hint { kNone, kSignedSmall, kSigned32, kNumber, kString, kAny }; 18 enum Hint {
19 kNone,
20 kSignedSmall,
21 kSigned32,
22 kNumberOrUndefined,
23 kString,
24 kAny
25 };
19 26
20 BinaryOperationHints() : BinaryOperationHints(kNone, kNone, kNone) {} 27 BinaryOperationHints() : BinaryOperationHints(kNone, kNone, kNone) {}
21 BinaryOperationHints(Hint left, Hint right, Hint result) 28 BinaryOperationHints(Hint left, Hint right, Hint result)
22 : bit_field_(LeftField::encode(left) | RightField::encode(right) | 29 : bit_field_(LeftField::encode(left) | RightField::encode(right) |
23 ResultField::encode(result)) {} 30 ResultField::encode(result)) {}
24 31
25 static BinaryOperationHints Any() { 32 static BinaryOperationHints Any() {
26 return BinaryOperationHints(kAny, kAny, kAny); 33 return BinaryOperationHints(kAny, kAny, kAny);
27 } 34 }
28 35
29 Hint left() const { return LeftField::decode(bit_field_); } 36 Hint left() const { return LeftField::decode(bit_field_); }
30 Hint right() const { return RightField::decode(bit_field_); } 37 Hint right() const { return RightField::decode(bit_field_); }
31 Hint result() const { return ResultField::decode(bit_field_); } 38 Hint result() const { return ResultField::decode(bit_field_); }
39 Hint combined() const { return Combine(Combine(left(), right()), result()); }
40
41 // Hint 'subtyping' and generalization.
42 static bool Is(Hint h1, Hint h2);
43 static Hint Combine(Hint h1, Hint h2);
32 44
33 bool operator==(BinaryOperationHints const& that) const { 45 bool operator==(BinaryOperationHints const& that) const {
34 return this->bit_field_ == that.bit_field_; 46 return this->bit_field_ == that.bit_field_;
35 } 47 }
36 bool operator!=(BinaryOperationHints const& that) const { 48 bool operator!=(BinaryOperationHints const& that) const {
37 return !(*this == that); 49 return !(*this == that);
38 } 50 }
39 51
40 friend size_t hash_value(BinaryOperationHints const& hints) { 52 friend size_t hash_value(BinaryOperationHints const& hints) {
41 return hints.bit_field_; 53 return hints.bit_field_;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 87
76 std::ostream& operator<<(std::ostream&, ToBooleanHints); 88 std::ostream& operator<<(std::ostream&, ToBooleanHints);
77 89
78 DEFINE_OPERATORS_FOR_FLAGS(ToBooleanHints) 90 DEFINE_OPERATORS_FOR_FLAGS(ToBooleanHints)
79 91
80 } // namespace compiler 92 } // namespace compiler
81 } // namespace internal 93 } // namespace internal
82 } // namespace v8 94 } // namespace v8
83 95
84 #endif // V8_COMPILER_TYPE_HINTS_H_ 96 #endif // V8_COMPILER_TYPE_HINTS_H_
OLDNEW
« no previous file with comments | « src/compiler/type-hint-analyzer.cc ('k') | src/compiler/type-hints.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698