| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 66 | 66 | 
| 67 | 67 | 
| 68 static bool InsertionPointFound(String* key1, String* key2) { | 68 static bool InsertionPointFound(String* key1, String* key2) { | 
| 69   return key1->Hash() > key2->Hash(); | 69   return key1->Hash() > key2->Hash(); | 
| 70 } | 70 } | 
| 71 | 71 | 
| 72 | 72 | 
| 73 MaybeObject* TransitionArray::NewWith(SimpleTransitionFlag flag, | 73 MaybeObject* TransitionArray::NewWith(SimpleTransitionFlag flag, | 
| 74                                       String* key, | 74                                       String* key, | 
| 75                                       Map* target, | 75                                       Map* target, | 
| 76                                       DescriptorArray* descriptors, |  | 
| 77                                       Object* back_pointer) { | 76                                       Object* back_pointer) { | 
| 78   TransitionArray* result; | 77   TransitionArray* result; | 
| 79   MaybeObject* maybe_result; | 78   MaybeObject* maybe_result; | 
| 80 | 79 | 
| 81   if (flag == SIMPLE_TRANSITION) { | 80   if (flag == SIMPLE_TRANSITION) { | 
| 82     maybe_result = AllocateRaw(kSimpleTransitionSize); | 81     maybe_result = AllocateRaw(kSimpleTransitionSize); | 
| 83     if (!maybe_result->To(&result)) return maybe_result; | 82     if (!maybe_result->To(&result)) return maybe_result; | 
| 84     result->set(kSimpleTransitionTarget, target); | 83     result->set(kSimpleTransitionTarget, target); | 
| 85   } else { | 84   } else { | 
| 86     maybe_result = Allocate(1); | 85     maybe_result = Allocate(1); | 
| 87     if (!maybe_result->To(&result)) return maybe_result; | 86     if (!maybe_result->To(&result)) return maybe_result; | 
| 88     result->NoIncrementalWriteBarrierSet(0, key, target); | 87     result->NoIncrementalWriteBarrierSet(0, key, target); | 
| 89   } | 88   } | 
| 90   result->set_back_pointer_storage(back_pointer); | 89   result->set_back_pointer_storage(back_pointer); | 
| 91   result->set_descriptors(descriptors); |  | 
| 92   return result; | 90   return result; | 
| 93 } | 91 } | 
| 94 | 92 | 
| 95 | 93 | 
| 96 MaybeObject* TransitionArray::AllocateDescriptorsHolder() { |  | 
| 97   return AllocateRaw(kDescriptorsHolderSize); |  | 
| 98 } |  | 
| 99 |  | 
| 100 |  | 
| 101 MaybeObject* TransitionArray::ExtendToFullTransitionArray() { | 94 MaybeObject* TransitionArray::ExtendToFullTransitionArray() { | 
| 102   ASSERT(!IsFullTransitionArray()); | 95   ASSERT(!IsFullTransitionArray()); | 
| 103   int nof = number_of_transitions(); | 96   int nof = number_of_transitions(); | 
| 104   TransitionArray* result; | 97   TransitionArray* result; | 
| 105   MaybeObject* maybe_result = Allocate(nof); | 98   MaybeObject* maybe_result = Allocate(nof); | 
| 106   if (!maybe_result->To(&result)) return maybe_result; | 99   if (!maybe_result->To(&result)) return maybe_result; | 
| 107 | 100 | 
| 108   if (nof == 1) { | 101   if (nof == 1) { | 
| 109     result->NoIncrementalWriteBarrierCopyFrom(this, kSimpleTransitionIndex, 0); | 102     result->NoIncrementalWriteBarrierCopyFrom(this, kSimpleTransitionIndex, 0); | 
| 110   } | 103   } | 
| 111 | 104 | 
| 112   result->set_descriptors(descriptors()); |  | 
| 113   result->set_back_pointer_storage(back_pointer_storage()); | 105   result->set_back_pointer_storage(back_pointer_storage()); | 
| 114   return result; | 106   return result; | 
| 115 } | 107 } | 
| 116 | 108 | 
| 117 | 109 | 
| 118 MaybeObject* TransitionArray::CopyInsert(String* name, Map* target) { | 110 MaybeObject* TransitionArray::CopyInsert(String* name, Map* target) { | 
| 119   TransitionArray* result; | 111   TransitionArray* result; | 
| 120 | 112 | 
| 121   int number_of_transitions = this->number_of_transitions(); | 113   int number_of_transitions = this->number_of_transitions(); | 
| 122   int new_size = number_of_transitions; | 114   int new_size = number_of_transitions; | 
| 123 | 115 | 
| 124   int insertion_index = this->Search(name); | 116   int insertion_index = this->Search(name); | 
| 125   if (insertion_index == kNotFound) ++new_size; | 117   if (insertion_index == kNotFound) ++new_size; | 
| 126 | 118 | 
| 127   MaybeObject* maybe_array; | 119   MaybeObject* maybe_array; | 
| 128   maybe_array = TransitionArray::Allocate(new_size); | 120   maybe_array = TransitionArray::Allocate(new_size); | 
| 129   if (!maybe_array->To(&result)) return maybe_array; | 121   if (!maybe_array->To(&result)) return maybe_array; | 
| 130 | 122 | 
| 131   result->set_descriptors(descriptors()); |  | 
| 132 |  | 
| 133   if (HasElementsTransition()) { | 123   if (HasElementsTransition()) { | 
| 134     result->set_elements_transition(elements_transition()); | 124     result->set_elements_transition(elements_transition()); | 
| 135   } | 125   } | 
| 136 | 126 | 
| 137   if (HasPrototypeTransitions()) { | 127   if (HasPrototypeTransitions()) { | 
| 138     result->SetPrototypeTransitions(GetPrototypeTransitions()); | 128     result->SetPrototypeTransitions(GetPrototypeTransitions()); | 
| 139   } | 129   } | 
| 140 | 130 | 
| 141   if (insertion_index != kNotFound) { | 131   if (insertion_index != kNotFound) { | 
| 142     for (int i = 0; i < number_of_transitions; ++i) { | 132     for (int i = 0; i < number_of_transitions; ++i) { | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 161     result->NoIncrementalWriteBarrierCopyFrom( | 151     result->NoIncrementalWriteBarrierCopyFrom( | 
| 162         this, insertion_index, insertion_index + 1); | 152         this, insertion_index, insertion_index + 1); | 
| 163   } | 153   } | 
| 164 | 154 | 
| 165   result->set_back_pointer_storage(back_pointer_storage()); | 155   result->set_back_pointer_storage(back_pointer_storage()); | 
| 166   return result; | 156   return result; | 
| 167 } | 157 } | 
| 168 | 158 | 
| 169 | 159 | 
| 170 } }  // namespace v8::internal | 160 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|