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

Side by Side Diff: src/transitions.h

Issue 10692026: Moving prototype transitions into the header of the transition array. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update Created 8 years, 5 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // [1] First transition 45 // [1] First transition
46 // [length() - kTransitionSize] Last transition 46 // [length() - kTransitionSize] Last transition
47 class TransitionArray: public FixedArray { 47 class TransitionArray: public FixedArray {
48 public: 48 public:
49 inline Map* elements_transition(); 49 inline Map* elements_transition();
50 inline void set_elements_transition( 50 inline void set_elements_transition(
51 Map* value, 51 Map* value,
52 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 52 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
53 inline void ClearElementsTransition(); 53 inline void ClearElementsTransition();
54 inline bool HasElementsTransition(); 54 inline bool HasElementsTransition();
55 inline FixedArray* prototype_transitions();
56 inline void set_prototype_transitions(
57 FixedArray* prototype_transitions,
58 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
59 inline HeapObject* unchecked_prototype_transitions();
60 inline bool HasPrototypeTransitions();
55 // Accessors for fetching instance transition at transition number. 61 // Accessors for fetching instance transition at transition number.
56 inline String* GetKey(int transition_number); 62 inline String* GetKey(int transition_number);
57 inline Object** GetKeySlot(int transition_number); 63 inline Object** GetKeySlot(int transition_number);
58 inline void SetKey(int transition_number, String* value); 64 inline void SetKey(int transition_number, String* value);
59 inline Object* GetValue(int transition_number); 65 inline Object* GetValue(int transition_number);
60 inline Object** GetValueSlot(int transition_number); 66 inline Object** GetValueSlot(int transition_number);
61 inline void SetValue(int transition_number, Object* value); 67 inline void SetValue(int transition_number, Object* value);
62 inline Map* GetTargetMap(int transition_number); 68 inline Map* GetTargetMap(int transition_number);
63 inline PropertyDetails GetTargetDetails(int transition_number); 69 inline PropertyDetails GetTargetDetails(int transition_number);
64 inline Object** GetElementsSlot(); 70 inline Object** GetElementsSlot();
71 inline Object** GetPrototypeTransitionsSlot();
Michael Starzinger 2012/07/06 13:53:18 Can we group these accessors somehow, this is beco
Toon Verwaest 2012/07/09 12:45:27 Done.
72 bool TransitionsTo(Object* target);
65 73
66 // Returns the number of transitions in the array. 74 // Returns the number of transitions in the array.
67 int number_of_transitions() { 75 int number_of_transitions() {
68 ASSERT(length() >= kFirstIndex); 76 ASSERT(length() >= kFirstIndex);
69 int len = length(); 77 int len = length();
70 return len <= kFirstIndex ? 0 : (len - kFirstIndex) / kTransitionSize; 78 return len <= kFirstIndex ? 0 : (len - kFirstIndex) / kTransitionSize;
71 } 79 }
72 80
73 inline int number_of_entries() { return number_of_transitions(); } 81 inline int number_of_entries() { return number_of_transitions(); }
74 82
(...skipping 17 matching lines...) Expand all
92 // Allocates a TransitionArray. 100 // Allocates a TransitionArray.
93 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_transitions); 101 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_transitions);
94 102
95 // Casting. 103 // Casting.
96 static inline TransitionArray* cast(Object* obj); 104 static inline TransitionArray* cast(Object* obj);
97 105
98 // Constant for denoting key was not found. 106 // Constant for denoting key was not found.
99 static const int kNotFound = -1; 107 static const int kNotFound = -1;
100 108
101 static const int kElementsTransitionIndex = 0; 109 static const int kElementsTransitionIndex = 0;
102 static const int kFirstIndex = 1; 110 static const int kPrototypeTransitionsIndex = 1;
111 static const int kFirstIndex = 2;
103 112
104 // Layout transition array header. 113 // Layout transition array header.
105 static const int kElementsTransitionOffset = FixedArray::kHeaderSize; 114 static const int kElementsTransitionOffset = FixedArray::kHeaderSize;
106 static const int kFirstOffset = kElementsTransitionOffset + kPointerSize; 115 static const int kPrototypeTransitionsOffset = kElementsTransitionOffset +
Michael Starzinger 2012/07/06 13:53:18 Better break that after the "=", to be consistent
116 kPointerSize;
117 static const int kFirstOffset = kPrototypeTransitionsOffset + kPointerSize;
107 118
108 // Layout of map transition. 119 // Layout of map transition.
109 static const int kTransitionKey = 0; 120 static const int kTransitionKey = 0;
110 static const int kTransitionValue = 1; 121 static const int kTransitionValue = 1;
111 static const int kTransitionSize = 2; 122 static const int kTransitionSize = 2;
112 123
113 #ifdef OBJECT_PRINT 124 #ifdef OBJECT_PRINT
114 // Print all the transitions. 125 // Print all the transitions.
115 inline void PrintTransitions() { 126 inline void PrintTransitions() {
116 PrintTransitions(stdout); 127 PrintTransitions(stdout);
(...skipping 30 matching lines...) Expand all
147 Object* value, 158 Object* value,
148 const WhitenessWitness&); 159 const WhitenessWitness&);
149 160
150 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); 161 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray);
151 }; 162 };
152 163
153 164
154 } } // namespace v8::internal 165 } } // namespace v8::internal
155 166
156 #endif // V8_TRANSITIONS_H_ 167 #endif // V8_TRANSITIONS_H_
OLDNEW
« src/objects-inl.h ('K') | « src/profile-generator.cc ('k') | src/transitions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698