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

Side by Side Diff: src/transitions.cc

Issue 10784014: Removed transitions from the accessor pair descriptors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed 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/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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 array->set(kElementsTransitionIndex, Smi::FromInt(0)); 47 array->set(kElementsTransitionIndex, Smi::FromInt(0));
48 array->set(kPrototypeTransitionsIndex, Smi::FromInt(0)); 48 array->set(kPrototypeTransitionsIndex, Smi::FromInt(0));
49 return array; 49 return array;
50 } 50 }
51 51
52 52
53 void TransitionArray::CopyFrom(TransitionArray* origin, 53 void TransitionArray::CopyFrom(TransitionArray* origin,
54 int origin_transition, 54 int origin_transition,
55 int target_transition, 55 int target_transition,
56 const WhitenessWitness& witness) { 56 const WhitenessWitness& witness) {
57 this->Set(target_transition, 57 Set(target_transition,
58 origin->GetKey(origin_transition), 58 origin->GetKey(origin_transition),
59 origin->GetValue(origin_transition), 59 origin->GetTarget(origin_transition),
60 witness); 60 witness);
61 } 61 }
62 62
63 63
64 static bool InsertionPointFound(String* key1, String* key2) { 64 static bool InsertionPointFound(String* key1, String* key2) {
65 return key1->Hash() > key2->Hash(); 65 return key1->Hash() > key2->Hash();
66 } 66 }
67 67
68 68
69 MaybeObject* TransitionArray::NewWith(String* name, Object* value) { 69 MaybeObject* TransitionArray::NewWith(String* name, Map* target) {
70 TransitionArray* result; 70 TransitionArray* result;
71 71
72 { MaybeObject* maybe_array; 72 { MaybeObject* maybe_array;
73 maybe_array = TransitionArray::Allocate(1); 73 maybe_array = TransitionArray::Allocate(1);
74 if (!maybe_array->To(&result)) return maybe_array; 74 if (!maybe_array->To(&result)) return maybe_array;
75 } 75 }
76 76
77 FixedArray::WhitenessWitness witness(result); 77 FixedArray::WhitenessWitness witness(result);
78 78
79 result->Set(0, name, value, witness); 79 result->Set(0, name, target, witness);
80 return result; 80 return result;
81 } 81 }
82 82
83 83
84 MaybeObject* TransitionArray::CopyInsert(String* name, Object* value) { 84 MaybeObject* TransitionArray::CopyInsert(String* name, Map* target) {
85 TransitionArray* result; 85 TransitionArray* result;
86 86
87 int number_of_transitions = this->number_of_transitions(); 87 int number_of_transitions = this->number_of_transitions();
88 int new_size = number_of_transitions; 88 int new_size = number_of_transitions;
89 89
90 int insertion_index = this->Search(name); 90 int insertion_index = this->Search(name);
91 if (insertion_index == kNotFound) ++new_size; 91 if (insertion_index == kNotFound) ++new_size;
92 92
93 { MaybeObject* maybe_array; 93 MaybeObject* maybe_array;
94 maybe_array = TransitionArray::Allocate(new_size); 94 maybe_array = TransitionArray::Allocate(new_size);
95 if (!maybe_array->To(&result)) return maybe_array; 95 if (!maybe_array->To(&result)) return maybe_array;
96 }
97 96
98 if (HasElementsTransition()) { 97 if (HasElementsTransition()) {
99 result->set_elements_transition(elements_transition()); 98 result->set_elements_transition(elements_transition());
100 } 99 }
101 100
102 if (HasPrototypeTransitions()) { 101 if (HasPrototypeTransitions()) {
103 result->SetPrototypeTransitions(GetPrototypeTransitions()); 102 result->SetPrototypeTransitions(GetPrototypeTransitions());
104 } 103 }
105 104
106 FixedArray::WhitenessWitness witness(result); 105 FixedArray::WhitenessWitness witness(result);
107 106
108 if (insertion_index != kNotFound) { 107 if (insertion_index != kNotFound) {
109 for (int i = 0; i < number_of_transitions; ++i) { 108 for (int i = 0; i < number_of_transitions; ++i) {
110 if (i != insertion_index) result->CopyFrom(this, i, i, witness); 109 if (i != insertion_index) result->CopyFrom(this, i, i, witness);
111 } 110 }
112 result->Set(insertion_index, name, value, witness); 111 result->Set(insertion_index, name, target, witness);
113 return result; 112 return result;
114 } 113 }
115 114
116 insertion_index = 0; 115 insertion_index = 0;
117 for (; insertion_index < number_of_transitions; ++insertion_index) { 116 for (; insertion_index < number_of_transitions; ++insertion_index) {
118 if (InsertionPointFound(GetKey(insertion_index), name)) break; 117 if (InsertionPointFound(GetKey(insertion_index), name)) break;
119 result->CopyFrom(this, insertion_index, insertion_index, witness); 118 result->CopyFrom(this, insertion_index, insertion_index, witness);
120 } 119 }
121 120
122 result->Set(insertion_index, name, value, witness); 121 result->Set(insertion_index, name, target, witness);
123 122
124 for (; insertion_index < number_of_transitions; ++insertion_index) { 123 for (; insertion_index < number_of_transitions; ++insertion_index) {
125 result->CopyFrom(this, insertion_index, insertion_index + 1, witness); 124 result->CopyFrom(this, insertion_index, insertion_index + 1, witness);
126 } 125 }
127 126
128 return result; 127 return result;
129 } 128 }
130 129
131 130
132 } } // namespace v8::internal 131 } } // 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