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

Side by Side Diff: src/transitions.cc

Issue 21228002: Remove elements transitions from the transition array. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/transitions.h ('k') | src/transitions-inl.h » ('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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 MaybeObject* maybe_array = heap->AllocateFixedArray(length); 43 MaybeObject* maybe_array = heap->AllocateFixedArray(length);
44 if (!maybe_array->To(&array)) return maybe_array; 44 if (!maybe_array->To(&array)) return maybe_array;
45 return array; 45 return array;
46 } 46 }
47 47
48 48
49 MaybeObject* TransitionArray::Allocate(int number_of_transitions) { 49 MaybeObject* TransitionArray::Allocate(int number_of_transitions) {
50 FixedArray* array; 50 FixedArray* array;
51 MaybeObject* maybe_array = AllocateRaw(ToKeyIndex(number_of_transitions)); 51 MaybeObject* maybe_array = AllocateRaw(ToKeyIndex(number_of_transitions));
52 if (!maybe_array->To(&array)) return maybe_array; 52 if (!maybe_array->To(&array)) return maybe_array;
53 array->set(kElementsTransitionIndex, Smi::FromInt(0));
54 array->set(kPrototypeTransitionsIndex, Smi::FromInt(0)); 53 array->set(kPrototypeTransitionsIndex, Smi::FromInt(0));
55 return array; 54 return array;
56 } 55 }
57 56
58 57
59 void TransitionArray::NoIncrementalWriteBarrierCopyFrom(TransitionArray* origin, 58 void TransitionArray::NoIncrementalWriteBarrierCopyFrom(TransitionArray* origin,
60 int origin_transition, 59 int origin_transition,
61 int target_transition) { 60 int target_transition) {
62 NoIncrementalWriteBarrierSet(target_transition, 61 NoIncrementalWriteBarrierSet(target_transition,
63 origin->GetKey(origin_transition), 62 origin->GetKey(origin_transition),
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 int number_of_transitions = this->number_of_transitions(); 112 int number_of_transitions = this->number_of_transitions();
114 int new_size = number_of_transitions; 113 int new_size = number_of_transitions;
115 114
116 int insertion_index = this->Search(name); 115 int insertion_index = this->Search(name);
117 if (insertion_index == kNotFound) ++new_size; 116 if (insertion_index == kNotFound) ++new_size;
118 117
119 MaybeObject* maybe_array; 118 MaybeObject* maybe_array;
120 maybe_array = TransitionArray::Allocate(new_size); 119 maybe_array = TransitionArray::Allocate(new_size);
121 if (!maybe_array->To(&result)) return maybe_array; 120 if (!maybe_array->To(&result)) return maybe_array;
122 121
123 if (HasElementsTransition()) {
124 result->set_elements_transition(elements_transition());
125 }
126
127 if (HasPrototypeTransitions()) { 122 if (HasPrototypeTransitions()) {
128 result->SetPrototypeTransitions(GetPrototypeTransitions()); 123 result->SetPrototypeTransitions(GetPrototypeTransitions());
129 } 124 }
130 125
131 if (insertion_index != kNotFound) { 126 if (insertion_index != kNotFound) {
132 for (int i = 0; i < number_of_transitions; ++i) { 127 for (int i = 0; i < number_of_transitions; ++i) {
133 if (i != insertion_index) { 128 if (i != insertion_index) {
134 result->NoIncrementalWriteBarrierCopyFrom(this, i, i); 129 result->NoIncrementalWriteBarrierCopyFrom(this, i, i);
135 } 130 }
136 } 131 }
(...skipping 15 matching lines...) Expand all
152 result->NoIncrementalWriteBarrierCopyFrom( 147 result->NoIncrementalWriteBarrierCopyFrom(
153 this, insertion_index, insertion_index + 1); 148 this, insertion_index, insertion_index + 1);
154 } 149 }
155 150
156 result->set_back_pointer_storage(back_pointer_storage()); 151 result->set_back_pointer_storage(back_pointer_storage());
157 return result; 152 return result;
158 } 153 }
159 154
160 155
161 } } // namespace v8::internal 156 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/transitions.h ('k') | src/transitions-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698