OLD | NEW |
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // Returns the number of transitions in the array. | 89 // Returns the number of transitions in the array. |
90 int number_of_transitions() { | 90 int number_of_transitions() { |
91 if (IsSimpleTransition()) return 1; | 91 if (IsSimpleTransition()) return 1; |
92 int len = length(); | 92 int len = length(); |
93 return len <= kFirstIndex ? 0 : (len - kFirstIndex) / kTransitionSize; | 93 return len <= kFirstIndex ? 0 : (len - kFirstIndex) / kTransitionSize; |
94 } | 94 } |
95 | 95 |
96 inline int number_of_entries() { return number_of_transitions(); } | 96 inline int number_of_entries() { return number_of_transitions(); } |
97 | 97 |
98 // Allocate a new transition array with a single entry. | 98 // Allocate a new transition array with a single entry. |
99 static Handle<TransitionArray> NewWith(SimpleTransitionFlag flag, | 99 static Handle<TransitionArray> NewWith(Handle<Map> map, |
100 Handle<Name> key, | 100 Handle<Name> name, |
101 Handle<Map> target, | 101 Handle<Map> target, |
102 Handle<Object> back_pointer); | 102 SimpleTransitionFlag flag); |
103 | 103 |
104 MUST_USE_RESULT MaybeObject* ExtendToFullTransitionArray(); | 104 MUST_USE_RESULT MaybeObject* ExtendToFullTransitionArray(); |
105 | 105 |
106 // Copy the transition array, inserting a new transition. | 106 // Create a transition array, copying from the owning map if it already has |
| 107 // one, otherwise creating a new one according to flag. |
107 // TODO(verwaest): This should not cause an existing transition to be | 108 // TODO(verwaest): This should not cause an existing transition to be |
108 // overwritten. | 109 // overwritten. |
109 static Handle<TransitionArray> CopyInsert(Handle<Map> map, | 110 static Handle<TransitionArray> AddTransition(Handle<Map> map, |
110 Handle<Name> name, | 111 Handle<Name> name, |
111 Handle<Map> target); | 112 Handle<Map> target, |
| 113 SimpleTransitionFlag flag); |
112 | 114 |
113 // Copy a single transition from the origin array. | 115 // Copy a single transition from the origin array. |
114 inline void NoIncrementalWriteBarrierCopyFrom(TransitionArray* origin, | 116 inline void NoIncrementalWriteBarrierCopyFrom(TransitionArray* origin, |
115 int origin_transition, | 117 int origin_transition, |
116 int target_transition); | 118 int target_transition); |
117 | 119 |
118 // Search a transition for a given property name. | 120 // Search a transition for a given property name. |
119 inline int Search(Name* name); | 121 inline int Search(Name* name); |
120 | 122 |
121 // Allocates a TransitionArray. | 123 // Allocates a TransitionArray. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 Name* key, | 208 Name* key, |
207 Map* target); | 209 Map* target); |
208 | 210 |
209 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); | 211 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); |
210 }; | 212 }; |
211 | 213 |
212 | 214 |
213 } } // namespace v8::internal | 215 } } // namespace v8::internal |
214 | 216 |
215 #endif // V8_TRANSITIONS_H_ | 217 #endif // V8_TRANSITIONS_H_ |
OLD | NEW |