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

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

Issue 650073002: vector-based ICs did not update type feedback counts correctly. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Removed problematic field TypeFeedbackInfo::feedback_vector(). Created 6 years, 2 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 | Annotate | Revision Log
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 "src/checks.h" 8 #include "src/checks.h"
9 #include "src/elements-kind.h" 9 #include "src/elements-kind.h"
10 #include "src/heap/heap.h" 10 #include "src/heap/heap.h"
11 #include "src/isolate.h" 11 #include "src/isolate.h"
12 #include "src/objects.h" 12 #include "src/objects.h"
13 13
14 namespace v8 { 14 namespace v8 {
15 namespace internal { 15 namespace internal {
16 16
17 // The shape of the TypeFeedbackVector is an array with:
18 // 0: first_ic_slot_index (-1 if no ic slots present)
19 // 1: ics_with_types
20 // 2: ics_with_generic_info
21 // 3: first feedback slot
22 // ...
23 // [<first_ic_slot_index>: feedback slot]
24 // ...to length() - 1
25 //
17 class TypeFeedbackVector : public FixedArray { 26 class TypeFeedbackVector : public FixedArray {
18 public: 27 public:
19 // Casting. 28 // Casting.
20 static TypeFeedbackVector* cast(Object* obj) { 29 static TypeFeedbackVector* cast(Object* obj) {
21 DCHECK(obj->IsTypeFeedbackVector()); 30 DCHECK(obj->IsTypeFeedbackVector());
22 return reinterpret_cast<TypeFeedbackVector*>(obj); 31 return reinterpret_cast<TypeFeedbackVector*>(obj);
23 } 32 }
24 33
34 static const int kReservedIndexCount = 3;
35 static const int kFirstICSlotIndex = 0;
36 static const int kWithTypesIndex = 1;
37 static const int kGenericCountIndex = 2;
38
39 inline int first_ic_slot_index() {
40 DCHECK(length() >= kReservedIndexCount);
41 return Smi::cast(get(kFirstICSlotIndex))->value();
42 }
43 inline int ic_with_type_info_count();
44 inline void change_ic_with_type_info_count(int delta);
45
46 inline int ic_generic_count();
47 inline void change_ic_generic_count(int delta);
48
49 inline int Slots();
50 inline int ICSlots();
51
52 // Conversion from a slot or ic slot to an integer index to the underlying
53 // array.
54 inline int GetIndex(FeedbackVectorSlot slot);
55 inline int GetIndex(FeedbackVectorICSlot slot);
56
57 // Conversion from an integer index to either a slot or an ic slot. The caller
58 // should know what kind she expects.
59 inline FeedbackVectorSlot ToSlot(int index);
60 inline FeedbackVectorICSlot ToICSlot(int index);
61
62 inline Object* Get(FeedbackVectorSlot slot);
63 inline void Set(FeedbackVectorSlot slot, Object* value,
64 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
65
66 inline Object* Get(FeedbackVectorICSlot slot);
67 inline void Set(FeedbackVectorICSlot slot, Object* value,
68 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
69
70 static Handle<TypeFeedbackVector> Allocate(Isolate* isolate, int slot_count,
71 int ic_slot_count);
72
25 static Handle<TypeFeedbackVector> Copy(Isolate* isolate, 73 static Handle<TypeFeedbackVector> Copy(Isolate* isolate,
26 Handle<TypeFeedbackVector> vector); 74 Handle<TypeFeedbackVector> vector);
27 75
76 // Clears vector slots, and leaves vector ic slots alone.
77 void ClearSlots(SharedFunctionInfo* shared);
78
28 // The object that indicates an uninitialized cache. 79 // The object that indicates an uninitialized cache.
29 static inline Handle<Object> UninitializedSentinel(Isolate* isolate); 80 static inline Handle<Object> UninitializedSentinel(Isolate* isolate);
30 81
31 // The object that indicates a megamorphic state. 82 // The object that indicates a megamorphic state.
32 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate); 83 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate);
33 84
34 // The object that indicates a premonomorphic state. 85 // The object that indicates a premonomorphic state.
35 static inline Handle<Object> PremonomorphicSentinel(Isolate* isolate); 86 static inline Handle<Object> PremonomorphicSentinel(Isolate* isolate);
36 87
37 // The object that indicates a generic state. 88 // The object that indicates a generic state.
38 static inline Handle<Object> GenericSentinel(Isolate* isolate); 89 static inline Handle<Object> GenericSentinel(Isolate* isolate);
39 90
40 // The object that indicates a monomorphic state of Array with 91 // The object that indicates a monomorphic state of Array with
41 // ElementsKind 92 // ElementsKind
42 static inline Handle<Object> MonomorphicArraySentinel( 93 static inline Handle<Object> MonomorphicArraySentinel(
43 Isolate* isolate, ElementsKind elements_kind); 94 Isolate* isolate, ElementsKind elements_kind);
44 95
45 // A raw version of the uninitialized sentinel that's safe to read during 96 // A raw version of the uninitialized sentinel that's safe to read during
46 // garbage collection (e.g., for patching the cache). 97 // garbage collection (e.g., for patching the cache).
47 static inline Object* RawUninitializedSentinel(Heap* heap); 98 static inline Object* RawUninitializedSentinel(Heap* heap);
48 99
49 private: 100 private:
50 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeFeedbackVector); 101 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeFeedbackVector);
51 }; 102 };
52 } 103 }
53 } // namespace v8::internal 104 } // namespace v8::internal
54 105
55 #endif // V8_TRANSITIONS_H_ 106 #endif // V8_TRANSITIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698