| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 5296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5307 | 5307 |
| 5308 | 5308 |
| 5309 void Code::CodeIterateBody(ObjectVisitor* v) { | 5309 void Code::CodeIterateBody(ObjectVisitor* v) { |
| 5310 int mode_mask = RelocInfo::kCodeTargetMask | | 5310 int mode_mask = RelocInfo::kCodeTargetMask | |
| 5311 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 5311 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 5312 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | | 5312 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | |
| 5313 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | | 5313 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | |
| 5314 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | | 5314 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | |
| 5315 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); | 5315 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); |
| 5316 | 5316 |
| 5317 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { | 5317 // Use the relocation info pointer before it is visited by |
| 5318 // the heap compaction in the next statement. |
| 5319 RelocIterator it(this, mode_mask); |
| 5320 |
| 5321 IteratePointers(v, |
| 5322 kRelocationInfoOffset, |
| 5323 kRelocationInfoOffset + kPointerSize); |
| 5324 |
| 5325 for (; !it.done(); it.next()) { |
| 5318 it.rinfo()->Visit(v); | 5326 it.rinfo()->Visit(v); |
| 5319 } | 5327 } |
| 5320 | 5328 |
| 5321 ScopeInfo<>::IterateScopeInfo(this, v); | 5329 ScopeInfo<>::IterateScopeInfo(this, v); |
| 5322 } | 5330 } |
| 5323 | 5331 |
| 5324 | 5332 |
| 5325 void Code::Relocate(intptr_t delta) { | 5333 void Code::Relocate(intptr_t delta) { |
| 5326 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { | 5334 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { |
| 5327 it.rinfo()->apply(delta); | 5335 it.rinfo()->apply(delta); |
| 5328 } | 5336 } |
| 5329 CPU::FlushICache(instruction_start(), instruction_size()); | 5337 CPU::FlushICache(instruction_start(), instruction_size()); |
| 5330 } | 5338 } |
| 5331 | 5339 |
| 5332 | 5340 |
| 5333 void Code::CopyFrom(const CodeDesc& desc) { | 5341 void Code::CopyFrom(const CodeDesc& desc) { |
| 5334 // copy code | 5342 // copy code |
| 5335 memmove(instruction_start(), desc.buffer, desc.instr_size); | 5343 memmove(instruction_start(), desc.buffer, desc.instr_size); |
| 5336 | 5344 |
| 5337 // fill gap with zero bytes | |
| 5338 { byte* p = instruction_start() + desc.instr_size; | |
| 5339 byte* q = relocation_start(); | |
| 5340 while (p < q) { | |
| 5341 *p++ = 0; | |
| 5342 } | |
| 5343 } | |
| 5344 | |
| 5345 // copy reloc info | 5345 // copy reloc info |
| 5346 memmove(relocation_start(), | 5346 memmove(relocation_start(), |
| 5347 desc.buffer + desc.buffer_size - desc.reloc_size, | 5347 desc.buffer + desc.buffer_size - desc.reloc_size, |
| 5348 desc.reloc_size); | 5348 desc.reloc_size); |
| 5349 | 5349 |
| 5350 // unbox handles and relocate | 5350 // unbox handles and relocate |
| 5351 intptr_t delta = instruction_start() - desc.buffer; | 5351 intptr_t delta = instruction_start() - desc.buffer; |
| 5352 int mode_mask = RelocInfo::kCodeTargetMask | | 5352 int mode_mask = RelocInfo::kCodeTargetMask | |
| 5353 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 5353 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 5354 RelocInfo::kApplyMask; | 5354 RelocInfo::kApplyMask; |
| (...skipping 3414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8769 if (break_point_objects()->IsUndefined()) return 0; | 8769 if (break_point_objects()->IsUndefined()) return 0; |
| 8770 // Single beak point. | 8770 // Single beak point. |
| 8771 if (!break_point_objects()->IsFixedArray()) return 1; | 8771 if (!break_point_objects()->IsFixedArray()) return 1; |
| 8772 // Multiple break points. | 8772 // Multiple break points. |
| 8773 return FixedArray::cast(break_point_objects())->length(); | 8773 return FixedArray::cast(break_point_objects())->length(); |
| 8774 } | 8774 } |
| 8775 #endif | 8775 #endif |
| 8776 | 8776 |
| 8777 | 8777 |
| 8778 } } // namespace v8::internal | 8778 } } // namespace v8::internal |
| OLD | NEW |