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

Side by Side Diff: src/type-feedback-vector.h

Issue 1912633002: [ic] Split LoadIC into LoadGlobalIC and LoadIC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebasing 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/runtime/runtime-object.cc ('k') | src/type-feedback-vector.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 #ifndef V8_TYPE_FEEDBACK_VECTOR_H_ 5 #ifndef V8_TYPE_FEEDBACK_VECTOR_H_
6 #define V8_TYPE_FEEDBACK_VECTOR_H_ 6 #define V8_TYPE_FEEDBACK_VECTOR_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "src/base/logging.h" 10 #include "src/base/logging.h"
11 #include "src/elements-kind.h" 11 #include "src/elements-kind.h"
12 #include "src/objects.h" 12 #include "src/objects.h"
13 #include "src/zone-containers.h" 13 #include "src/zone-containers.h"
14 14
15 namespace v8 { 15 namespace v8 {
16 namespace internal { 16 namespace internal {
17 17
18
19 enum class FeedbackVectorSlotKind { 18 enum class FeedbackVectorSlotKind {
20 // This kind means that the slot points to the middle of other slot 19 // This kind means that the slot points to the middle of other slot
21 // which occupies more than one feedback vector element. 20 // which occupies more than one feedback vector element.
22 // There must be no such slots in the system. 21 // There must be no such slots in the system.
23 INVALID, 22 INVALID,
24 23
25 CALL_IC, 24 CALL_IC,
26 LOAD_IC, 25 LOAD_IC,
26 LOAD_GLOBAL_IC,
27 KEYED_LOAD_IC, 27 KEYED_LOAD_IC,
28 STORE_IC, 28 STORE_IC,
29 KEYED_STORE_IC, 29 KEYED_STORE_IC,
30 30
31 // This is a general purpose slot that occupies one feedback vector element. 31 // This is a general purpose slot that occupies one feedback vector element.
32 GENERAL, 32 GENERAL,
33 33
34 KINDS_NUMBER // Last value indicating number of kinds. 34 KINDS_NUMBER // Last value indicating number of kinds.
35 }; 35 };
36 36
37
38 std::ostream& operator<<(std::ostream& os, FeedbackVectorSlotKind kind); 37 std::ostream& operator<<(std::ostream& os, FeedbackVectorSlotKind kind);
39 38
40 39
41 template <typename Derived> 40 template <typename Derived>
42 class FeedbackVectorSpecBase { 41 class FeedbackVectorSpecBase {
43 public: 42 public:
44 inline FeedbackVectorSlot AddSlot(FeedbackVectorSlotKind kind); 43 inline FeedbackVectorSlot AddSlot(FeedbackVectorSlotKind kind);
45 44
46 FeedbackVectorSlot AddCallICSlot() { 45 FeedbackVectorSlot AddCallICSlot() {
47 return AddSlot(FeedbackVectorSlotKind::CALL_IC); 46 return AddSlot(FeedbackVectorSlotKind::CALL_IC);
48 } 47 }
49 48
50 FeedbackVectorSlot AddLoadICSlot() { 49 FeedbackVectorSlot AddLoadICSlot() {
51 return AddSlot(FeedbackVectorSlotKind::LOAD_IC); 50 return AddSlot(FeedbackVectorSlotKind::LOAD_IC);
52 } 51 }
53 52
53 FeedbackVectorSlot AddLoadGlobalICSlot() {
54 return AddSlot(FeedbackVectorSlotKind::LOAD_GLOBAL_IC);
55 }
56
54 FeedbackVectorSlot AddKeyedLoadICSlot() { 57 FeedbackVectorSlot AddKeyedLoadICSlot() {
55 return AddSlot(FeedbackVectorSlotKind::KEYED_LOAD_IC); 58 return AddSlot(FeedbackVectorSlotKind::KEYED_LOAD_IC);
56 } 59 }
57 60
58 FeedbackVectorSlot AddStoreICSlot() { 61 FeedbackVectorSlot AddStoreICSlot() {
59 return AddSlot(FeedbackVectorSlotKind::STORE_IC); 62 return AddSlot(FeedbackVectorSlotKind::STORE_IC);
60 } 63 }
61 64
62 FeedbackVectorSlot AddKeyedStoreICSlot() { 65 FeedbackVectorSlot AddKeyedStoreICSlot() {
63 return AddSlot(FeedbackVectorSlotKind::KEYED_STORE_IC); 66 return AddSlot(FeedbackVectorSlotKind::KEYED_STORE_IC);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 #ifdef OBJECT_PRINT 155 #ifdef OBJECT_PRINT
153 // For gdb debugging. 156 // For gdb debugging.
154 void Print(); 157 void Print();
155 #endif // OBJECT_PRINT 158 #endif // OBJECT_PRINT
156 159
157 DECLARE_PRINTER(TypeFeedbackMetadata) 160 DECLARE_PRINTER(TypeFeedbackMetadata)
158 161
159 static const char* Kind2String(FeedbackVectorSlotKind kind); 162 static const char* Kind2String(FeedbackVectorSlotKind kind);
160 163
161 private: 164 private:
162 static const int kFeedbackVectorSlotKindBits = 3; 165 static const int kFeedbackVectorSlotKindBits = 4;
163 STATIC_ASSERT(static_cast<int>(FeedbackVectorSlotKind::KINDS_NUMBER) < 166 STATIC_ASSERT(static_cast<int>(FeedbackVectorSlotKind::KINDS_NUMBER) <
164 (1 << kFeedbackVectorSlotKindBits)); 167 (1 << kFeedbackVectorSlotKindBits));
165 168
166 void SetKind(FeedbackVectorSlot slot, FeedbackVectorSlotKind kind); 169 void SetKind(FeedbackVectorSlot slot, FeedbackVectorSlotKind kind);
167 170
168 typedef BitSetComputer<FeedbackVectorSlotKind, kFeedbackVectorSlotKindBits, 171 typedef BitSetComputer<FeedbackVectorSlotKind, kFeedbackVectorSlotKindBits,
169 kSmiValueSize, uint32_t> VectorICComputer; 172 kSmiValueSize, uint32_t> VectorICComputer;
170 173
171 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeFeedbackMetadata); 174 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeFeedbackMetadata);
172 }; 175 };
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 444
442 void Clear(Code* host); 445 void Clear(Code* host);
443 446
444 void ConfigureMonomorphic(Handle<Map> receiver_map, Handle<Code> handler); 447 void ConfigureMonomorphic(Handle<Map> receiver_map, Handle<Code> handler);
445 448
446 void ConfigurePolymorphic(MapHandleList* maps, CodeHandleList* handlers); 449 void ConfigurePolymorphic(MapHandleList* maps, CodeHandleList* handlers);
447 450
448 InlineCacheState StateFromFeedback() const override; 451 InlineCacheState StateFromFeedback() const override;
449 }; 452 };
450 453
454 class LoadGlobalICNexus : public FeedbackNexus {
455 public:
456 LoadGlobalICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorSlot slot)
457 : FeedbackNexus(vector, slot) {
458 DCHECK_EQ(FeedbackVectorSlotKind::LOAD_GLOBAL_IC, vector->GetKind(slot));
459 }
460 LoadGlobalICNexus(TypeFeedbackVector* vector, FeedbackVectorSlot slot)
461 : FeedbackNexus(vector, slot) {
462 DCHECK_EQ(FeedbackVectorSlotKind::LOAD_GLOBAL_IC, vector->GetKind(slot));
463 }
464
465 void ConfigureMegamorphic() override { UNREACHABLE(); }
466 void Clear(Code* host);
467
468 void ConfigureMonomorphic(Handle<Map> receiver_map, Handle<Code> handler);
469
470 InlineCacheState StateFromFeedback() const override;
471 };
451 472
452 class KeyedLoadICNexus : public FeedbackNexus { 473 class KeyedLoadICNexus : public FeedbackNexus {
453 public: 474 public:
454 KeyedLoadICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorSlot slot) 475 KeyedLoadICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorSlot slot)
455 : FeedbackNexus(vector, slot) { 476 : FeedbackNexus(vector, slot) {
456 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, vector->GetKind(slot)); 477 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, vector->GetKind(slot));
457 } 478 }
458 KeyedLoadICNexus(TypeFeedbackVector* vector, FeedbackVectorSlot slot) 479 KeyedLoadICNexus(TypeFeedbackVector* vector, FeedbackVectorSlot slot)
459 : FeedbackNexus(vector, slot) { 480 : FeedbackNexus(vector, slot) {
460 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, vector->GetKind(slot)); 481 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, vector->GetKind(slot));
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 KeyedAccessStoreMode GetKeyedAccessStoreMode() const; 554 KeyedAccessStoreMode GetKeyedAccessStoreMode() const;
534 IcCheckType GetKeyType() const; 555 IcCheckType GetKeyType() const;
535 556
536 InlineCacheState StateFromFeedback() const override; 557 InlineCacheState StateFromFeedback() const override;
537 Name* FindFirstName() const override; 558 Name* FindFirstName() const override;
538 }; 559 };
539 } // namespace internal 560 } // namespace internal
540 } // namespace v8 561 } // namespace v8
541 562
542 #endif // V8_TRANSITIONS_H_ 563 #endif // V8_TRANSITIONS_H_
OLDNEW
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | src/type-feedback-vector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698