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

Side by Side Diff: src/compiler/type-hint-analyzer.cc

Issue 2222983002: [turbofan] Also consume number type feedback for abstract equality. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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/simplified-operator.cc ('k') | src/compiler/type-hints.h » ('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 #include "src/compiler/type-hint-analyzer.h" 5 #include "src/compiler/type-hint-analyzer.h"
6 6
7 #include "src/assembler.h" 7 #include "src/assembler.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compiler/type-hints.h" 9 #include "src/compiler/type-hints.h"
10 #include "src/ic/ic-state.h" 10 #include "src/ic/ic-state.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 namespace compiler { 14 namespace compiler {
15 15
16 namespace { 16 namespace {
17 17
18 // TODO(bmeurer): This detour via types is ugly. 18 // TODO(bmeurer): This detour via types is ugly.
19 BinaryOperationHints::Hint ToBinaryOperationHint(Type* type) { 19 BinaryOperationHints::Hint ToBinaryOperationHint(Type* type) {
20 if (type->Is(Type::None())) return BinaryOperationHints::kNone; 20 if (type->Is(Type::None())) return BinaryOperationHints::kNone;
21 if (type->Is(Type::SignedSmall())) return BinaryOperationHints::kSignedSmall; 21 if (type->Is(Type::SignedSmall())) return BinaryOperationHints::kSignedSmall;
22 if (type->Is(Type::Signed32())) return BinaryOperationHints::kSigned32; 22 if (type->Is(Type::Signed32())) return BinaryOperationHints::kSigned32;
23 if (type->Is(Type::Number())) return BinaryOperationHints::kNumberOrOddball; 23 if (type->Is(Type::Number())) return BinaryOperationHints::kNumberOrOddball;
24 if (type->Is(Type::String())) return BinaryOperationHints::kString; 24 if (type->Is(Type::String())) return BinaryOperationHints::kString;
25 return BinaryOperationHints::kAny; 25 return BinaryOperationHints::kAny;
26 } 26 }
27 27
28 CompareOperationHints::Hint ToCompareOperationHint( 28 CompareOperationHints::Hint ToCompareOperationHint(
29 CompareICState::State state) { 29 Token::Value op, CompareICState::State state) {
30 switch (state) { 30 switch (state) {
31 case CompareICState::UNINITIALIZED: 31 case CompareICState::UNINITIALIZED:
32 return CompareOperationHints::kNone; 32 return CompareOperationHints::kNone;
33 case CompareICState::BOOLEAN: 33 case CompareICState::BOOLEAN:
34 return CompareOperationHints::kBoolean; 34 return CompareOperationHints::kBoolean;
35 case CompareICState::SMI: 35 case CompareICState::SMI:
36 return CompareOperationHints::kSignedSmall; 36 return CompareOperationHints::kSignedSmall;
37 case CompareICState::NUMBER: 37 case CompareICState::NUMBER:
38 return CompareOperationHints::kNumberOrOddball; 38 return Token::IsOrderedRelationalCompareOp(op)
39 ? CompareOperationHints::kNumberOrOddball
40 : CompareOperationHints::kNumber;
39 case CompareICState::STRING: 41 case CompareICState::STRING:
40 return CompareOperationHints::kString; 42 return CompareOperationHints::kString;
41 case CompareICState::INTERNALIZED_STRING: 43 case CompareICState::INTERNALIZED_STRING:
42 return CompareOperationHints::kInternalizedString; 44 return CompareOperationHints::kInternalizedString;
43 case CompareICState::UNIQUE_NAME: 45 case CompareICState::UNIQUE_NAME:
44 return CompareOperationHints::kUniqueName; 46 return CompareOperationHints::kUniqueName;
45 case CompareICState::RECEIVER: 47 case CompareICState::RECEIVER:
46 case CompareICState::KNOWN_RECEIVER: 48 case CompareICState::KNOWN_RECEIVER:
47 return CompareOperationHints::kReceiver; 49 return CompareOperationHints::kReceiver;
48 case CompareICState::GENERIC: 50 case CompareICState::GENERIC:
(...skipping 23 matching lines...) Expand all
72 auto i = infos_.find(id); 74 auto i = infos_.find(id);
73 if (i == infos_.end()) return false; 75 if (i == infos_.end()) return false;
74 Handle<Code> code = i->second; 76 Handle<Code> code = i->second;
75 DCHECK_EQ(Code::COMPARE_IC, code->kind()); 77 DCHECK_EQ(Code::COMPARE_IC, code->kind());
76 78
77 Handle<Map> map; 79 Handle<Map> map;
78 Map* raw_map = code->FindFirstMap(); 80 Map* raw_map = code->FindFirstMap();
79 if (raw_map != nullptr) Map::TryUpdate(handle(raw_map)).ToHandle(&map); 81 if (raw_map != nullptr) Map::TryUpdate(handle(raw_map)).ToHandle(&map);
80 82
81 CompareICStub stub(code->stub_key(), code->GetIsolate()); 83 CompareICStub stub(code->stub_key(), code->GetIsolate());
82 *hints = CompareOperationHints(ToCompareOperationHint(stub.left()), 84 *hints =
83 ToCompareOperationHint(stub.right()), 85 CompareOperationHints(ToCompareOperationHint(stub.op(), stub.left()),
84 ToCompareOperationHint(stub.state())); 86 ToCompareOperationHint(stub.op(), stub.right()),
87 ToCompareOperationHint(stub.op(), stub.state()));
85 return true; 88 return true;
86 } 89 }
87 90
88 bool TypeHintAnalysis::GetToBooleanHints(TypeFeedbackId id, 91 bool TypeHintAnalysis::GetToBooleanHints(TypeFeedbackId id,
89 ToBooleanHints* hints) const { 92 ToBooleanHints* hints) const {
90 auto i = infos_.find(id); 93 auto i = infos_.find(id);
91 if (i == infos_.end()) return false; 94 if (i == infos_.end()) return false;
92 Handle<Code> code = i->second; 95 Handle<Code> code = i->second;
93 DCHECK_EQ(Code::TO_BOOLEAN_IC, code->kind()); 96 DCHECK_EQ(Code::TO_BOOLEAN_IC, code->kind());
94 ToBooleanICStub stub(code->GetIsolate(), code->extra_ic_state()); 97 ToBooleanICStub stub(code->GetIsolate(), code->extra_ic_state());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // Ignore the remaining code objects. 135 // Ignore the remaining code objects.
133 break; 136 break;
134 } 137 }
135 } 138 }
136 return new (zone()) TypeHintAnalysis(infos, zone()); 139 return new (zone()) TypeHintAnalysis(infos, zone());
137 } 140 }
138 141
139 } // namespace compiler 142 } // namespace compiler
140 } // namespace internal 143 } // namespace internal
141 } // namespace v8 144 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/simplified-operator.cc ('k') | src/compiler/type-hints.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698