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

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: Addressing comments 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
« no previous file with comments | « src/profile-generator.cc ('k') | src/transitions.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 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 28 matching lines...) Expand all
39 39
40 40
41 // TransitionArrays are fixed arrays used to hold map transitions for property, 41 // TransitionArrays are fixed arrays used to hold map transitions for property,
42 // constant, and element changes. 42 // constant, and element changes.
43 // The format of the these objects is: 43 // The format of the these objects is:
44 // [0] Elements transition 44 // [0] Elements transition
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 // Accessors for fetching instance transition at transition number.
50 inline String* GetKey(int transition_number);
51 inline void SetKey(int transition_number, String* value);
52 inline Object** GetKeySlot(int transition_number);
53
54 inline Object* GetValue(int transition_number);
55 inline void SetValue(int transition_number, Object* value);
56 inline Object** GetValueSlot(int transition_number);
57
58 inline Map* GetTargetMap(int transition_number);
59 inline PropertyDetails GetTargetDetails(int transition_number);
60
49 inline Map* elements_transition(); 61 inline Map* elements_transition();
50 inline void set_elements_transition( 62 inline void set_elements_transition(
51 Map* value, 63 Map* value,
52 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 64 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
65 inline Object** GetElementsSlot();
Michael Starzinger 2012/07/09 16:40:55 Let's name that GetElementsTransitionSlot() instea
66 inline bool HasElementsTransition();
53 inline void ClearElementsTransition(); 67 inline void ClearElementsTransition();
54 inline bool HasElementsTransition(); 68
55 // Accessors for fetching instance transition at transition number. 69 inline FixedArray* GetPrototypeTransitions();
56 inline String* GetKey(int transition_number); 70 inline void SetPrototypeTransitions(
57 inline Object** GetKeySlot(int transition_number); 71 FixedArray* prototype_transitions,
58 inline void SetKey(int transition_number, String* value); 72 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
59 inline Object* GetValue(int transition_number); 73 inline Object** GetPrototypeTransitionsSlot();
60 inline Object** GetValueSlot(int transition_number); 74 inline bool HasPrototypeTransitions();
61 inline void SetValue(int transition_number, Object* value); 75 inline HeapObject* UncheckedPrototypeTransitions();
62 inline Map* GetTargetMap(int transition_number);
63 inline PropertyDetails GetTargetDetails(int transition_number);
64 inline Object** GetElementsSlot();
65 76
66 // Returns the number of transitions in the array. 77 // Returns the number of transitions in the array.
67 int number_of_transitions() { 78 int number_of_transitions() {
68 ASSERT(length() >= kFirstIndex); 79 ASSERT(length() >= kFirstIndex);
69 int len = length(); 80 int len = length();
70 return len <= kFirstIndex ? 0 : (len - kFirstIndex) / kTransitionSize; 81 return len <= kFirstIndex ? 0 : (len - kFirstIndex) / kTransitionSize;
71 } 82 }
72 83
73 inline int number_of_entries() { return number_of_transitions(); } 84 inline int number_of_entries() { return number_of_transitions(); }
74 85
(...skipping 17 matching lines...) Expand all
92 // Allocates a TransitionArray. 103 // Allocates a TransitionArray.
93 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_transitions); 104 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_transitions);
94 105
95 // Casting. 106 // Casting.
96 static inline TransitionArray* cast(Object* obj); 107 static inline TransitionArray* cast(Object* obj);
97 108
98 // Constant for denoting key was not found. 109 // Constant for denoting key was not found.
99 static const int kNotFound = -1; 110 static const int kNotFound = -1;
100 111
101 static const int kElementsTransitionIndex = 0; 112 static const int kElementsTransitionIndex = 0;
102 static const int kFirstIndex = 1; 113 static const int kPrototypeTransitionsIndex = 1;
114 static const int kFirstIndex = 2;
103 115
104 // Layout transition array header. 116 // Layout transition array header.
105 static const int kElementsTransitionOffset = FixedArray::kHeaderSize; 117 static const int kElementsTransitionOffset = FixedArray::kHeaderSize;
106 static const int kFirstOffset = kElementsTransitionOffset + kPointerSize; 118 static const int kPrototypeTransitionsOffset = kElementsTransitionOffset +
119 kPointerSize;
120 static const int kFirstOffset = kPrototypeTransitionsOffset + kPointerSize;
107 121
108 // Layout of map transition. 122 // Layout of map transition.
109 static const int kTransitionKey = 0; 123 static const int kTransitionKey = 0;
110 static const int kTransitionValue = 1; 124 static const int kTransitionValue = 1;
111 static const int kTransitionSize = 2; 125 static const int kTransitionSize = 2;
112 126
113 #ifdef OBJECT_PRINT 127 #ifdef OBJECT_PRINT
114 // Print all the transitions. 128 // Print all the transitions.
115 inline void PrintTransitions() { 129 inline void PrintTransitions() {
116 PrintTransitions(stdout); 130 PrintTransitions(stdout);
(...skipping 30 matching lines...) Expand all
147 Object* value, 161 Object* value,
148 const WhitenessWitness&); 162 const WhitenessWitness&);
149 163
150 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); 164 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray);
151 }; 165 };
152 166
153 167
154 } } // namespace v8::internal 168 } } // namespace v8::internal
155 169
156 #endif // V8_TRANSITIONS_H_ 170 #endif // V8_TRANSITIONS_H_
OLDNEW
« no previous file with comments | « src/profile-generator.cc ('k') | src/transitions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698