| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } else { | 79 } else { |
| 80 result = Allocate(isolate, 1); | 80 result = Allocate(isolate, 1); |
| 81 result->NoIncrementalWriteBarrierSet(0, *name, *target); | 81 result->NoIncrementalWriteBarrierSet(0, *name, *target); |
| 82 } | 82 } |
| 83 result->set_back_pointer_storage(map->GetBackPointer()); | 83 result->set_back_pointer_storage(map->GetBackPointer()); |
| 84 return result; | 84 return result; |
| 85 } | 85 } |
| 86 | 86 |
| 87 | 87 |
| 88 Handle<TransitionArray> TransitionArray::ExtendToFullTransitionArray( | 88 Handle<TransitionArray> TransitionArray::ExtendToFullTransitionArray( |
| 89 Handle<TransitionArray> array) { | 89 Handle<Map> containing_map) { |
| 90 ASSERT(!array->IsFullTransitionArray()); | 90 ASSERT(!containing_map->transitions()->IsFullTransitionArray()); |
| 91 int nof = array->number_of_transitions(); | 91 int nof = containing_map->transitions()->number_of_transitions(); |
| 92 Handle<TransitionArray> result = Allocate(array->GetIsolate(), nof); | |
| 93 | 92 |
| 94 if (nof == 1) { | 93 // A transition array may shrink during GC. |
| 94 Handle<TransitionArray> result = Allocate(containing_map->GetIsolate(), nof); |
| 95 int new_nof = containing_map->transitions()->number_of_transitions(); |
| 96 if (new_nof != nof) { |
| 97 ASSERT(new_nof == 0); |
| 98 result->Shrink(ToKeyIndex(0)); |
| 99 } else if (nof == 1) { |
| 95 result->NoIncrementalWriteBarrierCopyFrom( | 100 result->NoIncrementalWriteBarrierCopyFrom( |
| 96 *array, kSimpleTransitionIndex, 0); | 101 containing_map->transitions(), kSimpleTransitionIndex, 0); |
| 97 } | 102 } |
| 98 | 103 |
| 99 result->set_back_pointer_storage(array->back_pointer_storage()); | 104 result->set_back_pointer_storage( |
| 105 containing_map->transitions()->back_pointer_storage()); |
| 100 return result; | 106 return result; |
| 101 } | 107 } |
| 102 | 108 |
| 103 | 109 |
| 104 Handle<TransitionArray> TransitionArray::CopyInsert(Handle<Map> map, | 110 Handle<TransitionArray> TransitionArray::CopyInsert(Handle<Map> map, |
| 105 Handle<Name> name, | 111 Handle<Name> name, |
| 106 Handle<Map> target, | 112 Handle<Map> target, |
| 107 SimpleTransitionFlag flag) { | 113 SimpleTransitionFlag flag) { |
| 108 if (!map->HasTransitionArray()) { | 114 if (!map->HasTransitionArray()) { |
| 109 return TransitionArray::NewWith(map, name, target, flag); | 115 return TransitionArray::NewWith(map, name, target, flag); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 result->NoIncrementalWriteBarrierCopyFrom( | 184 result->NoIncrementalWriteBarrierCopyFrom( |
| 179 array, insertion_index, insertion_index + 1); | 185 array, insertion_index, insertion_index + 1); |
| 180 } | 186 } |
| 181 | 187 |
| 182 result->set_back_pointer_storage(array->back_pointer_storage()); | 188 result->set_back_pointer_storage(array->back_pointer_storage()); |
| 183 return result; | 189 return result; |
| 184 } | 190 } |
| 185 | 191 |
| 186 | 192 |
| 187 } } // namespace v8::internal | 193 } } // namespace v8::internal |
| OLD | NEW |