| 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 5274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5285 | 5285 |
| 5286 | 5286 |
| 5287 void Code::CodeIterateBody(ObjectVisitor* v) { | 5287 void Code::CodeIterateBody(ObjectVisitor* v) { |
| 5288 int mode_mask = RelocInfo::kCodeTargetMask | | 5288 int mode_mask = RelocInfo::kCodeTargetMask | |
| 5289 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 5289 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 5290 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | | 5290 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | |
| 5291 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | | 5291 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | |
| 5292 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | | 5292 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | |
| 5293 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); | 5293 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); |
| 5294 | 5294 |
| 5295 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { | 5295 // Use the relocation info pointer before it is visited by |
| 5296 // the heap compaction in the next statement. |
| 5297 RelocIterator it(this, mode_mask); |
| 5298 |
| 5299 IteratePointers(v, |
| 5300 kRelocationInfoOffset, |
| 5301 kRelocationInfoOffset + kPointerSize); |
| 5302 |
| 5303 for (; !it.done(); it.next()) { |
| 5296 it.rinfo()->Visit(v); | 5304 it.rinfo()->Visit(v); |
| 5297 } | 5305 } |
| 5298 | 5306 |
| 5299 ScopeInfo<>::IterateScopeInfo(this, v); | 5307 ScopeInfo<>::IterateScopeInfo(this, v); |
| 5300 } | 5308 } |
| 5301 | 5309 |
| 5302 | 5310 |
| 5303 void Code::Relocate(intptr_t delta) { | 5311 void Code::Relocate(intptr_t delta) { |
| 5304 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { | 5312 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { |
| 5305 it.rinfo()->apply(delta); | 5313 it.rinfo()->apply(delta); |
| 5306 } | 5314 } |
| 5307 CPU::FlushICache(instruction_start(), instruction_size()); | 5315 CPU::FlushICache(instruction_start(), instruction_size()); |
| 5308 } | 5316 } |
| 5309 | 5317 |
| 5310 | 5318 |
| 5311 void Code::CopyFrom(const CodeDesc& desc) { | 5319 void Code::CopyFrom(const CodeDesc& desc) { |
| 5312 // copy code | 5320 // copy code |
| 5313 memmove(instruction_start(), desc.buffer, desc.instr_size); | 5321 memmove(instruction_start(), desc.buffer, desc.instr_size); |
| 5314 | 5322 |
| 5315 // fill gap with zero bytes | |
| 5316 { byte* p = instruction_start() + desc.instr_size; | |
| 5317 byte* q = relocation_start(); | |
| 5318 while (p < q) { | |
| 5319 *p++ = 0; | |
| 5320 } | |
| 5321 } | |
| 5322 | |
| 5323 // copy reloc info | 5323 // copy reloc info |
| 5324 memmove(relocation_start(), | 5324 memmove(relocation_start(), |
| 5325 desc.buffer + desc.buffer_size - desc.reloc_size, | 5325 desc.buffer + desc.buffer_size - desc.reloc_size, |
| 5326 desc.reloc_size); | 5326 desc.reloc_size); |
| 5327 | 5327 |
| 5328 // unbox handles and relocate | 5328 // unbox handles and relocate |
| 5329 intptr_t delta = instruction_start() - desc.buffer; | 5329 intptr_t delta = instruction_start() - desc.buffer; |
| 5330 int mode_mask = RelocInfo::kCodeTargetMask | | 5330 int mode_mask = RelocInfo::kCodeTargetMask | |
| 5331 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 5331 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 5332 RelocInfo::kApplyMask; | 5332 RelocInfo::kApplyMask; |
| (...skipping 3405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8738 if (break_point_objects()->IsUndefined()) return 0; | 8738 if (break_point_objects()->IsUndefined()) return 0; |
| 8739 // Single beak point. | 8739 // Single beak point. |
| 8740 if (!break_point_objects()->IsFixedArray()) return 1; | 8740 if (!break_point_objects()->IsFixedArray()) return 1; |
| 8741 // Multiple break points. | 8741 // Multiple break points. |
| 8742 return FixedArray::cast(break_point_objects())->length(); | 8742 return FixedArray::cast(break_point_objects())->length(); |
| 8743 } | 8743 } |
| 8744 #endif | 8744 #endif |
| 8745 | 8745 |
| 8746 | 8746 |
| 8747 } } // namespace v8::internal | 8747 } } // namespace v8::internal |
| OLD | NEW |