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

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

Issue 1268783004: VectorICs: refactoring to eliminate "for queries only" vector ic mode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compilation error. Created 5 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/mips64/builtins-mips64.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/checks.h" 10 #include "src/checks.h"
11 #include "src/elements-kind.h" 11 #include "src/elements-kind.h"
12 #include "src/heap/heap.h" 12 #include "src/heap/heap.h"
13 #include "src/isolate.h" 13 #include "src/isolate.h"
14 #include "src/objects.h" 14 #include "src/objects.h"
15 #include "src/zone-containers.h" 15 #include "src/zone-containers.h"
16 16
17 namespace v8 { 17 namespace v8 {
18 namespace internal { 18 namespace internal {
19 19
20 class FeedbackVectorSpec { 20 class FeedbackVectorSpec {
21 public: 21 public:
22 FeedbackVectorSpec() : slots_(0), has_ic_slot_(false) {} 22 FeedbackVectorSpec() : slots_(0), ic_slots_(0), ic_kinds_(NULL) {}
23 explicit FeedbackVectorSpec(int slots) : slots_(slots), has_ic_slot_(false) {} 23 explicit FeedbackVectorSpec(int slots)
24 FeedbackVectorSpec(int slots, Code::Kind ic_slot_kind) 24 : slots_(slots), ic_slots_(0), ic_kinds_(NULL) {}
25 : slots_(slots), has_ic_slot_(true), ic_kind_(ic_slot_kind) {} 25 FeedbackVectorSpec(int slots, int ic_slots, Code::Kind* ic_slot_kinds)
26 : slots_(slots), ic_slots_(ic_slots), ic_kinds_(ic_slot_kinds) {}
26 27
27 int slots() const { return slots_; } 28 int slots() const { return slots_; }
28 29
29 int ic_slots() const { return has_ic_slot_ ? 1 : 0; } 30 int ic_slots() const { return ic_slots_; }
30 31
31 Code::Kind GetKind(int ic_slot) const { 32 Code::Kind GetKind(int ic_slot) const {
32 DCHECK(has_ic_slot_ && ic_slot == 0); 33 DCHECK(ic_slots_ > 0 && ic_slot < ic_slots_);
33 return ic_kind_; 34 return ic_kinds_[ic_slot];
34 } 35 }
35 36
36 private: 37 private:
37 int slots_; 38 int slots_;
38 bool has_ic_slot_; 39 int ic_slots_;
39 Code::Kind ic_kind_; 40 Code::Kind* ic_kinds_;
40 }; 41 };
41 42
42 43
43 class ZoneFeedbackVectorSpec { 44 class ZoneFeedbackVectorSpec {
44 public: 45 public:
45 explicit ZoneFeedbackVectorSpec(Zone* zone) 46 explicit ZoneFeedbackVectorSpec(Zone* zone)
46 : slots_(0), ic_slots_(0), ic_slot_kinds_(zone) {} 47 : slots_(0), ic_slots_(0), ic_slot_kinds_(zone) {}
47 48
48 ZoneFeedbackVectorSpec(Zone* zone, int slots, int ic_slots) 49 ZoneFeedbackVectorSpec(Zone* zone, int slots, int ic_slots)
49 : slots_(slots), ic_slots_(ic_slots), ic_slot_kinds_(ic_slots, zone) {} 50 : slots_(slots), ic_slots_(ic_slots), ic_slot_kinds_(ic_slots, zone) {}
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 // The object that indicates a megamorphic state. 219 // The object that indicates a megamorphic state.
219 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate); 220 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate);
220 221
221 // The object that indicates a premonomorphic state. 222 // The object that indicates a premonomorphic state.
222 static inline Handle<Object> PremonomorphicSentinel(Isolate* isolate); 223 static inline Handle<Object> PremonomorphicSentinel(Isolate* isolate);
223 224
224 // A raw version of the uninitialized sentinel that's safe to read during 225 // A raw version of the uninitialized sentinel that's safe to read during
225 // garbage collection (e.g., for patching the cache). 226 // garbage collection (e.g., for patching the cache).
226 static inline Object* RawUninitializedSentinel(Heap* heap); 227 static inline Object* RawUninitializedSentinel(Heap* heap);
227 228
229 static const int kDummyLoadICSlot = 0;
230 static const int kDummyKeyedLoadICSlot = 1;
231 static const int kDummyStoreICSlot = 2;
232 static const int kDummyKeyedStoreICSlot = 3;
233
234 static Handle<TypeFeedbackVector> DummyVector(Isolate* isolate);
235 static FeedbackVectorICSlot DummySlot(int dummyIndex) {
236 DCHECK(dummyIndex >= 0 && dummyIndex <= kDummyKeyedStoreICSlot);
237 return FeedbackVectorICSlot(dummyIndex);
238 }
239
228 private: 240 private:
229 enum VectorICKind { 241 enum VectorICKind {
230 KindUnused = 0x0, 242 KindUnused = 0x0,
231 KindCallIC = 0x1, 243 KindCallIC = 0x1,
232 KindLoadIC = 0x2, 244 KindLoadIC = 0x2,
233 KindKeyedLoadIC = 0x3, 245 KindKeyedLoadIC = 0x3,
234 KindStoreIC = 0x4, 246 KindStoreIC = 0x4,
235 KindKeyedStoreIC = 0x5, 247 KindKeyedStoreIC = 0x5,
236 }; 248 };
237 249
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 int ExtractCallCount(); 391 int ExtractCallCount();
380 }; 392 };
381 393
382 394
383 class LoadICNexus : public FeedbackNexus { 395 class LoadICNexus : public FeedbackNexus {
384 public: 396 public:
385 LoadICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot) 397 LoadICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot)
386 : FeedbackNexus(vector, slot) { 398 : FeedbackNexus(vector, slot) {
387 DCHECK(vector->GetKind(slot) == Code::LOAD_IC); 399 DCHECK(vector->GetKind(slot) == Code::LOAD_IC);
388 } 400 }
401 explicit LoadICNexus(Isolate* isolate)
402 : FeedbackNexus(TypeFeedbackVector::DummyVector(isolate),
403 TypeFeedbackVector::DummySlot(
404 TypeFeedbackVector::kDummyLoadICSlot)) {}
389 LoadICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot) 405 LoadICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot)
390 : FeedbackNexus(vector, slot) { 406 : FeedbackNexus(vector, slot) {
391 DCHECK(vector->GetKind(slot) == Code::LOAD_IC); 407 DCHECK(vector->GetKind(slot) == Code::LOAD_IC);
392 } 408 }
393 409
394 void Clear(Code* host); 410 void Clear(Code* host);
395 411
396 void ConfigureMonomorphic(Handle<Map> receiver_map, Handle<Code> handler); 412 void ConfigureMonomorphic(Handle<Map> receiver_map, Handle<Code> handler);
397 413
398 void ConfigurePolymorphic(MapHandleList* maps, CodeHandleList* handlers); 414 void ConfigurePolymorphic(MapHandleList* maps, CodeHandleList* handlers);
(...skipping 26 matching lines...) Expand all
425 Name* FindFirstName() const override; 441 Name* FindFirstName() const override;
426 }; 442 };
427 443
428 444
429 class StoreICNexus : public FeedbackNexus { 445 class StoreICNexus : public FeedbackNexus {
430 public: 446 public:
431 StoreICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot) 447 StoreICNexus(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot)
432 : FeedbackNexus(vector, slot) { 448 : FeedbackNexus(vector, slot) {
433 DCHECK(vector->GetKind(slot) == Code::STORE_IC); 449 DCHECK(vector->GetKind(slot) == Code::STORE_IC);
434 } 450 }
451 explicit StoreICNexus(Isolate* isolate)
452 : FeedbackNexus(TypeFeedbackVector::DummyVector(isolate),
453 TypeFeedbackVector::DummySlot(
454 TypeFeedbackVector::kDummyStoreICSlot)) {}
435 StoreICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot) 455 StoreICNexus(TypeFeedbackVector* vector, FeedbackVectorICSlot slot)
436 : FeedbackNexus(vector, slot) { 456 : FeedbackNexus(vector, slot) {
437 DCHECK(vector->GetKind(slot) == Code::STORE_IC); 457 DCHECK(vector->GetKind(slot) == Code::STORE_IC);
438 } 458 }
439 459
440 void Clear(Code* host); 460 void Clear(Code* host);
441 461
442 void ConfigureMonomorphic(Handle<Map> receiver_map, Handle<Code> handler); 462 void ConfigureMonomorphic(Handle<Map> receiver_map, Handle<Code> handler);
443 463
444 void ConfigurePolymorphic(MapHandleList* maps, CodeHandleList* handlers); 464 void ConfigurePolymorphic(MapHandleList* maps, CodeHandleList* handlers);
(...skipping 23 matching lines...) Expand all
468 void ConfigurePolymorphic(Handle<Name> name, MapHandleList* maps, 488 void ConfigurePolymorphic(Handle<Name> name, MapHandleList* maps,
469 CodeHandleList* handlers); 489 CodeHandleList* handlers);
470 490
471 InlineCacheState StateFromFeedback() const override; 491 InlineCacheState StateFromFeedback() const override;
472 Name* FindFirstName() const override; 492 Name* FindFirstName() const override;
473 }; 493 };
474 } 494 }
475 } // namespace v8::internal 495 } // namespace v8::internal
476 496
477 #endif // V8_TRANSITIONS_H_ 497 #endif // V8_TRANSITIONS_H_
OLDNEW
« no previous file with comments | « src/mips64/builtins-mips64.cc ('k') | src/type-feedback-vector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698