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 7637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7648 | 7648 |
7649 void Code::Relocate(intptr_t delta) { | 7649 void Code::Relocate(intptr_t delta) { |
7650 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { | 7650 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { |
7651 it.rinfo()->apply(delta); | 7651 it.rinfo()->apply(delta); |
7652 } | 7652 } |
7653 CPU::FlushICache(instruction_start(), instruction_size()); | 7653 CPU::FlushICache(instruction_start(), instruction_size()); |
7654 } | 7654 } |
7655 | 7655 |
7656 | 7656 |
7657 void Code::CopyFrom(const CodeDesc& desc) { | 7657 void Code::CopyFrom(const CodeDesc& desc) { |
| 7658 ASSERT(Marking::Color(this) == Marking::WHITE_OBJECT); |
| 7659 |
7658 // copy code | 7660 // copy code |
7659 memmove(instruction_start(), desc.buffer, desc.instr_size); | 7661 memmove(instruction_start(), desc.buffer, desc.instr_size); |
7660 | 7662 |
7661 // copy reloc info | 7663 // copy reloc info |
7662 memmove(relocation_start(), | 7664 memmove(relocation_start(), |
7663 desc.buffer + desc.buffer_size - desc.reloc_size, | 7665 desc.buffer + desc.buffer_size - desc.reloc_size, |
7664 desc.reloc_size); | 7666 desc.reloc_size); |
7665 | 7667 |
7666 // unbox handles and relocate | 7668 // unbox handles and relocate |
7667 intptr_t delta = instruction_start() - desc.buffer; | 7669 intptr_t delta = instruction_start() - desc.buffer; |
7668 int mode_mask = RelocInfo::kCodeTargetMask | | 7670 int mode_mask = RelocInfo::kCodeTargetMask | |
7669 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 7671 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
7670 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) | | 7672 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) | |
7671 RelocInfo::kApplyMask; | 7673 RelocInfo::kApplyMask; |
7672 Assembler* origin = desc.origin; // Needed to find target_object on X64. | 7674 Assembler* origin = desc.origin; // Needed to find target_object on X64. |
7673 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { | 7675 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { |
7674 RelocInfo::Mode mode = it.rinfo()->rmode(); | 7676 RelocInfo::Mode mode = it.rinfo()->rmode(); |
7675 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 7677 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
7676 Handle<Object> p = it.rinfo()->target_object_handle(origin); | 7678 Handle<Object> p = it.rinfo()->target_object_handle(origin); |
7677 it.rinfo()->set_target_object(*p); | 7679 it.rinfo()->set_target_object(*p, SKIP_WRITE_BARRIER); |
7678 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { | 7680 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { |
7679 Handle<JSGlobalPropertyCell> cell = it.rinfo()->target_cell_handle(); | 7681 Handle<JSGlobalPropertyCell> cell = it.rinfo()->target_cell_handle(); |
7680 it.rinfo()->set_target_cell(*cell); | 7682 it.rinfo()->set_target_cell(*cell, SKIP_WRITE_BARRIER); |
7681 } else if (RelocInfo::IsCodeTarget(mode)) { | 7683 } else if (RelocInfo::IsCodeTarget(mode)) { |
7682 // rewrite code handles in inline cache targets to direct | 7684 // rewrite code handles in inline cache targets to direct |
7683 // pointers to the first instruction in the code object | 7685 // pointers to the first instruction in the code object |
7684 Handle<Object> p = it.rinfo()->target_object_handle(origin); | 7686 Handle<Object> p = it.rinfo()->target_object_handle(origin); |
7685 Code* code = Code::cast(*p); | 7687 Code* code = Code::cast(*p); |
7686 it.rinfo()->set_target_address(code->instruction_start()); | 7688 it.rinfo()->set_target_address(code->instruction_start(), |
| 7689 SKIP_WRITE_BARRIER); |
7687 } else { | 7690 } else { |
7688 it.rinfo()->apply(delta); | 7691 it.rinfo()->apply(delta); |
7689 } | 7692 } |
7690 } | 7693 } |
7691 CPU::FlushICache(instruction_start(), instruction_size()); | 7694 CPU::FlushICache(instruction_start(), instruction_size()); |
7692 } | 7695 } |
7693 | 7696 |
7694 | 7697 |
7695 // Locate the source position which is closest to the address in the code. This | 7698 // Locate the source position which is closest to the address in the code. This |
7696 // is using the source position information embedded in the relocation info. | 7699 // is using the source position information embedded in the relocation info. |
(...skipping 4885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12582 if (break_point_objects()->IsUndefined()) return 0; | 12585 if (break_point_objects()->IsUndefined()) return 0; |
12583 // Single break point. | 12586 // Single break point. |
12584 if (!break_point_objects()->IsFixedArray()) return 1; | 12587 if (!break_point_objects()->IsFixedArray()) return 1; |
12585 // Multiple break points. | 12588 // Multiple break points. |
12586 return FixedArray::cast(break_point_objects())->length(); | 12589 return FixedArray::cast(break_point_objects())->length(); |
12587 } | 12590 } |
12588 #endif // ENABLE_DEBUGGER_SUPPORT | 12591 #endif // ENABLE_DEBUGGER_SUPPORT |
12589 | 12592 |
12590 | 12593 |
12591 } } // namespace v8::internal | 12594 } } // namespace v8::internal |
OLD | NEW |