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 3031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3042 MapWord map_word = heap_object->map_word(); | 3042 MapWord map_word = heap_object->map_word(); |
3043 if (map_word.IsForwardingAddress()) { | 3043 if (map_word.IsForwardingAddress()) { |
3044 return map_word.ToForwardingAddress(); | 3044 return map_word.ToForwardingAddress(); |
3045 } | 3045 } |
3046 } | 3046 } |
3047 return object; | 3047 return object; |
3048 } | 3048 } |
3049 }; | 3049 }; |
3050 | 3050 |
3051 | 3051 |
3052 static inline void UpdateSlot(ObjectVisitor* v, | 3052 static inline void UpdateSlot(Isolate* isolate, |
| 3053 ObjectVisitor* v, |
3053 SlotsBuffer::SlotType slot_type, | 3054 SlotsBuffer::SlotType slot_type, |
3054 Address addr) { | 3055 Address addr) { |
3055 switch (slot_type) { | 3056 switch (slot_type) { |
3056 case SlotsBuffer::CODE_TARGET_SLOT: { | 3057 case SlotsBuffer::CODE_TARGET_SLOT: { |
3057 RelocInfo rinfo(addr, RelocInfo::CODE_TARGET, 0, NULL); | 3058 RelocInfo rinfo(addr, RelocInfo::CODE_TARGET, 0, NULL); |
3058 rinfo.Visit(v); | 3059 rinfo.Visit(isolate, v); |
3059 break; | 3060 break; |
3060 } | 3061 } |
3061 case SlotsBuffer::CODE_ENTRY_SLOT: { | 3062 case SlotsBuffer::CODE_ENTRY_SLOT: { |
3062 v->VisitCodeEntry(addr); | 3063 v->VisitCodeEntry(addr); |
3063 break; | 3064 break; |
3064 } | 3065 } |
3065 case SlotsBuffer::RELOCATED_CODE_OBJECT: { | 3066 case SlotsBuffer::RELOCATED_CODE_OBJECT: { |
3066 HeapObject* obj = HeapObject::FromAddress(addr); | 3067 HeapObject* obj = HeapObject::FromAddress(addr); |
3067 Code::cast(obj)->CodeIterateBody(v); | 3068 Code::cast(obj)->CodeIterateBody(v); |
3068 break; | 3069 break; |
3069 } | 3070 } |
3070 case SlotsBuffer::DEBUG_TARGET_SLOT: { | 3071 case SlotsBuffer::DEBUG_TARGET_SLOT: { |
3071 RelocInfo rinfo(addr, RelocInfo::DEBUG_BREAK_SLOT, 0, NULL); | 3072 RelocInfo rinfo(addr, RelocInfo::DEBUG_BREAK_SLOT, 0, NULL); |
3072 if (rinfo.IsPatchedDebugBreakSlotSequence()) rinfo.Visit(v); | 3073 if (rinfo.IsPatchedDebugBreakSlotSequence()) rinfo.Visit(isolate, v); |
3073 break; | 3074 break; |
3074 } | 3075 } |
3075 case SlotsBuffer::JS_RETURN_SLOT: { | 3076 case SlotsBuffer::JS_RETURN_SLOT: { |
3076 RelocInfo rinfo(addr, RelocInfo::JS_RETURN, 0, NULL); | 3077 RelocInfo rinfo(addr, RelocInfo::JS_RETURN, 0, NULL); |
3077 if (rinfo.IsPatchedReturnSequence()) rinfo.Visit(v); | 3078 if (rinfo.IsPatchedReturnSequence()) rinfo.Visit(isolate, v); |
3078 break; | 3079 break; |
3079 } | 3080 } |
3080 case SlotsBuffer::EMBEDDED_OBJECT_SLOT: { | 3081 case SlotsBuffer::EMBEDDED_OBJECT_SLOT: { |
3081 RelocInfo rinfo(addr, RelocInfo::EMBEDDED_OBJECT, 0, NULL); | 3082 RelocInfo rinfo(addr, RelocInfo::EMBEDDED_OBJECT, 0, NULL); |
3082 rinfo.Visit(v); | 3083 rinfo.Visit(isolate, v); |
3083 break; | 3084 break; |
3084 } | 3085 } |
3085 default: | 3086 default: |
3086 UNREACHABLE(); | 3087 UNREACHABLE(); |
3087 break; | 3088 break; |
3088 } | 3089 } |
3089 } | 3090 } |
3090 | 3091 |
3091 | 3092 |
3092 enum SweepingMode { | 3093 enum SweepingMode { |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4259 void SlotsBuffer::UpdateSlots(Heap* heap) { | 4260 void SlotsBuffer::UpdateSlots(Heap* heap) { |
4260 PointersUpdatingVisitor v(heap); | 4261 PointersUpdatingVisitor v(heap); |
4261 | 4262 |
4262 for (int slot_idx = 0; slot_idx < idx_; ++slot_idx) { | 4263 for (int slot_idx = 0; slot_idx < idx_; ++slot_idx) { |
4263 ObjectSlot slot = slots_[slot_idx]; | 4264 ObjectSlot slot = slots_[slot_idx]; |
4264 if (!IsTypedSlot(slot)) { | 4265 if (!IsTypedSlot(slot)) { |
4265 PointersUpdatingVisitor::UpdateSlot(heap, slot); | 4266 PointersUpdatingVisitor::UpdateSlot(heap, slot); |
4266 } else { | 4267 } else { |
4267 ++slot_idx; | 4268 ++slot_idx; |
4268 ASSERT(slot_idx < idx_); | 4269 ASSERT(slot_idx < idx_); |
4269 UpdateSlot(&v, | 4270 UpdateSlot(heap->isolate(), |
| 4271 &v, |
4270 DecodeSlotType(slot), | 4272 DecodeSlotType(slot), |
4271 reinterpret_cast<Address>(slots_[slot_idx])); | 4273 reinterpret_cast<Address>(slots_[slot_idx])); |
4272 } | 4274 } |
4273 } | 4275 } |
4274 } | 4276 } |
4275 | 4277 |
4276 | 4278 |
4277 void SlotsBuffer::UpdateSlotsWithFilter(Heap* heap) { | 4279 void SlotsBuffer::UpdateSlotsWithFilter(Heap* heap) { |
4278 PointersUpdatingVisitor v(heap); | 4280 PointersUpdatingVisitor v(heap); |
4279 | 4281 |
4280 for (int slot_idx = 0; slot_idx < idx_; ++slot_idx) { | 4282 for (int slot_idx = 0; slot_idx < idx_; ++slot_idx) { |
4281 ObjectSlot slot = slots_[slot_idx]; | 4283 ObjectSlot slot = slots_[slot_idx]; |
4282 if (!IsTypedSlot(slot)) { | 4284 if (!IsTypedSlot(slot)) { |
4283 if (!IsOnInvalidatedCodeObject(reinterpret_cast<Address>(slot))) { | 4285 if (!IsOnInvalidatedCodeObject(reinterpret_cast<Address>(slot))) { |
4284 PointersUpdatingVisitor::UpdateSlot(heap, slot); | 4286 PointersUpdatingVisitor::UpdateSlot(heap, slot); |
4285 } | 4287 } |
4286 } else { | 4288 } else { |
4287 ++slot_idx; | 4289 ++slot_idx; |
4288 ASSERT(slot_idx < idx_); | 4290 ASSERT(slot_idx < idx_); |
4289 Address pc = reinterpret_cast<Address>(slots_[slot_idx]); | 4291 Address pc = reinterpret_cast<Address>(slots_[slot_idx]); |
4290 if (!IsOnInvalidatedCodeObject(pc)) { | 4292 if (!IsOnInvalidatedCodeObject(pc)) { |
4291 UpdateSlot(&v, | 4293 UpdateSlot(heap->isolate(), |
| 4294 &v, |
4292 DecodeSlotType(slot), | 4295 DecodeSlotType(slot), |
4293 reinterpret_cast<Address>(slots_[slot_idx])); | 4296 reinterpret_cast<Address>(slots_[slot_idx])); |
4294 } | 4297 } |
4295 } | 4298 } |
4296 } | 4299 } |
4297 } | 4300 } |
4298 | 4301 |
4299 | 4302 |
4300 SlotsBuffer* SlotsBufferAllocator::AllocateBuffer(SlotsBuffer* next_buffer) { | 4303 SlotsBuffer* SlotsBufferAllocator::AllocateBuffer(SlotsBuffer* next_buffer) { |
4301 return new SlotsBuffer(next_buffer); | 4304 return new SlotsBuffer(next_buffer); |
(...skipping 10 matching lines...) Expand all Loading... |
4312 while (buffer != NULL) { | 4315 while (buffer != NULL) { |
4313 SlotsBuffer* next_buffer = buffer->next(); | 4316 SlotsBuffer* next_buffer = buffer->next(); |
4314 DeallocateBuffer(buffer); | 4317 DeallocateBuffer(buffer); |
4315 buffer = next_buffer; | 4318 buffer = next_buffer; |
4316 } | 4319 } |
4317 *buffer_address = NULL; | 4320 *buffer_address = NULL; |
4318 } | 4321 } |
4319 | 4322 |
4320 | 4323 |
4321 } } // namespace v8::internal | 4324 } } // namespace v8::internal |
OLD | NEW |