OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2302 heap_, | 2302 heap_, |
2303 proto_offset + new_number_of_transitions * step, | 2303 proto_offset + new_number_of_transitions * step, |
2304 prototype, | 2304 prototype, |
2305 UPDATE_WRITE_BARRIER); | 2305 UPDATE_WRITE_BARRIER); |
2306 prototype_transitions->set_unchecked( | 2306 prototype_transitions->set_unchecked( |
2307 heap_, | 2307 heap_, |
2308 map_offset + new_number_of_transitions * step, | 2308 map_offset + new_number_of_transitions * step, |
2309 cached_map, | 2309 cached_map, |
2310 SKIP_WRITE_BARRIER); | 2310 SKIP_WRITE_BARRIER); |
2311 } | 2311 } |
| 2312 new_number_of_transitions++; |
2312 } | 2313 } |
| 2314 } |
2313 | 2315 |
2314 // Fill slots that became free with undefined value. | 2316 if (new_number_of_transitions != number_of_transitions) { |
2315 Object* undefined = heap()->undefined_value(); | 2317 map->SetNumberOfProtoTransitions(new_number_of_transitions); |
2316 for (int i = new_number_of_transitions * step; | 2318 } |
2317 i < number_of_transitions * step; | |
2318 i++) { | |
2319 // The undefined object is on a page that is never compacted and never | |
2320 // in new space so it is OK to skip the write barrier. Also it's a | |
2321 // root. | |
2322 prototype_transitions->set_unchecked(heap_, | |
2323 header + i, | |
2324 undefined, | |
2325 SKIP_WRITE_BARRIER); | |
2326 | 2319 |
2327 Object** undefined_slot = | 2320 // Fill slots that became free with undefined value. |
2328 prototype_transitions->data_start() + i; | 2321 for (int i = new_number_of_transitions * step; |
2329 RecordSlot(undefined_slot, undefined_slot, undefined); | 2322 i < number_of_transitions * step; |
2330 } | 2323 i++) { |
2331 map->SetNumberOfProtoTransitions(new_number_of_transitions); | 2324 prototype_transitions->set_undefined(heap_, header + i); |
2332 } | 2325 } |
2333 | 2326 |
2334 // Follow the chain of back pointers to find the prototype. | 2327 // Follow the chain of back pointers to find the prototype. |
2335 Map* current = map; | 2328 Map* current = map; |
2336 while (current->IsMap()) { | 2329 while (current->IsMap()) { |
2337 current = reinterpret_cast<Map*>(current->prototype()); | 2330 current = reinterpret_cast<Map*>(current->prototype()); |
2338 ASSERT(current->IsHeapObject()); | 2331 ASSERT(current->IsHeapObject()); |
2339 } | 2332 } |
2340 Object* real_prototype = current; | 2333 Object* real_prototype = current; |
2341 | 2334 |
(...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3907 while (buffer != NULL) { | 3900 while (buffer != NULL) { |
3908 SlotsBuffer* next_buffer = buffer->next(); | 3901 SlotsBuffer* next_buffer = buffer->next(); |
3909 DeallocateBuffer(buffer); | 3902 DeallocateBuffer(buffer); |
3910 buffer = next_buffer; | 3903 buffer = next_buffer; |
3911 } | 3904 } |
3912 *buffer_address = NULL; | 3905 *buffer_address = NULL; |
3913 } | 3906 } |
3914 | 3907 |
3915 | 3908 |
3916 } } // namespace v8::internal | 3909 } } // namespace v8::internal |
OLD | NEW |